REST API
Your First Requests
Once you have your API key and Oracle Program ID, you can make your first request to SEDA FAST.
Basic Example (cURL):
curl -X GET "https://fast-api.seda.xyz/execute?execProgramId=YOUR_PROGRAM_ID&execInputs=YOUR_INPUTS" \\
-H "Authorization: Bearer YOUR_API_KEY"Javascript Example:
const response = await fetch(
'https://fast-api.seda.xyz/execute?execProgramId=YOUR_PROGRAM_ID&execInputs=YOUR_INPUTS',
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);
const data = await response.json();
console.log(data);Understanding the Response
A successful execution returns a JSON response structured as follows:
Key fields:
id- Unique identifier for this execution requestdataRequest- Details of the Oracle Program execution request (program IDs, inputs, gas limits)dataResult.result- The hex-encoded final result from the Oracle ProgramdataResult.exitCode- 0 indicates success, non-zero indicates an errordataResult.gasUsed- Total gas consumed during executiondataResult.drId- Unique identifier for this data requestsignature- Cryptographic signature produced by the FAST service.result- Convenient top-level access to the result (same as dataResult.result)
Basic Error Handling
SEDA FAST uses standard HTTP status codes to indicate success or failure. Always check the response status before processing the data. Common error codes include insufficient credits (403), invalid API keys (401), and program execution failures (599).
Javascript example:
The error code 599 is a special case. The request succeeded, but the oracle program ran into a problem during execution and exited with a non-zero exit code. When debugging these failures, the response can include additional fields like "stderr" and "stdout" to help identify the issue (use the includeDebugInfo parameter to enable these).
For a complete list of error codes and their meanings, see the Error Codes section in the REST API Reference.
Last updated
Was this helpful?
