I am using a simple SSJS code from here. I have updated the Fire Entry API end point as below.
/*=== SFMC REST API === */
var payload = { "ContactKey": Account_ID,
"EventDefinitionKey":eventkey,
"EstablishContactKey": true,
"Data": { "Account_ID":Account_ID,
"Person_Email": Person_Email,
"Contact_Salutation":Contact_Salutation,
"Contact_First_Name": Contact_First_Name,
"Contact_Last_Name":Contact_Last_Name
}
};
var route = "interaction/v1/events";
Write("<br><br>payload = " + Stringify(payload) + "<br><br>");
// Write("<br><br>restUrl = " + restUrl +route+ "<br><br>");
var contentType = 'application/json';
var headerNames = ["Authorization"];
var headerValues = ["Bearer "+accessToken];
var result = HTTP.Post(restUrl+route, contentType, Stringify(payload), headerNames, headerValues);
if (result.StatusCode == 201) {
var responseJSON = Platform.Function.ParseJSON(result.Response[0]);
// Write(Stringify(responseJSON)+"<br><br>"); //response
}
else {
throw new Error("Error calling API");
}
- When I Output the 'Payload' in cloud page, the Japanese characters display in Japanese.
However when they get stored in Data Extension they display as ???1 ???????????
- Also I noticed, when I use the same payload from POSTMAN, it works like a champ and Japanese charecters are correctly displayed on both Cloud page as well as in DataExtension!
Any help/advice on this! I know this is something to do with 'UTF-8' encoding... but just looking where to add/Syntax of adding it!
If you use UTF-8 characters in a payload for the Rest API, change the Content-Type header to: application/json; charset=UTF-8
developer.salesforce.com/docs/marketing/marketing-cloud/guide/…