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\":\"test@test.com\",\"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.

3

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: "test@test.com",
        password: "testtbot1",
        privatekey: “0lemon9087”
    };
var contentType = “application/json”;

try {
   var request = HTTP.Post(url, contentType, Stringify(payload));
} catch (error) {
    Write(error);
}
</script>
| improve this answer | |
  • Array of header name and values are the required parameters – Manoj Nov 15 '19 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=[];
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.