Common Queries

Here's a list of common queries that developers might find useful:

Getting the total count of vehicles on the DIMO Network
{ 
  vehicles (first:10) {
    totalCount
  }
}
Getting the total count of vehicles for a given owner
{
  vehicles(filterBy: {owner: "<0x_address>"}, first: 100) {
    totalCount
  }
}
Getting a Make/Model/Year list of 10 vehicles for a given owner
{
  vehicles(filterBy: {owner: "<0x_Address>"}, first: 10) {
    nodes {
      definition {
        make
        model
        year
      }
    }
  }
}
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
        }    
      }
    }
}}
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
    }
  }
}
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
      }
    }
  }
}
Getting the Device Definitions from Tableland
query GetDefinitionByDeviceId {
  deviceDefinition (by: { id: "<id_from_tableland>"})  {
    year
    model
    attributes {
      name
      value
    }
  }
}

Last updated