Skip to main content

Queries

Root query operations for cloud event indexes and full cloud events.

Overview

The Fetch API exposes four root queries:

  • latestIndex – The most recent cloud event index matching optional filters.
  • indexes – A list of cloud event indexes (header + indexKey) matching optional filters.
  • latestCloudEvent – The most recent full cloud event (header + optional data).
  • cloudEvents – A list of full cloud events matching optional filters.

All queries require a vehicle identifier as did (ERC721 DID, e.g. did:eth:1:0xContractAddress:tokenId). List queries accept an optional limit (default 10) and filter (CloudEventFilter).

latestIndex

Returns the latest cloud event index (header + indexKey) that matches the given filter. Use this when you only need the index entry, not the full payload.

Arguments

didString!Required
ERC721 DID of the vehicle (e.g. did:eth:1:0x...:tokenId).
filterCloudEventFilterOptional
Optional filter by id, type, source, producer, before, after.
query GetLatestIndex {
latestIndex(
did: "did:eth:1:0x...:123456",
filter: { type: "dimo.status" }
) {
header { id type time source producer }
indexKey
}
}

indexes

Returns a list of cloud event indexes matching the filter. Each item includes header and indexKey.

Arguments

didString!Required
ERC721 DID of the vehicle.
limitIntOptional
Maximum number of results (default: 10).
filterCloudEventFilterOptional
Optional filter by id, type, source, producer, before, after.
query ListIndexes {
indexes(
did: "did:eth:1:0x...:123456",
limit: 10,
filter: { type: "dimo.status", after: "2024-06-01T00:00:00Z" }
) {
header { id type time }
indexKey
}
}

latestCloudEvent

Returns the most recent full cloud event (header and optionally data / dataBase64) that matches the filter.

Arguments

didString!Required
ERC721 DID of the vehicle.
filterCloudEventFilterOptional
Optional filter by id, type, source, producer, before, after.
query GetLatestCloudEvent {
latestCloudEvent(
did: "did:eth:1:0x...:123456",
filter: { type: "dimo.status" }
) {
header { id type time source producer }
data
}
}

cloudEvents

Returns a list of full cloud events matching the filter. Request only the fields you need (header, data, dataBase64).

Arguments

didString!Required
ERC721 DID of the vehicle.
limitIntOptional
Maximum number of results (default: 10).
filterCloudEventFilterOptional
Optional filter by id, type, source, producer, before, after.
query ListCloudEvents {
cloudEvents(
did: "did:eth:1:0x...:123456",
limit: 5,
filter: { type: "dimo.status" }
) {
header { id type time }
data
}
}

Example: cURL

Send a POST request with your query and Vehicle JWT:

curl -X POST "https://fetch-api.dimo.zone/query" \\
-H "Authorization: Bearer <VEHICLE_JWT>" \\
-H "Content-Type: application/json" \\
-d '{"query":"query { latestCloudEvent(did: \"did:eth:1:0x...:123456\", filter: { type: \"dimo.status\" }) { header { id type time } data } }"}'