Reputation: 209
Apologies for my ignorance here.
I have the following payload that I need to send to a URL via cURL (Mac Bash).
{“requestid":"2323423432",
"partnermatchid":"56d576ee-2d74-4dda-b8ff-d71b34311dd2",
"usercontext":{"ipaddressmasked":"209.252.7.186",
"useragent":"mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, like
gecko) chrome/28.0.1500.95 safari/537.36",
"country":"us"},
"pagecontext":{"pagetypeid":"3","numslots":"6"},
"istest":false}
Can you help with the command syntax to do that? I tried this, but it's generating weird HTML in Bash and I don't understand what is going on.
echo ‘{“requestid":"2323423432",
"partnermatchid":"56d576ee-2d74-4dda-b8ff-d71b34311dd2",
"usercontext":{"ipaddressmasked":"209.252.7.186",
"useragent":"mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, like
gecko) chrome/28.0.1500.95 safari/537.36",
"country":"us"},
"pagecontext":{"pagetypeid":"3","numslots":"6"},
"istest":false}’ | curl —data-binary @- http://www.thisistheurl.com
Thanks so much!!
Upvotes: 0
Views: 10381
Reputation: 69937
Since you're POSTing JSON data, you need to specify the content type of the request as well.
Try:
curl -d '{ "requestid": "2323423432", "partnermatchid": "56d576ee-2d74-4dda-b8ff-d71b34311dd2", "usercontext": {"ipaddressmasked": "209.252.7.186","useragent": "mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, like gecko) chrome / 28.0 .1500 .95 safari / 537.36", "country": "us" }, "pagecontext": { "pagetypeid": "3", "numslots": "6" }, "istest": false }' \
-H "Content-Type: application/json" http://url
Also in your original post, there are some "fancy quotes" which should be replaced with normal quotes, in case that's what you're trying to use on the command line.
Upvotes: 1