A 'RESTful API' is an architectural style for an application program interface (API) that uses 'HTTP requests' to access and use data.
That data can be used to 'GET', 'PUT', 'POST' and 'DELETE' data types, which refers to the 'reading', 'updating', 'creating' and 'deleting' of operations concerning resources.
An API for a website is code that allows two software programs to communicate with each other.
The API spells out the proper way for a developer to write a program requesting services from an operating system or other application.
A RESTful API -- also referred to as a RESTful web service or REST API -- is based on representational state transfer (REST), which is an architectural style and approach to communications often used in web services development.
REST technology is generally preferred over other similar technologies. This tends to be the case because REST uses less bandwidth, making it more suitable for efficient internet usage.
RESTful APIs can also be built with programming languages such as JavaScript or Python.
A RESTful API breaks down a transaction to create a series of small modules.
Each module addresses an underlying part of the transaction. This modularity provides developers with a lot of flexibility, but it can be challenging for developers to design their REST API from scratch.
Currently, several companies provide models for developers to use; the models provided by Amazon S3, Cloud Data Management Interface (CDMI) and OpenStack Swift are the most popular.
A RESTful API uses commands to obtain resources. The state of a resource at any given timestamp is called a resource representation. A RESTful API uses existing HTTP methodologies defined by the RFC 2616 protocol, such as:
-
GETto retrieve a resource; -
PUTto change the state of or update a resource, which can be an object, file or block; -
POSTto create that resource; and -
DELETEto remove it.
With REST, networked components are a resource the user requests access to -- like a black box whose implementation details are unclear. All calls are stateless; nothing can be retained by the RESTful service between executions.
Data formats the REST API supports include:
-
application/json
-
application/xml
-
application/x-wbe+xml
-
application/x-www-form-urlencoded
-
multipart/form-data