We are testing the connection establishment with our client url. while establishing the headers in postman it is successful with code 200.

While we are trying to create a test landing page with the below test script ; it gives error

Content before : Script.Util.HttpRequest :An error has occurred: An error occurred when attempting to evaluate a Util.HttpRequest call. See inner exception for details. URL: https://***********.com/mocking/api/v1/links/bd076bd7-0fa2-4966-8014-944f40a55d4d/notifications/sms Method: POST ClientID: 7315275 JobID: 0 ListID: 0 BatchID: 0 SubscriberID: 0

<script runat="server">
Platform.Load("core", "1.1.1");
var data ={"message":"Sample Message","recipient": "639385231354"};
var url ='https://*********.com/mocking/api/v1/links/bd076bd7-0fa2-4966-8014-944f40a55d4d/notifications/sms';
var payload = Stringify(data);
var req = new Script.Util.HttpRequest(url);
req.emptyContentHandling = 0;
req.retries = 2;
req.contentType = "application/json";
// req.continueOnError = true;
req.method = "POST";req.postData = payload;
Platform.Response.Write("Content before : "+req +" :");
var resp = req.send();
Platform.Response.Write("Content<br/ >: "+resp +"");
// Platform.Response.Write("Return header: "+resp.headers["returnHeader"] +"");
}catch (ex) {Write("An error has occurred: " + ex);

Why do I get this error? How can I fix it?


Your Answer

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

Browse other questions tagged or ask your own question.