Django Rest Envelope

Published on 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.


For this reason, I created Django REST Envelop which implements a DRF mixin to solve this very problem.
Check out the repo https://github.com/mrswats/django-rest-envelope for an example and on how to implement this feature in your Django APIs.


Ferran Jovell