Need help re-using a response item in other tests
I'm a new user that has been tasked with learning SoapUI Pro (ReadyAPI) to test our REST API.
We have used tools like Postman and Telerik to set variables that can be easily reused elsewhere, and I'm trying to do the same within SoapUI and not having any success.
I send a POST request with a username and password and get a response with an access_token, I am trying to capture and use this token to then use to pass in our other GET & POST requests. Some of the documentation I've found for this is both outdated and still confusing for the new user.
In JSON the response item I'm trying to use looks as below. I need to capture the access_token to use in other areas.
{
"access_token" : "r3@llyL0nGR@ndoMStUffH3r3",
"token_type" : "bearer",
"expires_in" : 1209599,
"userId" : "12345",
".issued" : "Fri, 10 Aug 2018 12:16:22 GMT",
".expires" : "Fri, 24 Aug 2018 12:16:22 GMT"
}
I'm pretty sure this involves the property transfer item, but I need some more detailed step by step information to make this work, as my attempts have failed.
in postman we have it setup to do this in the Header:
Authorization - Bearer {{access_token}}
Ok, I think I have actually found a solution.
To be clear, documentation on property transfer is outdated and not easy for the inexperienced user to make use of it. It seems intentionally complex when it could be a simplier process.
I was able to use the property tranfser to get this working, but it took a lot of trial and error, and probably could be done better.
For those that might stumble on this question looking for an answer for ReadyAPI:
In the section of my project I right clicked > Add Step > Properties
Green plus sign in the top left and added a name i.e. - UseToken
In the request I right clicked on the token value Transfer To > then in the lower box look for the property and name you just created, click on it
Then in my GET call I created a header:
Authorization - Bearer ${#[Project Name#Get Token#Access_Token]#UseToken}
Which then worked to complete the request