Report Problem Linking Zone With Campaign in For Developers Posted June 19, 2015 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.
Problem Linking Zone With Campaign
in For Developers
Posted
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.