postman json set variable code example
Example 1: defining local variable in api
Local variables are temporary values you set in your request
scripts using syntax :
pm.variables.set("variable_key", "variable_value");
Example 2: defining collection variables
Use pm.collectionVariables to define a collection variable:
pm.collectionVariables.set("variable_key", "variable_value");