Identity API References

Base URLs

https://identity-api.dev.dimo.zone


GraphQL Operations

The Identity API provides one endpoint /query, for query execution.

Constructing a GraphQL Query

To construct a GraphQL query, use the interactive playground to explore the nodes and how each resources are connected. To understand how GraphQL queries are constructed, please check out this tutorial below:

Sample Query

Here's a sample query trying to fetch for a vehicle with a tokenId of 21957. Here, I'm naturally specifying what information I want returned from the API, namely the id of the vehicle, aftermarketDevice information, syntheticDevice information, and definition for the selected vehicle:

query {
  vehicle (tokenId: 21957) {
    id
    aftermarketDevice {
      tokenId
      address
    }
    syntheticDevice {
      address
      tokenId
    }
    definition {
      make
      model
      year
    }
  }
}

Sending a GraphQL Query

To send a GraphQL query, simply send your formatted request to {baseUrl}/query and a response will be returned to you.

Sample Payload

This is a sample payload of what I attempted to fetch for in Sample Query:

{
  "data": {
    "vehicle": {
      "id": "V_kc1VxQ==",
      "aftermarketDevice": {
        "tokenId": 13986,
        "address": "0xDDF4C4eC0023d957f4DbEFeBbD158bF6E01bE8c8"
      },
      "syntheticDevice": {
        "address": "0x2A23E35Aa76C95Eb0E29849eC4F874771ad13402",
        "tokenId": 16494
      },
      "definition": {
        "make": "Lexus",
        "model": "NX",
        "year": 2021
      }
    }
  }
}

Paginating through GraphQL Payload

When returning a GraphQL payload that consists of multiple results, such as vehicles or manufacturers, there may be times where the length of the payload is too long for your current operation to display - this is when pagination is needed. To paginate through the results returned, look for the pagination fields listed below under pageInfo.

Sample Query

{
    vehicles(first: 5) {
        nodes {
            id
            name
        }
        pageInfo {
            startCursor
            endCursor
            hasPreviousPage
            hasNextPage
        }
    }
}

Sample Payload

{
    "data": {
        "vehicles": {
            "nodes": [
                {
                    "id": "V_kc2lUw==",
                    "name": "father chimney abandon"
                },
                {
                    "id": "V_kc2lUg==",
                    "name": "famous chimney abandon"
                },
                {
                    "id": "V_kc2lUQ==",
                    "name": "faculty chimney abandon"
                },
                {
                    "id": "V_kc2lUA==",
                    "name": "expose chimney abandon"
                },
                {
                    "id": "V_kc2lTw==",
                    "name": "exile chimney abandon"
                }
            ],
            "pageInfo": {
                "startCursor": "NDIzMjM=",
                "endCursor": "NDIzMTk=",
                "hasPreviousPage": false,
                "hasNextPage": true
            }
        }
    }
}

GraphQL Playground

Last updated