Unnderstanding REST APIs
NOTE: The API is the messenger and then REST helps us to use the HTTP request to format that message.
REST APIs takes in multiple types of HTTP request.
TYPES OF HTTP REQUESTS
GET: Retrievs data from a specified resource
POST: this is usually used to submit data to be processed to a specific resource. i.e to add a post to a database or to add a user account.
PUT: This is used to update a specific ressource already on the server.
DELETE: This is ofcourse used to delete a specified resource on the server.
other types of HTTP Requests
HEAD: Same as 'GET' but does not return a body
OPTION: Returns the supported HTTP methods of a specific server or API
PATCH: Update partial resources. It is similar to 'PUT'
When using some APIs [self created or external] you are going to have something called 'ENDpoints'.
// this serves as comments
GET someurl.com/api/users // Get all users
GET someurl.com/api/users/1 // Get single users
POST someurl.com/api/users // Add users
PUT someurl.com/api/users/1 // Update user
DELETE someurl.com/api/users/1 // Delete user
NOTE: It's completely up to the APIs how they want to format the URLs and the number '1' is an id passed unto the url. It's not conistant but varies.
Credits: Brad Traversy aka Traversy Media.