Django REST database query data

I am using the Django REST framework to write my level of web service in which I want to read the request payload from the request (POST). I tried the following code, but I get an empty set

@api_view(['POST'])
def login(request):
    print request.POST

The content type is JSON. I tried to transfer data from the REST Client Tool. However, I can read the values ​​of the headers, but only the payload does not come out.

+4
source share
1 answer

You can use request.DATAinstead request.POSTto get json data.

request.DATADeprecated in favor of request.DATAversion 3.0 and completely removed from version 3.2.

+7
source

All Articles