Making HTTP POST requests with Postman
Now, we will use the Builder
tab in Postman to compose and send an HTTP POST request to create a new toy. Perform the following steps:
- Click on the plus (+) button on the right-hand side of the tab that displayed the previous request. This way, you will create a new tab.
- Select
Request
in the New drop-down menu located in the upper-left corner. - Select
POST
in the drop-down menu on the left-hand side of theEnter request URL
textbox.
- Enter
localhost:8000/toys/
in that textbox on the right-hand side of the drop-down menu. - Click
Body
on the right-hand side ofAuthorization
andHeaders
, within the panel that composes the request. - Activate the
raw
radio button and selectJSON (application/json)
in the drop-down menu on the right-hand side of thebinary
radio button. Postman will automatically add aContent-type = application/json
header, and therefore, you will notice theHeaders
tab will be renamed toHeaders (1)
, indicating to us that there is one key-value...