In the REST APIs communication between the client and the server is easy. The server acts as a data store, and the client retrieves and stores data. This is the main difference between the REST API and the SOAP API.
A single uniform interface of REST API defines an interface between client and server and simplifies the architecture so that its services can be managed independently.
REST is resource-based, and resources are identified by URI.
REST API Request Parts
- An Endpoint URL with a domain, port, path, and/or querystring.
- The HTTP method to implement CRUD (create, read, update, and delete ) operations.
- HTTP headers containing information such as authentication tokens or cookies.
- Body Data: JSON string with data.
REST API Example
The response payload can be an image, an audio file, and so on. Data responses are typically JSON-strings.
REST doesn’t have a standard messaging system; response depends on the way the request is formulated; in case of failure REST handles messaging errors by retrying.
REST has layered system with an opportunity for each component to interact only within the immediate layer. The data are labeled implicitly or explicitly as cacheable or non-cacheable.