1👍
✅
request.POST
is meant to access conventional html form data, and request.body
for all other formats (xml, json, etc.). raw_post_data
is deprecated in newer django versions, it’s successor is request.body
. Also, you would have to deserialize the incoming json data before accessing it even through request.body
, e.g.: json.loads(request.body)
More information can be found about both HttpRequest.body
and HttpRequest.POST
in the official documentation:
https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.body
Source:stackexchange.com