I am able to create a Case in SalesCloud using Postman. However, with the same JSON payload this is failing from my CloudPage using SSJS (note that I retrieve the token successfully in the same page)
When I try
var result = HTTP.Post(endpoint, "application/json", payload, ["Cache-Control", "Authorization"], ["no-cache", "Bearer " + token]);
I get {"message":"Unable to retrieve security descriptor for this frame.","description":"System.InvalidOperationException: Unable to retrieve security descriptor for this frame. - from mscorlib\r\n\r\n"}
I also tried by converting the payload to form data (this worked for the token retrieval..)
var result = HTTP.Post(endpoint, "application/x-www-form-urlencoded", payload, ["Cache-Control", "Authorization"], ["no-cache", "Bearer " + token]);
But I get error {"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: (415) Unsupported Media Type. - from System\r\n\r\n\r\n\r\n"}
What's the correct way of doing this?