django - Need to upload both JSON and image file with Curl -
i have django rest api, has model logo
tag in it, file (imagefield
). how should curl
command way. tried way, never worked me:
curl -vx post http://127.0.0.1:8000/client/ -d test.json --header "conten-type: application/json" -f "logo=@downloads/trello.png"
unfortunately json not support uploading binary files, limited multipart requests. if not need send nested data, , not locked json, i'd recommend using that.
a workaround create new view uploading files, separate view requires json. won't work in situations, , require 2 step process, isolates issue.
the other option create (or find) custom field support json uploads, typically using base64 encoded strings.
Comments
Post a Comment