Delivery Options uses a REST (REpresentational State Transfer) API, which means that, for CRUD (Create, Retrieve, Update and Delete) operations, it uses
HTTPS (HyperText Transfer Protocol Secure).
The methods that can be used in REST APIs are
PUT (Update - Full),
PATCH (Update - Partial), and
DELETE. However, the Delivery Options API just uses the
GET method as it only needs to retrieve information, not post any updates. For this reason, it is very safe to use.
JSON is a convenient format to represent REST resources because it is human-readable, easily compressed, and supported by all modern programming languages. In addition, it is fairly easy to understand because it only has a few data types (
The HTTPS protocol
Because REST APIs communicate using
HTTPS, all Delivery Options API calls must incorporate the base URL:
HTTPS uses TLS (Transport Layer Security) to encrypt request and response data, and so, in addition to
HTTPS, Delivery Options requires
TLS v1.1 or higher.
Requests and Responses
To call a REST API, you need to send a request to the server, incorporating all the information required to tell the server what you want it to do. This must include the following:
HTTPSmethod, or verb (in this case,
The URL, ending in /
find(as shown above).
The request, or query, parameters, inclusive of the API key.
The combination of
HTTPS method and URL is often referred to as an 'endpoint'.
When the server has finished performing the call, it sends a response back to you, letting you know whether or not the operation was successful (refer to What are the possible Server Responses?). In the event of a successful call, the response includes, in the
Body section, the data (in this case, the delivery options) that you requested. The
Headers section contains metadata about the response.