There’s a high possibility you ran over the expression “REST API” on the off chance that you’ve contemplated getting information from another source on the web, for example, Instagram Twitter or Github. In any case, what is a REST API? What would it be able to accomplish for you? How would you use it?
In this article, you’ll pick up all that you have to think about REST APIs to have the option to peruse API documentation and use them successfully.
Suppose you’re attempting to discover videos about Iron Man on Youtube. You open up Youtube, type “Iron Man” into a search field, hit enter, and you see a rundown of videos about Iron Man. A REST API works along these lines. You look for something, and you recover a rundown of results from the administration you’re mentioning from.
An API is an Application Programming Interface. It is a lot of decides that permit projects converse with one another. The engineer makes the API on the server and permits the customer to converse with it.
REST decides how the API resembles. It means “Representational State Transfer”. It is a lot of decides that engineers follow when they make their API. One of these guidelines expresses that you ought to have the option to get a bit of information (called a resource) when you connect to a particular URL.
Every URL is known as a request while the information sent back to you is known as a response.
The Structure Of A Request
It’s important to know that a request is made up of four things:
- The endpoint
- The method
- The headers
- The data (or body)
The endpoint (or route) is the url you request for. It follows this structure:
The root-endpoint is the starting point of the API you’re requesting from. The root-endpoint of Github’s API is
https://api.github.com while the root-endpoint Twitter’s API is
https://api.twitter.com and the root-endpoint Instagrams’ API is
The path determines the resource you’re requesting. Think of it like an automatic answering machine that asks you to press 1 for service, press 2 for another service, 3 for yet another service, and so on.