Using curl request
curl -v -X PATCH -H "Content-Type:multipart/form-data" -H "Accept:application/json" -H "Auth-token:abcde" -F "first_name=snme" -F 'tags[]=chec' -F 'tags[]=chec2' http://example.com/api/users/1
I want to post tags as an array. So parsing the request i should get tags = ['check' , 'check2']
etc.
What I get now is {"tags[]" = "chec"}
Try this:
curl -X POST -d 'tags[]=check&tags[]=check2' 'http://example.com/api/users/1' -v
For multipart it should work with what you have tried:
curl -X POST -F 'tags[]=check1' -F 'tags[]=check2' 'http://example.com/api/users/1' -v
Returns:
{"tags":["chec","chec2"], ... }
For some server, you can use
curl -X POST -F 'tags=check1' -F 'tags=check2' 'http://example.com/api/users/1' -v
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With