API Nodes

API Nodes are the backbone of the Mainsail blockchain, serving as the access points for interacting with the network. This section provides information on the available endpoints to query the list of API nodes.

Properties

  • Name
    url
    Type
    string
    Description

    The URL of the API node.

  • Name
    height
    Type
    integer
    Description

    The current height of the blockchain as reported by the node.

  • Name
    latency
    Type
    integer
    Description

    The latency of the node in milliseconds.

  • Name
    version
    Type
    string
    Description

    The version that the API node is running.


GET/api-nodes

List All API Nodes

The Public API may be used to query for all available API nodes serving the Mainsail blockchain.

Query Parameters

  • Name
    ip
    Type
    string
    Description

    Filter nodes by their IP address.

  • Name
    version
    Type
    string
    Description

    Filter nodes by the version of the software they are running.

  • Name
    transform
    Type
    boolean
    Description

    Whether to transform the response structure.

  • Name
    orderBy
    Type
    string
    Description

    The column and order by which the nodes will be sorted.

  • Name
    page
    Type
    integer
    Description

    The number of the page that will be returned.

  • Name
    limit
    Type
    integer
    Description

    The number of resources per page.

  • Name
    offset
    Type
    integer
    Description

    The number of resources to be skipped.

Request

GET
/api-nodes
curl -G https://testnet.mainsailhq.com/api/api-nodes \
  -d ip=192.168.1.1 \
  -d version=1.0.0 \
  -d page=1 \
  -d limit=5

Response

{
  "meta": {
    "totalCountIsEstimate": true,
    "count": 1,
    "first": "/api-nodes?ip=192.168.1.1&version=1.0.0&transform=true&limit=5&page=1",
    "last": "/api-nodes?ip=192.168.1.1&version=1.0.0&transform=true&limit=5&page=1",
    "next": null,
    "pageCount": 1,
    "previous": null,
    "self": "/api-nodes?ip=192.168.1.1&version=1.0.0&transform=true&limit=5&page=1",
    "totalCount": 1
  },
  "data": [
    {
      "url": "https://node.example.com",
      "version": "1.0.0",
      "height": 64476,
      "latency": 30,
      "status": "online"
    }
  ]
}