My problem:
Running windows 7 and using an executable command-line tool to curl my localhost api for POST data returns an error, which seems to be very common.
The request is sent properly, except that the data did not reach the server, as it should force my REST service to insert data with zero values.
Which seems to be causing the error: imagine something like this
curl -i -X POST -H 'Content-Type: application/json' -d '{"data1": "data goes here", "data2": "data2 goes here"}' http:localhost/path/to/api
Return Data Result
curl: (6) Could not resolve host: application; No data record of requested type curl: (6) Could not resolve host: data goes here,; No data record of requested type curl: (6) Could not resolve host: data2; No data record of requested type curl: (3) [globbing] unmatched close brace/bracket at pos 16
After some searching, it turned out that the problem could not be the syntax used for the request, since it works with UNIX shells.
Perhaps you are using windows? It looks like a completely broken shell that does not correctly handle single quotes and double quotes. I just tried this command line and it worked perfectly on my Linux field. http://curl.haxx.se/mail/archive-2011-03/0066.html
I tried to work with those who "escaped", but it still did not work.
2.
curl -i -X ββPOST -H 'Content-Type: application / json' -d '{\ "data1 \": \ "data goes here \", \ "data2 \": \ "data2 goes here \" } 'http: // localhost / path / to / api
3.
curl -i -X ββPOST -H 'Content-Type: application / json' -d '{\ "data1 \": \ "data goes here \", \ "data2 \": \ "data2 goes here \" } 'http: // localhost / path / to / api
So I gave up. Windows seems to be encountering a JSON object sent to POST
command-line windows post api curl
Lothre1 Aug 6 '12 at 19:01 2012-08-06 19:01
source share