Conteúdo do Curso
Professional Web API with Flask
Professional Web API with Flask
Postman and Insomnia
Firstly, in the preceding chapter, we initiated a relaunch of our project due to the integration of changes and the introduction of new endpoints. To automate this relaunch process, we plan to incorporate a series of script lines into a newly created '.flaskenv' file located at the project's root.
Before diving into the specifics of JSON, let's acquaint ourselves with Postman and Insomnia, two pivotal tools for API development and testing.
Postman
Postman stands out as an essential platform for developers working with APIs. This tool, known for its interactive and automated capabilities, simplifies the process of testing API services. Catering to a wide range of users, from individual developers to extensive teams, Postman provides a user-friendly interface that enables the sending of requests to web servers and the inspection of responses. Its features include:
- The creation and sharing of request collections among team members;
- A built-in suite for automated testing, allowing for the execution of complex request sequences;
- Tools for the easy generation and dissemination of API documentation.
To integrate Postman into our project, follow these steps:
- Sign up for a free account.
- Download the Desktop Agent.
Experiment with sending your first GET request through Postman. Enter your URL (in my case http://127.0.0.1:5000/clubs
) and hit Send. By default, the GET method is selected. You should expect to receive a response with the status '200 OK'. Save this request under the name 'clubs' within the 'fc_manager_api' collection, for instance.
To initiate a new request, click on the plus sign to open a new tab where you can save additional requests. Given that our app currently has only one defined endpoint, attempting to access other endpoints or methods will likely result in errors (404).
Acquiring proficiency in Postman will not only enhance your skill set but also serve as a valuable addition to your resume.
Insomnia
Insomnia is another tool offering functionality and an interface akin to Postman's, tailored for desktop use. It provides excellent options for quick API testing, requiring minimal setup, making it ideal for those new to the field.
Our focus will be on mastering these tools, given their collaborative features and suitability for both large and small projects.
Note
Dive into the world of HTTP requests and responses with this insightful article. Just remember, keep your learning journey focused and on track! 😉
Obrigado pelo seu feedback!