Push data to web service

Iam trying to push some data to my web service in which i use http GET to take the data. I need a way to just call the url frok my imp http.get does not work at all it is not able to call the url. The web service is working fine as i checked it by calling from a browser.

server.log(a);
data = a;
server.log(data.time);
local headers = {"Content-Type" : "text/json"};
server.log("post...");
local url = "http://armor.co.in/vignesh/report/requestData.php?currentDate=2014-11-24 16:42:46&macAddress=952555";
local request = http.get(url,headers);
local response = request.sendsync(); 

Please help on how to call the url from the agent

Space characters in URLs are normally either “URL-encoded” as “%20”, or sent as “+” characters, but your URL has a real space character in it.

Also, does your web service want HTTP GET or POST? If you’re setting a content-type, then that implies there’s an outbound body, which implies that it should be a POST not a GET.

See the documentation on http.post(). If you want to do an HTTP POST with “data”, JSON-encoded, as the body, then that’s this:

local request = http.post(url, headers, http.jsonencode(data)); local response = request.sendsync();

If that still doesn’t work, let us know the contents of “response”.

Peter

it works fine sir thank you for your support
-Hari