Get Json Data From Post In Django With Rest Framework
I am attempting to build a REST API in Django for a Google Spreadsheet with Gspread, I'm running into a lot of issues (so if anyone happens to have a full example lying around, fee
Solution 1:
If you are using Django REST framework then you can easily get the data from the request object by accessing the request.data
dictionary (more info here).
If you are using a vanilla Django view then you can access POST data by using the request object and accessing request.POST['<field_name>']
or request.POST.get('<field_name>')
.
For example:
request.POST.get("date")
You can read more about that or look at examples here.
Solution 2:
To get an parameter in Json format you need change the submethod of request from "GET" to "DATA", like this:
sheet = request.data.get("sheet")
Solution 3:
Try this:
request.data.get("sheet")
Post a Comment for "Get Json Data From Post In Django With Rest Framework"