Forum Discussion
subhaD
6 years agoContributor
The part of URL in the second call response is based on the value sent in first call
So am trying to parametrize the value for URL using the value from first call
- Lucian6 years agoCommunity Hero
I think it would be cleaner to use an Property Transfer test step to extract a property and then just use it in the second call.
- TanyaYatskovska6 years agoSmartBear Alumni (Retired)
- groovyguy6 years agoCommunity Hero
You can try something like what I've posted below. If it doesn't work, can you provide your response for the two calls so I can navigate the response with groovy and parse it out better? Even if it's a sample mocked up response.
def aaa = context.expand( '${1st Call#Response#$[\'data\'][\'res\'][\'b\'][0][\'aaa\']}' ) def response = context.expand( '${2nd call#Response#$[\'data\'][\'res\'][\'reportDownloadUrls\'][\'$aaa\']}' )
Typically when working with strings, you can use $ and a variable name to make the string's contents respect it as a variable. So the two are the same below:
log.info ("Hello world, my name is Matthew."); def name = "Matthew"; log.info("Hello world, my name is $name.");
Related Content
- 4 years ago
Recent Discussions
- 21 minutes ago
- 26 days ago