Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tREST http body problems using global variable

Hi

 

I struggle to get a Zuora API call right in the rRest client. The API wants a JSON body as input.. 

 

 

HTTP POST body:

 

"{
\"queryString\": \"select id, name, subscriptionid from Rateplan where id='abcdef123456' \"
}"

 

=> this works OK. But then getting the variable from database with tFlowIterate, it doesn't work:

 

1:

"{
\"queryString\": \"select id, name, subscriptionid from Rateplan where id=\" + ((String)globalMap.get("rateplan_id")) + \"
}"

 

=> invalid assignment

 

2: 

"{
\"queryString\": \"select id, name, subscriptionid from Rateplan where id=\" + ((String)globalMap.get(\"rateplan_id\")) + \"
}"

 

=> malformed POST body content

 

3,4, 5 => other issues

 

 

What's the correct format of using global variable in the POST BODY?

 

 

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Try this.....

 

"{
\"queryString\": \"select id, name, subscriptionid from Rateplan where id='" + ((String)globalMap.get("rateplan_id")) + "'\"
}"

You are concatenating Strings. When you close the JSON String before concatenation, you do not need to escape the ". You also missed the single quotes (').

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Try this.....

 

"{
\"queryString\": \"select id, name, subscriptionid from Rateplan where id='" + ((String)globalMap.get("rateplan_id")) + "'\"
}"

You are concatenating Strings. When you close the JSON String before concatenation, you do not need to escape the ". You also missed the single quotes (').

Anonymous
Not applicable
Author

thanks, seems to work. I tried also with single quotes, but this was probably the point of confusion I suppose:

"When you close the JSON String before concatenation, you do not need to escape the "."