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: <dev_license_token_id> } ) {
    owner
    tokenId
    alias
    clientId
    mintedAt
    redirectURIs (first: 10) {
      nodes {
        uri
        enabledAt
      }
    }
  }
}
Getting a list of Vehicle Token IDs granted from to a given Developer License
query GetVehicleByDevLicense {
  vehicles(filterBy: { privileged: "<dev_license_0x>" }, first: 100) {
    nodes {
      owner
      tokenId
      definition {
        make
        model
        year
      }
    }
  }
}

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 and vehicle tokenId list for a given owner
query GetVehicleMMYByOwner {
  vehicles(filterBy: {owner: "<0x_Address>"}, first: 100) {
    nodes {
      tokenId
      definition {
        make
        model
        year
      }
    }
  }
}

Vehicle Basic Info

Getting Make/Model/Year and owner address for a given Vehicle Token ID
query GetVehicleMMYByTokenId {
  vehicle (tokenId: <token_id>) {
    owner
    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
query GetRewardsByOwner {
  rewards (user: "<0x_address>") {
    totalTokens
  }
}
Getting the Reward history for a given owner
query GetRewardHistoryByOwner {
  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
    }
  }
}

Some Old Queries

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