Overview
You are looking for instructions on how to obtain the details of a device such as their custom data or account information using the GraphQL API.
Solution
In order to make the requests through the API, the information below is required. For further details on the API refer to Using the CCAB GraphQL API.
- The Provider ID.
- An Access Token using the credentials from a user with one of the following groups: Account Query, Account Admin, Data Admin
To get the account information, one should use the getDevice operation. For this query, it is necessary to know the ID of the device. This ID is used/returned when the device is first created (see Create a Device using the API for further details).
Below is an example payload using API version 10.1 to obtain most of the device details.
query getDevice {
getDevice(deviceId: "<deviceId>", providerId: "<providerId>") {
... on DeviceNotFound {
deviceId
errorMessage
errorCode
}
... on Device {
id
customData
account {
id
customData
balance {
version
value
}
parent {
id
}
friendsAndFamily
activePlanVersions {
planVersion {
id
createdAt
deployedAt
refCount
deployedBy
}
from
to
}
archivedPlanVersions {
from
to
planVersion {
id
createdAt
deployedAt
refCount
deployedBy
}
}
inactivePlanVersions {
from
to
planVersion {
id
refCount
deployedAt
deployedBy
createdAt
}
}
}
}
}
}
If the requested device is valid, the following information is returned with the response.
On the other hand, if the device is invalid, the response would contain details about the error.