<turbo-stream action="update" target="wiki_3611_3666_subpage_3670_info"><template>
<p>Below you see an example on how to delete a group. Examples both in JSON and JSONAPI are provided.

</p><p><strong>Please note:</strong>To be able to determine which group to delete, you need to run 'Get groups' in order to know the ID.</p>
<p>The group id you then place at the end of the url.</p>
<p>NOTE: Remember to substitute the token (after Bearer) and the service id (the "[SERVICE ID]" below) to your own token and service id.</p>
<p>JSON:
</p><pre class="card">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
</pre>
<p>JSONAPI:</p>
<pre class="card">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
</pre>
<p>The output for both JSON and JSONAPI on successful deletion the response code <code>Status: 204 No Content</code> is returned.</p>
<p>For both JSON and JSONAPI the output when your deletion has failed (ex. group as already been deleted) the response code <code>Status: 404 Not Found</code> is returned + an error message</p>
<pre class="card">Status: 404 Not Found

...

{
  "errors":[
      {
        "source": {"pointer":"/data/attributes/id"},
        "detail":"Could not find Group with id 21"
      }
  ]
}
</pre>
<p>The output when your deletion has failed (ex. group is attached to a schedule) the response code <code>Status: 409 Conflict</code> is returned + an error message</p>
<pre class="card">Status: 409 Conflict

...

{
  "errors":[
    {
      "source": {"pointer":"/data/attributes/base"},
      "detail":"This Group is used on a Schedule and cannot be deleted."
    }
  ]
}
</pre>
</template></turbo-stream>
<turbo-stream action="prepend" target="flash"><template></template></turbo-stream>
