Overview
You are looking for instructions on how to obtain the details of an account such as their balance, plan and active plans 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 the Account/Device User.
To get the account information, one should use the getAccount operation. For this query, it is necessary to know the ID of the account. This ID is used/returned when the account is first created (see Create an Account using the API for further details).
Below is an example payload using API version 10.1 to obtain most of the account details.
query getAccount{
getAccount(accountId: "<accountId>", providerId: "<providerId>") {
... on AccountNotFound {
accountId
errorMessage
errorCode
}
... on 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 account ID is valid, the following details will be returned.
On the other hand, if the account ID is incorrect, the response would be as follows.