DELETE Users / Devices
This endpoint erases all devices belonging to a given user. Since this is a bulk operation, the total number of devices erased in one call is capped at 10. In addition if some erase operations fail this will be reflected in the return body. The caller may be required to call this endpoint more than once depending on the result (e.g. to erase 13 devices belonging to a user, two calls to this endpoint are required)
Endpoint URL: https://api.carnivalmobile.com/v6/users/:user_id/devices
Parameters
Name | Type | Required | Definition |
---|---|---|---|
user_id | string | The id of the user whose devices you wish to erase |
Examples
Copy
curl -X POST -u :$API_KEY -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/$user_id/devices
Result Format
200 OK
Copy
{
"devices": [
{
"device_id": "5a4f622557ef69***8d54832",
"status": 200
},
{
"device_id": "36515d690fcf49c***302dda",
"status": 200
}
],
"metadata": {
success: 2,
failure: 0,
out_of_range: 0,
total: 2
}
}
Multi-Status
Copy
{
"devices": [
{
"device_id": "5a4f622557ef69***8d54832",
"status": 200
},
{
"device_id": "36515d690fcf49c***302dda",
"status": 404
},
...
{
"device_id": "2e6f2803c54baf5***a13f6b",
"status": 416
}
],
"metadata": {
success: 9,
failure: 1,
out_of_range: 1,
total: 11
}
}
Copy
{
"error":"unauthorized"}
403 Forbidden
Copy
{
"error":"your api client does not have the correct roles"}
422 Unprocessable Entity
Copy
{
"devices": [
{
"device_id": "5a4f622557ef69***8d54832",
"status": 404
},
{
"device_id": "36515d690fcf49c***302dda",
"status": 404
}
],
"metadata": {
success: 0,
failure: 2,
out_of_range: 0,
total: 2
}
}
Output Format
devices
: an array of objects detailing the results of erasing each device belonging to the user. Each device object has the following fields:device_id
: the identifier of the device being erasedstatus
: the result of this erase attempt. 200 for success, 4xx or 5xx for a failure. Failures are generally retryable. 416 status denotes a device outside the capped value of 10.
metadata
: an object consisting of the following totals:success
: the total number of erased devicesfailure
: the total number of failuresout_of_scope
: the number of devices that were not attempted, due to being outside the cap value of 10total
: the number of devices registered to the given user
Return Codes
200
: All devices belonging to the given user were erased207
: There was a mixture of failure and success while erasing devices401
: Unauthorized403
: Forbidden422
: Unable to erase any devices belonging to the given user