I have made several apis in djangorestframework. This I could test both with the html form of the api as with curl in commandline.
Now I have an api to a Model with
After a long puzzle, this seems to do the trick:
-F
arguments Accept
(not Content-Type
)Use @
to indicate the local file to upload
curl -X POST -S \
-H 'Accept: application/json' \
-u "username:password" \
-F "otherfields=something" \
-F "photo=@/home/michel/test.jpg;type=image/jpg" \
http://127.0.0.1:8000/api/v1/
By the way, I know all of this is on the documentation site of curl, but just missed an example of all those things together since there are a lot of options to try out.