42. Pass new line and special characters in REST API Body
Import
·
May 27, 2024
·
article
You can include new line and special characters while sending values in REST API.
Simply use this function and get the value you want to send in request body
Example script:
function jsonEncode(str) {
str = new JSON().encode(str);
return str.substring(1, str.length — 1);
}
var r = new RESTMessage(‘TestIncidents’, ‘post’);
r.setStringParameter(“description”, jsonEncode(current.description + ‘’));
var responser = r.execute();
View original source
https://medium.com/@LearnITbyPrashant/43-pass-new-line-and-special-characters-in-rest-api-body-f4dd1a03e449?source=rss-d005fc598f0a------2