Jump to content

gargic

Approved members
  • Posts

    1
  • Joined

  • Last visited

About gargic

gargic's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I was trying to link a zone with campaign through API. But I get an "Internal Server Error" each time. Below is my code snippet in node.js . var http = require("http"); var auth = "{removed}"; var hostname = "revive.example.com"; ///link zone campaign var postString = ""; var params = { hostname : hostname , path : "/www/api/rest_v1/rest.php?rest=/zon/197/cam/2112", method: "POST", headers: {"Content-type": "application/json","Content-Length": postString.length}, auth : auth } var req = http.request(params, function(res){ res.on('data', function (chunk) { console.log("inside data"); }); res.on('end', function() { console.log("inside end"); console.log(res.statusCode); ////500 console.log(res.statusMessage); /////Internal Server Error }); res.on('error', function(exception) { Console.log("error here in creating zone: "+exception); }); }); var e = req.write(postString); req.on('error', function(e) { console.log('problem with request post zone: ' + e.message); }); req.end(); *I have used other API calls like adding zones and campaigns successfully. Any help would be much appeciated. Thanks, gargic.
×
×
  • Create New...