Schema

The API responses from v1 all extend this basic response schema. The schema is defined in Typescript.

interface Base_ApiV1 {
  _self: Link; // This is the Link of the current endpoint
  _version: "v1"; // The Api version
  _description: string; // A short desciption of what the endpoint does
  _links: Array<Link>; // Hyperlinks to navigate to from here
}

The base response is implemented by all endpoints. It serves to make the API self descriptive.

All endpoints provide hyperlinks to help navigate the API and will list the available HTTP Request methods that are supported.

interface Link {
  href: string;
  methods: Array<Methods>
}

enum Methods {
  GET = "GET",
  POST = "POST",
  DELETE = "DELETE",
  PUT = "PUT",
}

Errors

The API will return errors using this generic interface. If the response status is not 200, then you can expect to find an error message in the response.

Pagination

Endpoints that return multiple results implement a Pagination interface that will let you query for lists paginated. You can identify these endpoints as they don't support [slug] parameter, which is used for fetching data individually and we will discuss it later.

The endpoints that support pagination will return these parameters:

When using Pagination, the request url can contain the following query parameters:

If any of these are missing from the request, the default parameters are used.

A paginated GET request would have the following URL parameters:

This will fetch a page with a custom page size, sorted by network_id

Filtering is available when fetching collections. The applied filters are returned as a collection of filters

While available filters are returned as an array of strings!

To use a filter you must use the filter query parameter in the URL and JSON encode your parameters

Example:

This request will return all open virtual accounts on the network 0x405 using the default pagination

Last updated