Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

RESTMessageV2 substitute parameter in URL

aklimenko
Mega Expert

Hi

I use RESTMessageV2 to connect to external server. Some API calls have parameters in URL (/api/device/{deviceId}/sync').

I need to send POST and replace deviceId with a value. Unfortunately, setStringParameter() does not work and alternative method setQueryParameter will append the value to url.

Advice appreciated!

3 REPLIES 3

aklimenko
Mega Expert

Additional info: setStringParameter works fine if URL is in this form   /api/lockDevice?deviceId=${deviceId}


changing API is not an option


Alexey,


    I know you aren't stoked on recoding things... trust me, I feel your pain. But for what it's worth, we've been using setEndpoint: RESTMessageV2 API - ServiceNow Wiki successfully in Fuji.



I'm also curious if that setStringParameter works as you expect when using the global scope? I have found different functions on the same object based on the scope.



Happy Thursday,


    --- Travis


aklimenko
Mega Expert

Guys, feel ashamed


Missed $ in URL: api/device/{deviceId}/sync' > api/device/${deviceId}/sync'



RESTMessageV2 works fine with the parameters in URLs