Common Queries

Cheat sheet to get you started on the Identity API

General Info

Getting the total count of vehicles on the DIMO Network
query GetTotalVehicles { 
  vehicles (first: 10) {
    totalCount
  }
}

Developer License Info

Getting information on Developer License for a given License Token ID
query GetDevLicenseByTokenId {
  developerLicense (by: { tokenId: 1 } ) {
    owner
    tokenId
    alias
    clientId
    mintedAt
    redirectURIs (first: 10) {
      nodes {
        uri
        enabledAt
      }
    }
  }
}

Vehicle Ownership Info

Getting the total count of vehicles for a given owner
query GetVehiclesByOwner {
  vehicles(filterBy: {owner: "<0x_address>"}, first: 100) {
    totalCount
  }
}
Getting a Make/Model/Year list for a given owner
query GetVehicleMMYByOwner {
  vehicles(filterBy: {owner: "<0x_Address>"}, first: 100) {
    nodes {
      definition {
        make
        model
        year
      }
    }
  }
}

Vehicle Basic Info

Getting Make/Model/Year & Device Token IDs for a given Vehicle Token ID
{
  vehicle (tokenId: <token_id>) {
    aftermarketDevice {
      tokenId
      address
    }
    syntheticDevice {
      address
      tokenId
    }
    definition {
      make
      model
      year
    }
  }
}

Vehicle Permissions (SACD) Info

Getting permissions shared for a given Vehicle Token ID
query GetSacdForVehicle {
  vehicle (tokenId: 3) {
    sacds (first: 10) {
      nodes {
        permissions
        grantee
        source
        createdAt
        expiresAt
      }
    }
  }
}

Rewards

Getting the Rewards data for a given owner
{
  rewards (user: "<0x_address>") {
    totalTokens
  }
}
Getting the Reward history for a given owner
query GetVehicleDataByOwner {
  vehicles(filterBy: {owner: "<0x_address>"}, first: 10) {
    nodes {
      earnings {
        history (first: 10) {
          edges {
            node {
              week
              aftermarketDeviceTokens
              syntheticDeviceTokens
              sentAt
              beneficiary
              connectionStreak
              streakTokens
            }
          }
        }
        totalTokens
      }
    }
  }
}

Vehicle Device Definitions

Getting the Device Definitions from Tableland
query GetDefinitionByDeviceId {
  deviceDefinition (by: { id: "<id_from_tableland>"})  {
    year
    model
    attributes {
      name
      value
    }
  }
}

Getting a list of Vehicle Token IDs and privileges granted by a given owner
{
  vehicles(filterBy: {owner: "<0x_address>"}, first: 100) {
    nodes {
      tokenId
      privileges(first: 10) {
        nodes {
          setAt
          expiresAt
          id
        }
      }
    }
  }
}
Getting a list of Vehicle Token IDs granted from a given owner to a given developer
{
  vehicles(filterBy: {privileged: "<0x_address>", owner: "<0x_address>"} first: 100) {
    totalCount
    nodes {
      tokenId
      definition {
        make
      }
      aftermarketDevice {
        manufacturer {
          name
        }
      }
    }
  }
}
Getting a list of DCNs attached to the vehicles owned for a given owner
{
  vehicles(filterBy: {owner: "<0x_address>"}, first: 100) {
    nodes {
      dcn {
        node
        name
        vehicle {
          tokenId
        }    
      }
    }
}}

Last updated