HTTP Call Type Definitions
HTTP is designed to enable communication between clients and servers, and works as a request-response protocol between a client and server. Common call types used with the BarTender Cloud API are listed below.
In the following examples, {baseURL} refers to https://[OrgName].am1.bartendercloud.com/.
Used to retrieve a representation of a resource, Requests using GET should only be used to request data and should not contain a body.
You can alter the semantics of GET request to be a "range request", requesting to transfer only some part(s) of the selected representation, by sending a Range header field in the request.
Syntax
GET https://{baseURL}/[api]/[endpoint]?[query parameters]
The [query parameters] are an optional query component preceded by a question-mark. This is often used to carry identifying information in the form of key=value pairs.
Example
The query string (i.e., name/value pairs) is sent in the URL of a GET request, defining the data you want to retrieve. For example:
GET https://{baseURL}/[api]/demo_form.php?name1=value1&name2=value2
Used to send data to a server to create/update a resource. Requests using and responses to PATCH must contain a body. The type of the body of the request is indicated by the Content-Type header.
HTML forms typically send data using POST and this usually results in a change on the server. For HTML forms the format/encoding of the body content is determined by the enctype attribute of the <form> element or the formenctype attribute of the <input> or <button> elements.
When the POST request is sent for any reason other than an HTML form, the body can be any type.
Syntax
POST https://{baseURL}/[api]/[endpoint]?[query parameters]
{baseURL}, [api], and [endoint] are collectively the request's target. The [query parameters] are an optional query component preceded by a question-mark. This is often used to carry identifying information in the form of key=value pairs.
Example
The data sent to the server with POST is stored in the request body of the HTTP request. For example:
|
POST /q3/demo_form.php HTTP/1.1 Host: bartendercloud.com Content-Type: application/x-www-form-urlencoded Content-Length: 100
name1=value1&name2=value2 |
Used to apply partial modifications to a resource. This function may be limited to authorized users. Requests using PATCH must contain a body, though responses may not.
|
|
A PATCH serves as a set of instructions for modifying a resource, whereas a PUT represents a complete replacement of the resource. |
Syntax
PATCH https://{baseURL}/[api]/[endpoint]?[query parameters]
{baseURL}, [api], and [endoint] are collectively the request's target. The [query parameters] are an optional query component preceded by a question-mark?. This is often used to carry identifying information in the form of key=value pairs.
Example
This is an example of a PATCH request using a patch document on an existing resource.
|
PATCH /file.txt HTTP/1.1 Host: bartendercloud.com Content-Type: text/plain If-Match: "e0023aa4e" Content-Length: 100
[description of changes] |
This is a response example for a successful PATCH request to update the status field.
|
PATCH /users/123 HTTP/1.1 Host: bartendercloud.com Content-Type: application/json Content-Length: 27 Authorization: Bearer ABC123 { "status": "suspended" } |
Using the BarTender Cloud REST API