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 += '}';
Platform.Response.Write(payload);
result = HTTP.Post(url, contentType, payload, headerNames, headerValues);
result = Stringify(result).replace(/[\n\r]/g, '');
Platform.Response.Write(result);
Platform.Response.Write("Test");