1: Your First Step
Activity 1: Sending Requests to Our APIs Using Postman
Solution
- First, we will get all of the recipes. Select
GET
as ourHTTP
method in the drop-down list. - Enter the request URL
http://localhost:5000/recipes
. - Click the Send button. The result can be seen in the following screenshot:
Figure 1.14: Getting all the recipes
In the HTTP response, you will see the HTTP status 200 OK in the top-right corner of the response panel. That means the request has been successful. The time next to it shows 7ms, which is the time spent on the request. And the size of the response, including the header and body, is 322 bytes. The details of the recipes, in JSON format, are shown in the Body panel.
- Next, we are going to use the POST method to create a recipe. We will send an HTTP POST request to
http://localhost:5000/recipes
. - Create a new tab next to the Get Request Tab by clicking on the + button. Select POST as the HTTP method. Type in
http://localhost:5000...