Skip to main content

abstra.services

Run actions of services (other projects) this project has access to. See Services.

from abstra.services import (
ServiceActionError,
describe_service_action,
list_service_actions,
list_services,
run_service_action,
)

run_service_action​

Runs an action of a service as this project and returns the hook's response body.

result = run_service_action(service_id, action, parameters)
NameDescriptionTypeDefault
service_id (required)The service's project id.str
action (required)The action name.str
parametersThe action's parameters, matching its input schema.dict{}

Returns the hook's response body, parsed as JSON when it is JSON, otherwise the raw text.

Raises ServiceActionError when the call is refused or the hook answers with status 400 or above.

list_services​

services = list_services()

Returns the services this project holds a role on, each with id and name.

list_service_actions​

actions = list_service_actions(service_id)

Returns the service's actions this project may run, each with name and, when set, title and description.

describe_service_action​

action = describe_service_action(service_id, action)

Returns the action's name, title, description, input (JSON Schema of the parameters) and output (JSON Schema of the answer, when declared).

ServiceActionError​

AttributeDescription
statusThe HTTP status: Abstra's, when the call was refused, or the hook's own.
codeWhy Abstra refused the call (see below), or None for the hook's own errors.
detailsThe validation errors, the limit that was hit, or the hook's response body.

Errors​

StatuscodeMeaning
400invalid_parametersThe parameters don't match the action's input schema. details["errors"] lists each error with its path and message. The hook didn't run.
403missing_roleThis project holds a role on the service, but not one this action requires.
404The service or the action doesn't exist, isn't available, or this project can't reach it.
429rate_limitedToo many calls from this project to this service: 120 a minute, or 10 at the same time. details has the limit and, for the per-minute limit, retryAfterSeconds.
508call_depth_exceededThe chain of calls between projects reached 8.
400–599NoneThe hook answered with this status. details is its response body.

abstra.apps (deprecated)​

The module's name before the rename to Services. It still works and prints a deprecation warning on each call:

DeprecatedUse
run_app_action(project_id, action, parameters)run_service_action(service_id, action, parameters)
list_connected_apps()list_services()
list_app_actions(project_id)list_service_actions(service_id)
describe_app_action(project_id, action)describe_service_action(service_id, action)
AppActionErrorServiceActionError (the same class)