Run API
Introduction
The Run API is simplest way to consume your project APIs. You trigger a single API from your project, and then retrieve the results directly.
There are two ways to consume these APIs: synchronously and asynchronously. In synchronous calls, the result is returned in the same call. In asynchronous calls, the result is returned in a separate call using a runId
obtained in the initial call.
Synchronous API
The synchronous API (Sync API) is the simplest way to consume your project APIs. It allows you to trigger single APIs in your projects and get the result back in the same call.
In order to consume it, just call sync with the API name, parameters and any other configurations.
Keep in mind that the project API run can take a long time to complete, especially (but not necessarily) if the implementation is complex and involves many steps. For this reason, we recommend using the Asynchronous API for most use cases.
API reference
Asynchronous API
The asynchronous API (Async API) allows you to start the API call and receive a runId
which you can use to check the status of the run and get the result.
In more detail, consuming the Async API involves the following steps:
- Start the API run: Start the API run by calling start with the API name, parameters and any other configurations.
- Get the
runId
: The start response will include arunId
, it will be used to get the result. For example:
- Check the result: Use the
runId
to check the result of the run by calling result.
- The response will include a
status
field to indicate the status of the run.pending
means the run is still in progress,completed
orfailed
means the run finished, with success and failure respectively.
runId
can also be used to monitor your runs in the Runs tab of your project.