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

Single request is the same as making multiple request. Only the state of the server is considered, not response code

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

Cacheable

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