Variable substitution in Rest Endpoint through script include & get variable value from client scrip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 05:22 AM
Hi All,
I need to put a variable value in Rest Endpoint: https:lookup/${address_id}
If I hard code this address in script I'm getting 200 response, but if I add it dynamically through not getting any response/error but I could able to log the variable value correctly in System Logs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 05:42 AM
Hi @Shree14,
Variable value format: Ensure that the format of the add3 variable matches what the endpoint expects. If it's expecting a specific format or encoding, make sure add3 complies with that
Please accept my solution if it resolves your issue and thumps 👍 up
Thanks
Jitendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 09:41 PM
Thanks @Jitendra Diwak1 .
but there is no format required, without any format if I give value : 'PD4DPC8DPgNHT09HTExGS00DOjE4'.. the response is 200.
But I want to add this value through varaiable.
Thanks,
Shree
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 10:05 PM
Hi @Shree14 ,
Please try the below:
var r3 = new sn_ws.RESTMessageV2('smaty_test', 'Int complete address'); //Rest MSG & Method
r3.setStringParameterNoEscape('address_id', add3.toString()); //add3 - 'PD4DPC8DPgNHT09HTExGS00DOjE4'
Please Mark My Response as Correct/Helpful based on Impact
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 10:10 PM
add3 is already stored as String.
var id = 'PD4DPC8DPgNHT09HTExGS00DOjE4'9;
add3 = id.toString();