Django REST Framework (DRF) is a feature-rich Django library for building web APIs. It uses classes instead of simple functions, with methods for GET, POST, and other HTTP actions. Its broader control comes with more code than newer alternatives such as Django Ninja. section 11.3
A typical DRF API combines:
- Class-based handlers that correspond to HTTP actions. section 11.3
- Serialization classes for converting application or Django ORM objects into API data. section 11.3
- Authentication mechanisms supplied by the framework. section 11.3
- Renderer classes that control response formats and also power the interactive web interface. section 11.3
Beyond JSON
A DRF endpoint can switch response output from JSON to XML through configuration, or export YAML generated from nested serializers. Its renderer ecosystem also includes HTML forms, Django templates, and third-party formats such as CSV and Excel. section 11.3
