I’m trying to post an image and a few nested parameters to an api using django rest framework. I’m trying to set up a curl with -F flags as discussed here with nested params as discussed here:
curl -X POST -S -H 'Accept: application/json' -F "customer[name]=foo&customer[email]=foo@bar.com&customer[zipcode]=1076AL&customer[city]=Amsterdam&customer[address]=foobar" -F "photo=@/Users/vincentvanleeuwen/Desktop/tmp/accord.jpg;type=image/jpg" http://localhost:8000/api/orders/
But I get the following response:
{"customer":{"city":["This field is required."],"email":["This field is required."],"zipcode":["This field is required."],"name":["This field is required."]}}
There seems to be something wrong with my nesting under the -F flag, as the nested variables work if I post it like this:
curl -X POST -S -H "Content-Type: application/json" -d '{"customer":{"name":"Adriaan","email":"adriaan@adriaan.com","zipcode":"1901ZP","address":"caravan","city":"Verweggistan"}}' http://localhost:8000/api/orders/
Any ideas what I’m doing wrong? Any help would be much appreciated!