Django REST Envelope

April 9, 2023 | Tags: django django-rest-framework

In the list endpoints of a REST API, you usually send a list of objects. However, in the Django REST framework and, in particular, when using viewsets, the list method does return a list. But oftentimes it's very useful to return an object that has a key that contains that list. Why? Because you can send additional data, such as pagination, for example, without having to make breaking changes, among other things.

[Read more]