Overview
You are looking for instructions on how to deploy a plan version using the GraphQL API.
Solution
Note: It is recommended to use the Plans UI when Launching/Deploying a Plan version as the process is more user-friendly than using the API.
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 Plan Publisher.
In order to deploy a plan, one should use the deployPlan operation. For this mutation, it is necessary to know the ID of the plan version to be deployed, and one can obtain it following the Get Plan(s) details using the API article.
Important: Only one version of a plan can be deployed at a time so any previously deployed version will be moved to a Suspended state.
Below is an example payload using API version 10.1 with the following specifications.
- The migrateFromVersions parameter is not being used as accounts won't be upgraded to the new version.
- The payload handles the different union types that can be returned from this request.
mutation deployPlan {
deployPlan(
input: {
planVersionId: "<planVersionId>"
providerId: "<providerId>"
}
){
... on PlanVersionPayload {
__typename
planVersion {
id
version
state
deployedAt
deployedBy
priority
plan {
id
name
}
}
}
... on PlanVersionNotFound {
planVersionId
errorCode
errorMessage
}
... on DeploymentVerificationFailed {
planVersionId
errorCode
errorMessage
}
... on MigrationAlreadyInProgress {
planVersionId
errorCode
errorMessage
}
... on PlanVersionWrongTransition {
planVersionId
errorCode
errorMessage
}
}
}
If the plan version is successfully deployed, the response will contain the following data.
On the other hand, if there are problems with the request, the response will contain the error details.