Execute API Tasks
API Doc
Interactive API docs can be found at: https://run.truebit.network/dispatcher/api-docs/
Overview
You can configure the endpoint for either a synchronous or asynchronous response. In sync mode, if the result is ready within 60 seconds, it will be returned immediately. If not, you'll receive an executionId, which you can use to check the result later by calling the status endpoint.
When executing an API Task, your task input will need to specify the API endpoint path, HTTP method type, and API input parameters. These parameters must match the schema defined in the API Task manifest.
Execute a API task using the provided task ID. Supports both synchronous and asynchronous execution.
API key for authentication.
The namespace of the task.
The name of the task to be executed.
Label of the task.
Version number of the task.
If true, the endpoint will retrieve the executionId; otherwise, it will try to return the execution result only if it completes within 60 seconds.
Input data required for task execution.
Timeout for task execution in seconds.
Successful execution
Bad request, invalid input.
Not authorized.
Payment required.
Internal server error.
POST /task/api/execute-by-name HTTP/1.1
Host: run.truebit.network
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 103
{
"namespace": "namespacetest",
"taskName": "tasktestapi",
"input": {},
"executionTimeout": 10000,
"async": true
}{
"executionId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee",
"clearTextSolution": {
"output": {},
"status": "succeed",
"senderAddress": "0x************************************2266"
},
"status": "Success",
"totalTransferredBytes": {
"request": 194,
"response": 438
}
}Authorization
API KEY
To get authorization to execute a task, include your registered API key in the request header. This allows Truebit to validate your access and identify the account responsible for covering the task execution cost (linked to the API key’s associated address).
Example
X-API-KEY: be0dc6ba-9a60-4777-b5b7-60ed2397e3edLast updated
Was this helpful?