0

I am trying to post a request to my site and I am using SSJS HTTP post method. But the POST request is throwing error ""

Unable to retrieve security descriptor for this frame.

Im not sure what i am missing here also i just have the content type as header no other headers are required for my request. Kindly find my code below,

   var inputjson="{\"username\":\"[email protected]\",\"password\":\"testtbot1\",\"Privatekey\":\"0lemon9087\"}";
   var url="https://mysandbox.com/api/Rest/v1/Authenticate";
   var content = [0];
   var headername="[Content-Type]";
   var headervalues="[application/json]";
   var result = HTTP.Post(url,"application/json",inputjson,headername,headervalues);

I have tried Stringify payload but its also throwing the same error.

2 Answers 2

4

Try something like this:

<script runat="server">
Platform.Load("Core","1.1.1");

var url = “https://mysandbox.com/api/Rest/v1/Authenticate”;
var payload = {
        username: "[email protected]",
        password: "testtbot1",
        privatekey: “0lemon9087”
    };
var contentType = “application/json”;

try {
   var request = HTTP.Post(url, contentType, Stringify(payload));
} catch (error) {
    Write(error);
}
</script>
1
  • Array of header name and values are the required parameters
    – Manoj
    Commented Nov 15, 2019 at 8:50
0

There was a syntax issue, instead of array of headers i have declared as string so fixing the syntax solved the issue

var headername=[];
var headervalues=[];

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .