How to pass current user location from server side script to HTTP Query Parameters REST Message?

bbf35621
Kilo Sage

Hello guys!

 

I am new to Outbound REST Message and I believe I am almost there. Currently, I have manually entered a specific city and state called Austin,TX, in an API URL endpoint like this in the studio,

rest message.jpg

 

Now, I want to change from manual input to dynamically based on the current logged user location in URL Endpoint something like "city={user_location}". In the server-side script, I have a current user location variable called userLocation that is ready to apply it. My question is, how do I apply that in HTTP Query Parameters from server-side script to HTTP Method in the studio?

bbf35621_1-1742582900757.png

 

1 ACCEPTED SOLUTION

bbf35621
Kilo Sage

I figured out and able to solve my issue.

I just need to update endpoint url and add this to HTTP Query Parameters like this,

bbf35621_1-1742588482906.png

 

bbf35621_0-1742588376422.png

and then in service side script, I added r.setStringParameterNoEscape('city', userLocation);

View solution in original post

3 REPLIES 3

Shivalika
Mega Sage

Hello @bbf35621 

 

Please use ${user_location} instead of Austin,TX  in your endpoint, you can do this at multiple places whereever you want to pass dynamic inputs. 

 

Then create this "user_location" in Query Parameters related list. Whatever value you pass there will automatically be passed here. 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

 

bbf35621
Kilo Sage

I figured out and able to solve my issue.

I just need to update endpoint url and add this to HTTP Query Parameters like this,

bbf35621_1-1742588482906.png

 

bbf35621_0-1742588376422.png

and then in service side script, I added r.setStringParameterNoEscape('city', userLocation);

Hello @bbf35621 

 

Yes, that's my answer as well. 

 

We can accept multiple solutions. Please mark helpful or accept solution if it helped you in anyway 🙂