Correct the encoding type in the form in the CURL command when submitting to django-rest-api

I am using django-rest-framework and have a model that only has a file-field. I created serializer and views and everything else. Everything seems to work correctly because when using the web-api I can upload the file without any problem. But when trying to use CURL to check it, I always get

{"data": ["File not sent. Please check the encoding type in the form." ]}%

I have tried many commands, but they all end up in this error message. The commands I've tried where:

curl -H "Content-Type:multipart/form-data" -u stefan:stefan -F "data=/home/erdi/Videos/search4.webm" http://127.0.0.1:8000/restapp/sportvideosupload/

curl -X POST -S -H 'Content-Type: application/json' -u "stefan:stefan" --data-binary '{"data":"/home/erdi/Videos/search2.webm"}' 127.0.0.1:8000/restapp/sportvideosupload/

curl -X POST -H "Content-Type:multipart/form-data" -u stefan:stefan -F "data=/home/erdi/Videos/search2.webm;type=video/webm" http://127.0.0.1:8000/restapp/sportvideosupload/

      

As I start to use the anxiety apis, I hope that perhaps one of you has some suggestions on what I am doing wrong.

+3
curl django-rest-framework


source to share


No one has answered this question yet

Check out similar questions:

377
Using curl to download POST data with files
131
How to send file content as body object using cURL
43
CURL POST command line in WINDOWS RESTful service
21
Django rest API, automate documentation?
1
Sending csv file via curl POST to Django REST platform endpoint
0
cURL doesn't show JSON data when using Django REST Framework
0
django REST, combining 2 kinds of forms for json curl
0
Using Curl and Django Rest Framework in Terminal
0
The data presented was not a file. Check the encoding type in the form?
-1
Can't save data with POST request in django-rest API



All Articles
Loading...
X
Show
Funny
Dev
Pics