Rest API is used for transfer data between frontend and backend, even other fields. With Rest API normally we have 4 constant action & customize action. Rest API also have lifecycle about pre & post of the api invoke.
4 constant action ( Create, Read, Update, Delete )
Normally, we have these actions for modify data.
User API
GET https://api.example.com/users/1
GET https://api.example.com/users
POST https://api.example.com/users
PATCH https://api.example.com/users/1
PUT https://api.example.com/users/1
DELETE https://api.example.com/users/1
2 type customize action ( Instance & Static )
Normally, i call them instance action & static action.
- Instance Action : will invoke for a instance / data.
- Static Action : will invoke for everyone or none of the instance / data.
Lifecycle of API
Lifecycle is useful when u want extend instead of affect handler.
- Pre-Request : will handle about authentication, validation and more.
- Post-Request : will handle about chaining update, create and more.
Internal Access & Routing API
Theses API will always reusable when invoking another API. Most of the framework support route api only, you can customize it to support internal access. Internal Access can improve much performance instead of request the api since required extra of request header, response header. For internal access also easily to maintain if you work with transactional requests.