What are REST APIs

Posted By :Nikita Agarwal |30th April 2019

What is API?

The term API stands for "Application Programming Interface".By the use of API we can access the functionality and service of someone else.For eg we can take Google has an API for gmail and an API for calendar.It is a jawdropping functionality which we can use for using  someoune service.
REST is just a pattern for making APIs. It's just a standard pattern for naming resources that a service provides.


In the Gmail Api example, we can interact with the email drafts.

To do this, Google follows the REST pattern by giving you a url that looks like the below url.

https://www.googleapis.com/gmail/v1/users/userId/drafts

If Want to read a specific draft? We just Send a GET request to the url:

https://www.googleapis.com/gmail/v1/users/userId/drafts/draftId

If you wanted to do all of the the same actions (list, create, read, update, delete) to a different resource, say Gmail Labels?

Well, because they're using the REST pattern for their API, you can easily see the pattern for listing, creating, reading, updating, and deleting Labels. It's just at a different URL:

https://www.googleapis.com/gmail/v1/users/userId/labels

In short "An API is the messenger that takes a request, tells a system what you want to do and then returns the response back to you!"

Features of Rest API

The REST is a architectural style for the design systems like the Web. The main characteristic of REST are four rules of the uniform interface. By definition, REST APIs are APIs that follow these four rules.

=>REST is a way to describe how the architecture of the Web—and other systems like it—is different.

Rule 1:Offer access through resources.
Rule 2: Represent resources by representations.
Rule 3: Exchange self-descriptive messages.
Rule 4: Connect resources through links.

The API those follows these rules are REST APIs

Follow these four rules in your interface, and you have a REST API.

Many a times interfaces that label themselves as “REST” are actually something else (“HTTP interfaces”), because they don't follow all of the rules. Rules 2 and 4 are often violated, but it's not entirely uncommon to see rule 1 being violated as well. For those developers, “REST” simple means “we didn't do the XML messages thing”.

This is why REST interfaces that follow all four rules are now often called “hypermedia APIs”, referring to the fourth rule.

Reference:

https://www.quora.com/What-is-a-REST-API

https://www.restapitutorial.com/

https://www.mulesoft.com/resources/api/restful-api


About Author

Nikita Agarwal

Nikita Agarwal is a front-end developer and have a good knowledge of HTML , CSS ,Javascipt and Bootstrap and Angular

Request For Proposal

[contact-form-7 404 "Not Found"]

Ready to innovate ? Let's get in touch

Chat With Us