Making HTTP POST requests with the browsable API
Now, we want to use the browsable API to compose and send an HTTP POST request to our RESTful Web Service to create a new toy. Go to the following URL in your web browser, http://localhost:8000/toys/
. At the bottom of the rendered web page, the browsable API displays the following controls to allow us to compose and send a POST
request to /toys/
:
Media type
: This dropdown allows us to select the desired parser. The list will be generated based on the configured supported parsers in the Django REST framework for our web service.Content
: This text area allows us to enter the text for the body that will be sent with the POST request. The content must be compatible with the selected value for the media type dropdown.POST
: This button will use the selected media type and the entered content to compose and send an HTTP POST request with the appropriate header key/value pairs and content.
The following screenshot shows the previously explained controls...