Can you explain to me variable substitution in a Rest call?

FIKRI BENBRAHIM
Kilo Guru

Hello all,

   I can't understand variable substitution in Rest calls although i have looked at the documentation: Variables substitution in Outbound Rest messages. And in the examples, i can't understand what the names of the variables refer to.

   Please guide me thru this one. Thanks in advance. 

Kind regards

FIKRI BENBRAHIM Mohamed Jawad

1 ACCEPTED SOLUTION

siva_
Giga Guru

Hello JFB, 

 

Variable substitutions are used generally as a placeholder to have different values for different requests instead of hardcoding the values in the end points itself;

Variables are allowed in the Endpoint URL, HTTP Header and HTTP Query Parameter Value fields, and the Content field for POST and PUT methods 

once you use the syntax of ${variable_name} and click auto generate variables related link , you can see the variable substitution parameters are populated with keys and by updating the values there you can check the responses of your end point for different values in these variables. 

This is while you are testing 

But in the actual scripts you can use setStringParamter and setStringParameterNoEscape to populate the variable values while sending the request 

There might be scenario where your end point responds differently based on different values selected on a particular  field in the form which you have used as a variable in your end point ,so here the variable parameter is dynamic which cannot be manually given 

In such a case when you are triggering your rest message through any server script using RestMessageV2 then you can 

use like r.setStringParameter(varName,current.particularFieldValue);

 

Mark this answer as correct if that clarifies your query and also for categorizing this thread as answered .

 

Thanks,

Siva

View solution in original post

5 REPLIES 5

shivaniamborkar
Tera Expert

Hi 

 

I have tried this all the 3 methods, I am unable to get the special characters(&, #) values.

Its not working for reference field as well. It only works when i pass the sys_id of the user and not the name.

 

Please help me!!

 

I do not want to use regex function.