0
var number1 = request.pathParams.number;
var getData = request.body.data;

var req = new GlideRecord('incident');
req.addQuery("number", number1);
req.query();
if (req.next()) {

req.work_notes = getData.comments;
req.update();
response.setStatus(200);
response.setContentType("application/json");
response.setBody({
"success": true,
"work_notes": getData.comments
});

}
Scripted Rest API to return table data ServiceNow
admin Changed status to publish December 19, 2023