Django REST Framework
Django REST Framework extends Django to build web APIs: endpoints that let other apps read or update data by making requests.
What you can build or improve
An API for a mobile app
Share status and documents with authorized users while keeping internal notes private.
Partner integrations
Define what each partner can read or update and what response they receive when data is incomplete.
When we’d choose it
We’d choose it when a Django system needs to share selected data with a mobile app, a separate web interface, or a partner’s system.
Why use it
It provides tools to define which fields are sent, validate incoming fields, and apply permissions. We can keep the rules in one place even when several apps connect.
What to consider
We still need to define which records each user can see or modify and test those permissions. If everything happens on pages served by Django, you may not need a separate API.
Illustrative example
Requests from a mobile app
The app shows a user their own requests. Authorized staff update the status in the internal system without exposing private notes to the app.
Official documentation
Tools and how they fit together
A useful API makes clear what it exchanges, who can use it, and how to verify those rules.
Routes and formats
Routes and formats
Define which fields each operation accepts and returns. A mobile app can receive a request’s status without getting private notes.
- DRF Serializers
- DRF Routers
Identity and record access
Identity and record access
Identify the user, filter lists to what they can access, and check permissions on each requested record.
- DRF Authentication
- DRF Permissions
Testing and documentation
Testing and documentation
Test responses to invalid data and denied access. A schema helps developers integrating the API know what to send.
- DRF APIClient
- OpenAPI
Questions before you decide
Is signing in enough to protect the data?
No. After identifying the person, the API has to check whether they can see or change the record they requested.
How do we keep a change from breaking the mobile app?
Agree on which fields can change, test with the released app, and version breaking changes when needed.
Does the API replace the admin panel?
They do different jobs. The API serves other programs. The admin panel lets authorized staff work directly with records.