The Import command lets you do a HTTP GET from a URL, like this
Import @ "http://merkosoncampus.com/wp-content/uploads/2011/05/higgs-boson.jpg"
This sends an HTTP GET request to the server and presumably parses the response according to some rules for inferring the type of data, from the content or from the extension ".jpg" or whatever.
Listening on the socket, we see something like this
GET http://merkosoncampus.com/wp-content/uploads/2011/05/higgs-boson.jpg HTTP/1.1
User-agent: Mathematica/8.0.4.0.0 PM/1.3.1
Host: merkosoncampus.com
Proxy-Connection: Keep-Alive
whereas what I want is something along the lines of
POST http://foo.bar.com/myService HTTP/1.1
User-Agent: Mathematica/8.0.4.0.0 PM/1.3.1
Host: foo.bar.com
Accept: */*
Connection: Keep-Alive
Content-Length: 76
Content-Type: application/x-www-form-urlencoded
{ "myJsonStuff" : {"number" : 1} }
I looked for options in Import
, praying for something like Method->"POST"
, but didn't find anything useful.
I'd be grateful for clues, experience, ideas, sample code. In the mean time, I intend to work around it by writing my desired JSON to a file and using curl to POST it, but it's way sub-optimal.