As you may already know, an API is a simplified and direct communication between the developer and your company, safe and easy-to-use. API use methods can cover forms of payment, marketplaces, benefits, communication and traffic between internal systems and various others.
Its approach is essentially based on the following illustrated example:
OK… But what about it?
We have already talked about some good practices in the use of APIs that even addresses good uses and understanding between the developer and its APIs, such as the importance of the correct use of HTTP Status (among various inputs and information that you’ll find in our blog), and today we will talk about API methods.
Although it is a very clear subject to everyone who already knows and uses APIs, people who are more lay on the subject (but who still want to know and learn how to use it) may end up having a bit of a doubt on this issue.
Operations follow HTTP protocol standards for call processing and define the expected action for each of the API use methods.
API use methods:
- Get (Data query/search)
This method allows information/data to be searched according to resource and endpoint entered. You can (and should) also use this method in conjunction with resource filters and paging. Through this method, the backend will return the consulted information.
- Post (Data sending/loading)
Create/run a load of new information to the base. It is necessary to send the information in the JSON standard required in the request body.
- Put and Patch (Data update)
It is used to update or edit the information that already exists in the base. Some APIs contemplate or not the use of Patch (indicated for partial updates), and the use of Put is widely known and the one responsible for changing/updating existing information.
- Delete (Deleting data)
As the name implies, it is the method responsible for deleting information. This is an important point that is only included within the API if, for the business rule, an exclusion of information from the base is necessary (and if it is allowed). Some companies do not allow this use, because it is an action that will erase the particular record definitively.
So, what did you think of the API use methods? Did you already know them?