Using APIs

Check out this demo, which walks you through using a Dhali linked API:

Each API on Dhali has a unique base endpoint. To access the API, send requests to the base endpoint with extra routes, etc, determined by the API's spec. All you need to do in addition is add a payment claim (i.e., a Dhali API key). This is a JSON object embedded in the request header to fund the service, taking the following form:

{
    "account": "<Your account classic address>",
    "destination_account": "<Dhali's classic address>",
    "authorized_to_claim": "<The max drops (millionths of an XRP or XAH) that this payment claim allows to be extracted from the channel>",
    "signature": "<A cryptographic signature that only 'account' can create>",
    "channel_id": "<The ID of the channel>"
}

Once you have a payment claim, you can use the API:

URL

API request URLs through Dhali take the form:

https://run.api.dhali.io/{uuid}/{other_paths}

Path parameters

Name Type Description
uuid String The UUID of the API
other_paths String The API provider's route

Supported methods:

Dhali supports all REST methods: GET, POST, PUT, DELETE, PATCH

Headers

Name Type Description
Payment-Claim String A receipt against your payment channel
... String Headers required by the API provider

Query paramters

Dhali forwards all query strings to the linked API.

200: OK

The execution was successful. You will receive a response with the following headers:

Name Type Description
dhali-latest-request-charge String The cost of this request.
... String Any other headers returned by the linked API

The body of the response will be:

{
    <The API's output>
}

402: Bad payment claim.

{
    detail: "<Why your payment claim was not valid>"
}