API REST
Introduction
Teacher’s definition:
REST is an architecture style for building web services. It is based on a client-server model, where a client sends a
request
to a server and the server sends aresponse
.RESTful APIs use HTTP requests to POST (create), PUT (update), GET (read) and DELETE (delete) data.
A RESTful API is a simple, consistent, and easy-to-use way for applications to communicate with each other over the internet.
What exactly is a REST API?
It is the common language between a client and a server, so the client knows what operations are available in the server. Common REST API operations
- POST (Create)
- GET (Read)
- PUT (Update)
- DELETE (Delete)
So the base operations are the classic CRUD, but can be expanded. In fact, it is a set of definitions and protocols, sometimes referred to as a contract between an information provider and an Information user.
This contract (API Rest style) establishing the content required from the consumer (the call) and the content required by the producer (the response).
The API design for a weather service could ask the user for a zip code as a request
and then return a response
in the form of a 2-part answer, being the first one the high temperature and the second one the low temperature.
What should we take into account when creating a Rest API
Pending to elaborate!
Debugging tools
Postman
According to the official page:
Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
Postman allows the following:
- Create collections of REST requests
- Create APIs that query against other datasources (?)
- Create Mock Servers to test your APIs
- Create Monitor to observe your system
- Create Flows to automate processes
Environments
Create environment variables when they are used across all collections or when they have sensitive data (secret)