Django Rest Swagger 2.0: How to pass data to POST api so that I can get it as request.POST['key']

1.6k Views Asked by At

I am trying to integrate django-rest-swagger==2.1.1 to existing project which has function based views.

In order to add missing paramaters to function based views, I am using this solution:

Solution by daimon

I specify required parameters in yaml, which shows the field in swagger UI too. Now inside my view request.POST['key'] gives None. But request.body contains the required parameter. How should I modify the swagger settings so that view becomes able to access data with request.POST['key'].

I have already tried solution but it didnt work for me.

1

There are 1 best solutions below

1
On BEST ANSWER

The issue is actually with your parser, you ll have to mention parser classes in your settings.py priority wise, as mentioned by marcgibbon himself here: Click to see