I have a REST request that respond with the following:
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlQwWE8xNnAtMmZzMWxremV5",
"expires_in": 2592000,
"token_type": "Bearer"
}
I want to take the value of access_token
, store it in a property and reuse it for two subsequent requests.
Following some tutorial here, when running the request that obtains the access_token
I get a:
error parsing target property: error unexpected element CDATA
But why?
There is no CDATA in my raw response.
If you've problems using
transfer properties step
to get the JSON value from your response, you can use agroovy test step
to achieve your goal.So create a
groovy test step
to parse your response, get your value and set it as a property (for example attestCase
level) with the follow code:Then in the other
testSteps
(REST or SOAP...) you can use the follow code to get theaccess_token
value you set in thetestCase
:Hope this helps,