How it works...

What we created here is an API for the music, where you can read a paginated song list, create a new song, and read, change, or delete a single song by ID. Reading is allowed without authentication, but you have to have a user account with the appropriate permissions to add, change, or delete a song. The Django REST framework provides you with web-based API documentation that is shown when you access the API endpoints in a browser via GET. Without logging in, the framework would display something like this:

Here's how you can approach the created API:

URL HTTP Method Description
/rest-api/songs/ GET List songs paginated ...

Get Django 3 Web Development Cookbook - Fourth Edition 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.