A Quick Guide on Rest API
Hello, Flocks👋, This guide will help you to get a basic idea of working with the Rest API.
What is Rest API?
Whether you are a front-end developer or back-end developer, you need to know about the Rest API(s).
Representational State Transfer (REST) API(s) is a way to make communication between the front-end and the back-end of the application.
Rest API(s) communicate through HTTP requests to perform CURD (Create, Read, Update, Delete) operations in a resource.
The Rest API(s) allows you to create, read, update, and delete data from the database or resource using the backend server.
How It Works?
When a client request is made via a RESTful API, it transfers a representation of the state of the resource to the requester or endpoint.
This information, or representation, is delivered in one of the several formats via HTTP: JSON(Javascript Object Notation), HTML, XLT, Python, PHP, or Plain text. JSON is the most generally popular file format to use because, despite its name, it’s language-agnostic, as well as readable by both humans and machines.
Data Format Supported
- application/JSON
- application/xml
- application/x-wbe+xml
- application/x-www-form-urlencoded
- application/form-data
Example:
If you make a visit to the following link:
https://api.github.com/users/akashkothari98
You will get a JSON Response:
{ "login": "akashkothari98", "id": 38093413, "node_id": "MDQ6VXNlcjM4MDkzNDEz", "avatar_url": "https://avatars.githubusercontent.com/u/38093413?v=4", "gravatar_id": "", "url": "https://api.github.com/users/akashkothari98", "html_url": "https://github.com/akashkothari98", "followers_url": "https://api.github.com/users/akashkothari98/followers", "following_url": "https://api.github.com/users/akashkothari98/following{/other_user}", "gists_url": "https://api.github.com/users/akashkothari98/gists{/gist_id}", "starred_url": "https://api.github.com/users/akashkothari98/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/akashkothari98/subscriptions", "organizations_url": "https://api.github.com/users/akashkothari98/orgs", "repos_url": "https://api.github.com/users/akashkothari98/repos", "events_url": "https://api.github.com/users/akashkothari98/events{/privacy}", "received_events_url": "https://api.github.com/users/akashkothari98/received_events", "type": "User", "site_admin": false, "name": "Aakash Kothari", "company": null, "blog": "https://akashkothari.me", "location": "Rajkot,Gujarat", "email": null, "hireable": null, "bio": null, "twitter_username": "aakashkothari4", "public_repos": 2, "public_gists": 0, "followers": 0, "following": 0, "created_at": "2018-04-05T04:41:49Z", "updated_at": "2022-11-05T05:09:25Z" }
Here’s what happened:
- you typed the URL.
- The front end makes a request.
- The Backend parses the request based on the data received from the front end.
- The Backend returns the JSON data.
♥️ If you find it useful, please express your appreciation by giving it a like! (P.S. -It won’t cost anything don’t worry just go for it 😉)
✍️ Feel free to comment with your thoughts and queries (Trust me it motivates me a lot 💎)
📥 Don’t forget to Bookmark it for later use (Or else you’ll miss it 🥲)
📲 Also share it with your friends and colleagues out there (Let’s help each other grow 👊🏻)
Do Follow Us on:
Also Read: Arrow Functions in JavaScript
I am passionate about my work. Because I love what I do, I have a steady source of motivation that drives me to do my best. In my last job, this passion led me to challenge myself daily and learn new skills that helped me to do better work
[…] Also Read: Rest API : A Quick Guide […]