Browsing the API with resources and relationships

We will take advantage of the browsable API feature that we introduced in Chapter 5, Understanding and Customizing the Browsable API Feature, with our new web service. Let's start browsing our new RESTful Web Service. Open a web browser and enter http://localhost:8000. The browser will compose and send a GET request to / with text/html as the desired content type, and the returned HTML web page will be rendered.

The request will end up executing the GET method defined in the ApiRoot class within the views.py file. The following screenshot shows the rendered web page with the resource description Api Root:

The Api Root renders the following hyperlinks:

  • http://localhost:8000/drone-categories/ ...

Get Django RESTful Web Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.