Skip to main content

JsonApi

Data retrieval from Web2 JSON APIs with JQ transformations. This attestation type allows smart contracts to access and process external JSON data in a verifiable way.

Testnet Only

JsonApi attestation type is currently only available on Flare Testnet Coston2 and Songbird Testnet Coston.

Supported sources

Network TypeSources
Web2WEB2 (Web 2.0 JSON APIs)
TestnettestWEB2

Request

FieldSolidity TypeDescription
urlstringURL of the JSON API endpoint to query.
postprocessJqstringJQ filter expression to transform the retrieved JSON data.
abi_signaturestringABI signature defining the struct format for encoding the transformed JSON data.

Response

FieldSolidity TypeDescription
abi_encoded_databytesABI-encoded data result after JQ transformation.

Verification Process

1. API Request

The attestation service performs a GET request to the specified url.

  • If the request fails or returns non-JSON data, the attestation request is rejected.
  • The service validates that the response is valid JSON data.

2. JQ Transformation

The specified postprocessJq filter is applied to the retrieved JSON:

  • The JQ filter must be a valid JQ expression.
  • The filter's output must match the structure defined in abi_signature.
  • If the JQ transformation fails, the attestation request is rejected.

3. ABI Encoding

The transformed data is ABI-encoded according to the provided abi_signature:

  • The encoding must match the Solidity ABI specification.
  • The encoded bytes are returned in abi_encoded_data.