Skip to main content

Command Palette

Search for a command to run...

REST Api

Published
3 min readView as Markdown

The Overview of REST Api

What is an Api? An API (Applicational programming interface)is plainly a messenger between running software on the client side and server(s). The acronym REST is short for Representational state transfer. REST allows us use HTTP request to format these message. Usually a transfer of representational resources(data) request to a web server(s) and the resource from the server is displayed to the client's browser. The server does not actually send the data in the server but a representation i.e copies in (images,XML, json,soap format).

Architecture style for designing network applications relies on stateless client-server protocol, in most cases HTTP and REST is a way to implement HTTP communication. The primary or most-commonly-used HTTP verbs or methods, as they are properly called are POST, GET, PUT, and DELETE. These correspond to create, read, update, and delete (or CRUD) operations, respectively.

REST API is an Api that conforms to the REST rules. There are six rules or constraints that guides the REST architectural style:

Uniform Interface:This defines the interface between the servers and clients. Individual resources are identified in requests using the URIs as resource identifiers .these resources are separate from the representations that are returned to clients from server. Each message in the resource must include enough information to process the message. Clients also deliver state via body contents, query parameters, services deliver state to clients via body content, this is referred to as Hypermedia as the Engine application state(HATEOAS).

Stateless:This implies the server must not hold any information about the client state, each request must be independent and must be well detailed to enable smooth processing by the server.

Cacheable :clients can cache responses .many clients access the same server, and often requesting the same resources, it is necessary that these responses might be cached, avoiding multiple client - server processing and further increasing performance.

Client - Server: each operates or perform their processes independently. Servers are not concerned with the user interface or user state, so that servers can be simpler and more scalable.

Layered system: A client cannot ordinarily tell whether it is connected directly to the end server, or to an intermediary along the way. Intermediary servers may improve system scalability by enabling load-balancing and by providing shared caches. Layers may also enforce security policies.

Code on Demand (optional): clients are able to temporarily run or allow functionality of a server by transferring logic to execute through scripts . Examples of this may include compiled components such as Java applets and client-side scripts such as JavaScript. It can be used when performing some of the client-side services which are more efficient or faster. The only optional constraint of REST architecture is code on demand. If a service violates any other constraint, it cannot strictly be referred to as RESTful.

26 views
F
Fortune5y ago

This is an interesting read. I enjoyed it👌🏻