I am using the below code to delete contacts. I am getting a HTTP post error. Not able to find any obvious error. Would appreciate any insight from the community.

This is the error message I am getting:

"message":"An error occurred when attempting to evaluate a HTTPPost function call. See inner exception for details.","description":"ExactTarget.OMM.FunctionExecutionException: An error occurred when attempting to evaluate a HTTPPost function call. See inner exception for details.\r\n Error Code: OMM_FUNC_EXEC_ERROR\r\n - from Jint --> \r\n\r\n --- inner exception 1---\r\n\r\nSystem.Net.WebException: The remote server returned an error: (596). - from System\r\n\r\n\r\n\r\n"}

This is my code:

var url = "https://mysfmc-6384.rest.marketingcloudapis.com";
          url += "/v1/contacts/actions/delete?type=listReference";
          var DE_KEY="my_de_key";
          var headerNames = ["Authorization"];
          var headerValues = ["Bearer " + accessToken];
          var contentType = "application/json";
          var payload = '{';
          payload += ' "deleteOperationType": "ContactAndAttributes",';
          payload += ' "targetList": {';
          payload += '   "listType": {';
          payload += '     "listTypeID": 3';
          payload += '   },';
          payload += '   "listKey": "' + DE_KEY  + '"';
          payload += ' },';
          payload += ' "deleteListWhenCompleted": false,';
          payload += ' "deleteListContentsWhenCompleted": true';
          payload += '}';
         result = HTTP.Post(url, contentType, payload, headerNames, headerValues);
          result = Stringify(result).replace(/[\n\r]/g, '');

1 Answer 1


Looks like you do not have the correct url.



Instead of:

  • Thanks but it gives a 400 error. Also, I checked the REST end point in Postman and it works. Jun 20, 2019 at 21:49
  • 400 error is better than 596. 596 signifies a bad url, which you had. 400 is probably on account of an issue in your payload. What does the payload you are sending in Postman look like?
    – Mike
    Jun 20, 2019 at 21:50
  • And what does the payload you are sending in that code snippet look like as a full, serialized string? I am unsure what language you are using there.
    – Mike
    Jun 20, 2019 at 21:51
  • Thanks, this is Server Side Java Script. Also 400 is page not found. How you are determining 596 means bad url? Curious as I tried to look that error up, couldn't find anything conclusive. Jun 21, 2019 at 3:15
  • Can you do a Platform.Function.ParseJSON(payload) just to check the JSON is well formed? I always create the payload as a JSON and then in the post method perform a Stringify(payload)
    – SebOB
    Jun 21, 2019 at 12:12

You must log in to answer this question.

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