Overview
You are looking for instructions on how to delete devices 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 delete a device, use the deleteDevice operation with the appropriate ID for the account (see Create an Account using the API for further details).
Below is an example payload using API version 10.1:
mutation deleteDevice {
deleteDevice(input: {providerId:"<providerId>", accountId:"<accountId>", deviceId:"<deviceId>"}) {
... on DeleteDevicePayload {
deletedDeviceId
account {
id
providerId
}
}
... on DeviceNotFound {
errorMessage
deviceId
errorCode
providerId
}
}
}
If the device was deleted successfully, a confirmation message will be displayed.
Otherwise, the response will contain details about the error that occurred. In the example below, deleting the already deleted device was re-attempted, leading to the API being unable to find the device.