Sitemap

What is REST API (Part 2)

2 min readNov 17, 2022
Press enter or click to view image in full size

What is Rest API? ( Part 2 )
Prerequisites
To understand the content of this post, we need to have a general idea of an API.
You can refer to this other post on my profile that will give you a quick idea of what an API is. Here is the link

Rest API == API?
Rest API is an API that follows a set of rules known as Rest.
An example of this is Stripe or Google Maps API.

HTTP Methods
We talked about CRUD operations in the previous post.

In Rest API, every operation has a specific HTTP Method giving an idea of what to do with the data, these methods are the following:

POST — Create
GET — Read
PUT — Update
DELETE — Delete

Press enter or click to view image in full size

Status Codes
Every time a response is heard as a result of an API call, it has a number known as Status Code.

These status codes range between 100–599, with every status code having a message.

For example, a status code of 200 means the response was a success.

1xx — Information response
2xx — Success
3xx — Redirection
4xx — Client errors
5xx — Server errors

Press enter or click to view image in full size

URI
Every API has a dedicated URI (Uniform Resource Identifier), also known as an endpoint. In the case of Rest API, the standard is not to use a verb.
Here is an example of two endpoints, both getting a list of all users.

https://website.com/api/users (✔)
https://website.com/api/getallusers (✖)

The second endpoint violates the standard because of the usage of verbs.

Press enter or click to view image in full size

If you want any help with getting started with coding or with a career in Development. Just ping me I would love to help and guide you.
Just message me at Instagram or codeculturepro@gmail.com

--

--

Tasadduq Ali
Tasadduq Ali

Written by Tasadduq Ali

I am MERN Stack developer working in UAE Govt to digitize their massive services. I will help you to become highly skilled Coder 😉