Jump to content

Problem Linking Zone With Campaign


gargic

Recommended Posts

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...