<turbo-stream action="update" target="wiki_3611_subpage_3636_info"><template>
<p>The base URL of the API is https://api.myrapidi.com/api/v2</p>
<p>All GET, POST, PUT, PATCH and DELETE requests are <a href="http://en.wikipedia.org/wiki/JSON">JSON</a> or <a href="http://www.jsonapi.org" title="JSON API">JSON API</a>encoded and must have content type of application/json or application/vnd.api+json respectively, or the API will return a 415 Unsupported Media Type status code.</p>
<p>In the HTTP Header you must set "Accept" for all requests and you must set "Content-Type" for POST, PUT and PATCH request (all requests that include json data). See the example below. </p>
<h4>JSON Bodies</h4>
<pre class="card">curl 
  -H "Authorization: Bearer [API SECURITY TOKEN]"
  -H "Content-Type: application/json"
  -H "Accept: application/json"
   -X PATCH 
  -d "{\"code\":\"INVOICE\",\"description\":\"Invoice Transfers\"}"
  https://api.myrapidi.com/api/v2/service/[SERVICE ID]/groups/[GROUP ID]
</pre>
<p>The out-put for this example would be:</p>
<pre class="card">{
  "code": "INVOICE",
  "description": "Invoice Transfers",
  "comments":
}</pre>
<h4>JSON API Bodies</h4>
<pre class="card">curl 
  -H "Authorization: Bearer [API SECURITY TOKEN]"
  -H "Content-Type: application/vnd.api+json" 
  -H "Accept: application/vnd.api+json"
  -X PATCH
  -d "{\"data\":{\"id\":\"5\",\"type\":\"groups\",\"attributes\":{\"code\":\"INVOICE\",\"description\":\"Invoice Transfers\"} }}"
  https://api.myrapidi.com/api/v2/service/[SERVICE ID]/groups/[GROUP ID]
</pre>
<p>The out-put for this example would be:</p>
<pre class="card">{
  "data":{
    "id":"5"
    "type":"groups",
    "attributes":{
      "code": "INVOICE",
      "description": "Invoice Transfers"
    },
    "relationships":{
      "comments": {
        "data": [
        ]
    }
  }
}</pre>
<h4>HTTP Verbs</h4>
<p>We use standard HTTP verbs to indicate the intent of a request:</p>
<ul>
<li>GET - To retrieve a resource or a collection of resources</li>
<li>POST - To create a resource</li>
<li>PATCH - To modify a resource</li>
<li>PUT - To update a resource (all fields) - in general, you should use PATCH rather than PUT !</li>
<li>DELETE - To delete a resource</li>
</ul>
<h4>Limited HTTP Clients</h4>
<p>If you are using an HTTP client that doesn't support PUT, PATCH, or DELETE requests, send a POST request with an X-HTTP-Method-Override header specifying the desired verb.</p>

<h4>Example in JSON</h4>
<pre class="card">curl 
  -H Authorization: Bearer [API SECURITY TOKEN]
  -H "Content-Type: application/json" 
  -H "Accept: application/json"
  -X POST
  -H "X-HTTP-Method-Override: DELETE"
  https://api.myrapidi.com/api/v2/service/[SERVICE ID]/groups/[GROUP ID]</pre>
<h4> Example in JSON APi</h4>
<pre class="card">curl 
  -H Authorization: Bearer [API SECURITY TOKEN]
  -H "Content-Type: application/vnd.api+json"
  -H "Accept: application/vnd.api+json"
  -X POST
  -H "X-HTTP-Method-Override: DELETE"
  https://api.myrapidi.com/api/v2/service/[SERVICE ID]/groups/[GROUP ID]</pre>
</template></turbo-stream>
<turbo-stream action="prepend" target="flash"><template></template></turbo-stream>
