How to add a variable to a Rest Message's Content field dynamically?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2023 04:00 AM
I've a rest message function defined with some default variables:
So via script, I can substitute those values
var rm = new sn_ws.RESTMessageV2('dummyAPI', 'post');
rm.setStringParameter('callback_url', 'xxxxxxxx');
rm.setStringParameter('correlationId', 'yyyyyyy');But is it possible to add an extra variable and substitute it on the fly? Something like below:
rm.setStringParameter('new_variable', 'abc');I tried with the above code, but in the scripted rest API resource, when I did
gs.log(JSON.stringify(request.body.data));I could only see "callbackUrl" and "correlationId" keys and not "new_variable".
Is there way to have that added? I don't want to update the rest message's "Content" field and would like to have that extra variable added by script.