REST APIs
VERBS/Methods
- GET
- POST
- PUT
- DELETE
- PATCH
Status Codes
- This a 3 digit number between
100-599 - Status code categories
- Information
1xx - Success
2xx - Redirection
3xx - Client Side errors
4xx - Server side errors
5xx
- Information
HTTP Headers
- These are key value pairs
REST Design philosopy
- Verbs and Nouns
- Lets think of IRCTC
- Nouns:
- User
- Employee
- Train
- Station
- Berth
- Food
- Verb:
- User:
- Create => POST
- Update => PUT/PATCH
- Delete => DELETE
- Get => GET
- User:
- Nouns:
-
URI: Uniform Resource Identifier
- Get all users (GET)
- URI =>
/v1/users
- URI =>
- Get the specific user with id 1 (GET)
- URI =>
/v1/users/1
- URI =>
- Create a user (POST)
- URI =>
/v1/users - userinfo =>
some json schema
- URI =>
- Update the user with id 1: (PUT)
- URI =>
/v1/users/1 - full or partial user info.
- URI =>
- Get all users (GET)
-
Once we create an API to be used by customers we need to document apis, that is where openapi format and swagger are widely popular Refer Here
