If you need to send data via REST API and the data to be sent contains a quotation mark ( ” ), and you need to pass it to the other party, you can send it as follows.
Example code for calling a REST Message:
var ids=[];
.
.
.
while(grs.next()){
ids.push('"'+grs.getValue('u_srcnepk')+'"');
}
//ids içeriği ["xxx","yyy","zzz"] gibi olacak Tırnak işaretleri ile birlikte göndereceğiz.
var endPoint = 'https://xxxxxxxxx/gms/rest/alarm/appliance?view=active';
try {
var r = new sn_ws.RESTMessageV2('SilverPeak', 'getMajors');
r.setEndpoint(endPoint);
r.setRequestHeader("Content-Type","Application/json");
r.setRequestHeader('Cookie', cookie);
r.setStringParameterNoEscape("ids", ids);
var response = r.execute();
responseBody = response.getBody();
var httpStatus = response.getStatusCode();
var obj = JSON.parse(responseBody);
.
The key code in the above code snippet is:
r.setStringParameterNoEscape("ids", ids);
Also, the following JavaScript functions will definitely be useful to you.
encodeURI('http://www.xxxx.com?filter={$s}');
escape('http://www.xxxx.com?filter={$s}');

Share your experience
Bir sorunun, farklı bir çözümün veya eklemek istediğin bir notun var mı? Giriş yapmadan da yazabilirsin.