Forum Discussion
nmrao
9 years agoChampion Level 3
Can you show how you are expecting value? or if the value is going to be used in the next rest call, then will it need to be in the header or parameter or payload?
- JawsomeJess9 years agoNew Contributor
Yes it's a header:
I simply need it to say Bearer accesstoken
- nmrao9 years agoChampion Level 3
Unfortunately, do not have environment to try that property transfer to get it work.
What i see is you will be able to access the values from first Json response
change from
[token_type, access_token]
to
add two properties in Property transfer step
prop1 -> $.token_type
prop2-> $.access_token
But the problem is each one goes to different target.
For now, the below solution should be helpful
Disable property transfer step.
Add the script assertion with following code for the first rest step
import net.sf.json.groovy.JsonSlurper def jsonSlurper = new JsonSlurper() def object = jsonSlurper.parseText(messageExchange.responseContent) def accessToken = object.access_token def tokenType = object.token_type assert null != accessToken, "access_token does not have a value" assert null != tokenType, "token_type does not have a value" def authorizationKey = "${tokenType} ${accessToken}" context.testCase.setProperty('AUTH_KEY',authorizationKey)
Now in the second step, use ${#TestCase#AUTH_KEY} where the value is required.