An API, or Application Program Interface, is an interface provided by a software program that enables other programs (called "clients") to communicate with it. An API generally consists of a specific set of operations or requests that have been implemented on the host program, and which can be invoked by client programs without any knowledge of, or access to, the details of that implementation.
A REST API, such as the MIP Advance API, is usually implemented as a set of web URIs that have been configured to accept operation invocations in the form of HTTP requests, and to return the results as HTTP responses.
CRUD is an acronym representing the four basic types of data functions: Create, Read, Update, and Delete. A rough mapping of these functions to HTTP request types is as follows:
- Create: POST
- Read: GET
- Update: PUT
- Delete: DELETE
HTTP, or HyperText Transfer Protocol, is the standard protocol for transferring data between web servers and clients on the World Wide Web. HTTP communications take the form of requests from clients and corresponding responses from servers. For example, when you type a URL such as http://www.abila.com into a web browser, the browser issues an HTTP request to the web server at www.abila.com. The resulting response is used by the browser to render the web page.
JSON, or JavaScript Object Notation, is a simple and human-readable alternative to XML for representing data objects. A JSON object is simply a comma-separated list of attributes with their values, enclosed in curly braces. For example:
var myPet = { "type" : "dog", "name": "Spike", "breed": "beagle", "age": "9" }
In HTTP, a request is a message sent by a client program to a web server in order to retrieve information or perform another operation. Each request includes:
- A verb (for example, GET, POST, PUT, or DELETE)
- A set of header fields
- The URI to which the request is directed
- Any relevant parameters
Depending on their type and the type of the request, parameters may be sent as part of the URI or separately in the request message body.
In HTTP, a response is a message sent by a web server to a client program in response to a request. Each response includes:
- A status line, including the status code for the request
- A set of header fields
- An optional message body
If the requested operation produces output other than a status code, it is included in the response message body.
REST, or REpresentational State Transfer, is an architectural style for web services. It is designed to simplify communications between components of a distributed system. Two of its most important characteristics are:
- Statelessness—servers do not maintain session information about clients; each message from a given client contains all the context necessary to perform the corresponding operations
- Client-server architecture—the web service that provides data resources and the clients that consume them are decoupled: they exist independently and communicate through messages.
Although the architecture specification itself does not say that HTTP must be used for a RESTful service, a combination of URI resources ("endpoints") and HTTP request/responses is the standard implementation for REST-based APIs.
An HTTP status code is a three-digit numerical code that indicates the success or failure of an HTTP request. It is returned as part of the status line of the corresponding response. The first digit of the status code gives the general category of the status as follows:
- 1xx: Informational
- 2xx: Success
- 3xx: Redirection (further action required)
- 4xx: Client error
- 5xx: Server error