API Interactions
The CRE SDK provides an HTTP client that allows your workflows to interact with external APIs. Use it to fetch offchain data, send results to other systems, or trigger external events.
These guides will walk you through the common use cases for the HTTP client.
CRE reports over HTTP
A CRE report is a DON-signed package your workflow creates with runtime.report() (TypeScript) or runtime.GenerateReport() (Go). It contains your encoded payload, workflow metadata, and cryptographic signatures.
Most secure HTTP integrations involve two parties:
Sender workflow (CRE): runs on a schedule or trigger, does your logic, then creates and ships the report:
- Run business logic and encode your payload.
- Call
runtime.report()/GenerateReport()so the DON signs the report. - Call
sendReport()to POST the report to your URL.
Receiver: a separate system that gets that HTTP POST (your API, or another CRE workflow with an HTTP trigger):
- Verify signatures with
Report.parse()/ParseReport(), then use the payload. See Verifying CRE Reports Offchain.
The sender creates the report in step 2; you do not fetch it from somewhere else first. The receiver must verify before trusting the data: the sender does not do that for you.
Guides
- Making GET Requests: Learn how to fetch data from a public API using a
GETrequest. - Making POST Requests: Learn how to send data to an external endpoint using a
POSTrequest. - Submitting Reports via HTTP: Learn how to submit cryptographically signed reports to an external HTTP endpoint.
- Verifying CRE Reports Offchain: Verify report signatures and read workflow metadata when receiving reports over HTTP or other offchain channels.