encode / django-rest-framework

Web APIs for Django. 🎸
https://www.django-rest-framework.org
Other
27.83k stars 6.76k forks source link

Request for API documentation #9436

Open SXHRYU opened 3 weeks ago

SXHRYU commented 3 weeks ago

I'd like documentation about format attribute of renderers.

Documentation page doesn't explain what this attribute is for and what values for it are viable. I've found only one usage of this attribute in source code. It will still be great if this parameter's usage is explicitly documented.

browniebroke commented 3 weeks ago

The value comes from here:

https://github.com/encode/django-rest-framework/blob/master/rest_framework%2Fnegotiation.py#L40-L45

So I think it's when you call your endpoint like this:

/v1/users/1.json  # suffix is json
/v1/users/1.xml   # suffix is xml
/v1/users/1?format=xls  # format query param is xls

And so on...

DRF can use this format override to filter suitable renderers, in the piece of code that you found.