A REST API (Representational State Transfer Application Programming Interface) is a set of rules and standards that software programs can use to communicate with each other over the internet. It’s a popular architectural style for designing networked applications, often used for web services.

An operation is idempotent if making the same request multiple times produces the same result as making it just once. In other words, repeating the operation doesn’t change the outcome after the initial successful execution. Only the state of the server is considered, not the response code.

HTTP

https://learn.microsoft.com/en-us/azure/architecture/best-practices/api-design
https://www.restapitutorial.com/httpstatuscodes.html

MethodExampleStatus Code
GET/users/:id200 OK
POST/users201 Created
PUT/task/:nameNew: 201 Create; Exists: 200 OK or 204 No Content
PATCH/user/:id2xx

Examples

New User

POST /users
{
name: “Amar”
}
201 Created
Not idempotent - as new users created every time

Get User

GET /users/:id
Idempotent

Upsert User

PUT /task/:name
201 Create if new,
200 OK or 204 NO CONTENT if exists
Idempotent
Complete representation of a resource

Modify some fields

PATCH /user/:id
{
name: “New name”
}

Idempotent

HEAD, OPTIONS, GET, PUT, DELETE
https://developer.mozilla.org/en-US/docs/Glossary/Idempotent

Cacheable

https://developer.mozilla.org/en-US/docs/Glossary/Cacheable