Overview
You are looking for instructions on how to create a new account for the provider 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 create an account, one should use the createAccount operation. With this method, one can create a parent or children account, and it requires passing some of the parameters mentioned in CreateAccountInput.
Below is an example payload using API version 10.1 with some relevant points:
- This is a single account so we are not passing a parentAccount value.
- The account value is not being passed so the ID is automatically generated after creation.
- The request is meant to handle the different union types that can be returned from this request (e.g. InvalidField).
mutation createAccount{
createAccount(input: {
providerId: "<providerId>",
friendsAndFamily: ["+19876543210"]
}
) {
... on CreateAccountPayload {
__typename
account {
id
providerId
customData
friendsAndFamily
}
}
... on AccountNotFound {
accountId
errorMessage
errorCode
}
... on AccountAlreadyExists {
accountId
errorMessage
errorCode
}
... on InvalidField {
fieldName
errorMessage
errorCode
}
}
}
If the account is successfully created, the following details are returned.
