Applied to web services
- base URI, such as
- an Internet media type for the data. This is often JSON but can be any other valid Internet media type (e.g., XML, Atom, microformats, images, etc.)
- standard HTTP methods (e.g., GET, PUT, POST, or DELETE)
- hypertext links to reference state
- hypertext links to reference-related resources
The following table shows the HTTP methods that are typically used to implement a RESTful API:
Collection URI, such as
||List the URIs and perhaps other details of the collection's members.||Replace the entire collection with another collection.||Create a new entry in the collection. The new entry's URI is assigned automatically and is usually returned by the operation.||Delete the entire collection.|
Element URI, such as
||Retrieve a representation of the addressed member of the collection, expressed in an appropriate Internet media type.||Replace the addressed member of the collection, or if it does not exist, create it.||Not generally used. Treat the addressed member as a collection in its own right and create a new entry in it.||Delete the addressed member of the collection.|
The PUT and DELETE methods are referred to as idempotent, meaning that the operation will produce the same result no matter how many times it is repeated. The GET method is asafe method (or nullipotent), meaning that calling it produces no side-effects. In other words, retrieving or accessing a record does not change it.
Unlike SOAP-based web services, there is no "official" standard for RESTful web APIs. This is because REST is an architectural style, while SOAP is a protocol. Even though REST is not a standard per se, most RESTful implementations make use of standards such as HTTP, URI, JSON, and XML.