SnipURL Not Using cURL

34 views
Skip to first unread message

Joe McCann

unread,
Oct 25, 2010, 3:15:56 PM10/25/10
to SnipURL
I'm writing a quick app that in node.js to shorten links using your
service and was wondering if I don't use curl, which I'm not, do you
expect some sort of header to be passed in order to get the proper
response?

I am doing the following:

request({uri:"http://snipr.com/site/getsnip", body:"sniplink=http://
www.google.com&snipuser=myusername&snipapi=myapikey&snipformat=simple",
method:"POST"}, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body)
}
console.log(body)
console.log(error)
});

and am getting this error:

ERROR - SEND REQUIRED FIELDS (URL, USER, API). CHECK <a href="http://
snipurl.com/site/api">http://snipurl.com/site/api</a> FOR
INSTRUCTIONS.


request() is a node.js module that creates a standard http client.

curl -d "sniplink=http://
www.google.com&snipuser=myusername&snipapi=myapikey&snipformat=simple"
http://snipr.com/site/getsnip

works fine in a shell.


Is there a header that needs to be set if I'm not using cURL? Any
thoughts?

Thanks.
Reply all
Reply to author
Forward
0 new messages