Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Curl post with multipart/form-data and JSON

Is there a way to use curl to do a multipart/form-data post and specify that the data is application/json? It doesn't have to be curl.

like image 546
user994165 Avatar asked Apr 10 '15 14:04

user994165


1 Answers

This is what I use, and it works fine

curl -v -H "Content-Type:multipart/form-data" 
        -F "someName={\"your\":\"json\"};type=application/json"

Note: I'm on Windows, hence the requirement for double quotes

Or

-F "[email protected];type=application/json"
like image 97
Paul Samsotha Avatar answered Sep 28 '22 08:09

Paul Samsotha