Forum Discussion

patrick_winters's avatar
patrick_winters
Frequent Visitor
6 years ago

Environment Variable Not Expanding inside application/json call

UDPATE: I have since figured it out and learned I need to surround each variable call in a application/json call in " ". Thanks!

Hello,

 

Inside my REST call I'm sending an "application/json" media type request and am trying to pull in environment variables to help populate the request. Currently, I am able to pull in Project variables with no issue. And in a previous request (with "application/xml" media type) I can pull in the Environment variables fine there. 


Call I'm trying to make: 

{

.

.

.

"userId": ${#Env#soapUIUserId}

}

(the ... are the rest of the call which is hard coded, except one Project variable which imports fine)

 

The request doesn't seem to expand the variable out but it expands my other variable out.

 

Things I've tried:

1) Using this same expansion in a different call. (worked)

2) Using Groovy to automate retrieving the Environment variable out, using context.expand (didn't work)

3) Using "userId": ${=System.getenv().soapUIUserId} instead (didn't work)

4) Hardcoding the Environment variable's value (worked)

 

Is there something missing? Is there just a limit on how many variables can be used at once?  Is there a config setting I'm missing?

No RepliesBe the first to reply