Overview
You are looking for instructions on how to obtain the details of one or multiple Plans using the GraphQL API.
Solution
Note: Most of the plan information available through the API can also be found in the Plans UI.
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 Config/Plan User.
To query the API for the plan information we can use the following operations:
getPlans - This operation will return a list of all plans available for the providers with pagination.
Note that the specific details returned as well as the number of items would depend on the query and its parameters. See the example below where the query is also including information on the plan versions. One can further build on this query and use additional fields.
query getPlans{
getPlans(providerId: "<providerId>", first:10) {
edges {
node{
id
name
versions (first:10){
edges{
node{
id
version
}
}
}
}
}
}
}
The result is a list of plans and versions with one node per plan as shown below.
getPlan - This operation returns the information for a specific plan. This one can be used you know the PlanID and only require information from a specific plan.
Note that the specific details returned would depend on the query and its parameters. See the example below that is similar to the one above also queries the version state.
query getPlan{
getPlan(providerId: "<providerId>", planId: "<planId>"){
... on Plan{
id
name
versions (first:10){
edges{
node{
id
version
state
}
}
}
}
... on PlanNotFound{
planId
errorCode
errorMessage
}
}
}
The result (if the planID exists) is the plan information along with its versions as shown below.