Below you see an example on how to delete a group. Examples both in JSON and JSONAPI are provided.
Please note:To be able to determine which group to delete, you need to run 'Get groups' in order to know the ID.
The group id you then place at the end of the url.
NOTE: Remember to substitute the token (after Bearer) and the service id (the "[SERVICE ID]" below) to your own token and service id.
JSON:
curl -H "Authorization: Bearer [API SECURITY TOKEN]" -H "Content-Type: application/json" -H "Accept: application/json" -X DELETE https://api.myrapidi.com/api/v2/service/[SERVICE ID]/groups/21
JSONAPI:
curl -H "Authorization: Bearer [API SECURITY TOKEN]" -H "Content-Type: application/vnd.api+json" -H "Accept: application/vnd.api+json" -X DELETE https://api.myrapidi.com/api/v2/service/[SERVICE ID]/groups/21
The output for both JSON and JSONAPI on successful deletion the response code Status: 204 No Content
is returned.
For both JSON and JSONAPI the output when your deletion has failed (ex. group as already been deleted) the response code Status: 404 Not Found
is returned + an error message
Status: 404 Not Found ... { "errors":[ { "source": {"pointer":"/data/attributes/id"}, "detail":"Could not find Group with id 21" } ] }
The output when your deletion has failed (ex. group is attached to a schedule) the response code Status: 409 Conflict
is returned + an error message
Status: 409 Conflict ... { "errors":[ { "source": {"pointer":"/data/attributes/base"}, "detail":"This Group is used on a Schedule and cannot be deleted." } ] }