Execute Function Tasks
Overview
Execute a Function Task and retrieve the result.
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.
Execute a task using the provided task name. 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.
Total number of solutions required for the task.
Number of solutions required to complete the task.
Timeout for task execution in milliseconds.
Task Requester Timestamp. This value is used to calculate the random bits in the node selection Phase.
Successful operation
Bad request, invalid input.
Internal server error.
POST /task/function/execute-by-name HTTP/1.1
Host: run.truebit.network
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 172
{
"namespace": "namespace1",
"taskName": "task1",
"input": "20",
"executionTimeout": 6000,
"totalSolutions": 1,
"requiredSolutions": 1,
"taskRequesterTimestamp": 1710262226,
"async": true
}
{
"executionId": "c49568e2-1a04-4d60-bab6-c56f92115540",
"clearTextSolution": {
"output": "function task output",
"executionStatus": "succeed",
"senderAddress": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
"signature": {
"v": 28,
"r": "20476805d11bd09ecad1b67102a0be84810749430bf8deca83f93de9b185d486",
"s": "07f38e3b363300f4997460ddef83c0769dedfd7ba8a61a21236081b5b8f74e66"
}
},
"verificationStatus": "Success"
}
Authorization
API KEY
To get authorized using an API Key, include the registered API Key in the call's header. This allows the dispatcher service to validate access and identify who will cover the cost of the task execution (the address associated with the API Key).
Example
X-API-KEY: be0dc6ba-9a60-4777-b5b7-60ed2397e3ed
Last updated
Was this helpful?