Forum Discussion
This is a good example
transferring a session ID from a response to a following request
I'm not quite sure how to use this for my needs though. I understand what the transfer property tool can be used for but do not know how to use it for my needs. The API POST I am doing only creates a response that can be viewed in JSON and RAW, however, the RAW response does not have the unique ID that was just created in the response. How would I be able to grab this ID field from the JSON response and transfer it to my next test step?
- PaulMS9 years agoSuper Contributor
Can you copy an example of the JSON response and next test step request?
The example from the article above uses XPath for XML content type, but in the Property Transfer test step you should change the path language to JSONPath.
The property can then be used in a JSON request in the same way as the XML example
e.g. ${#TestCase#SessionID}
Now when executed, the SessionID is transfered to the specified TestCase property and can later on be used in any request via standard property-expansion (or another property-transfer), for example in a logout request we could have
<logout>
<sessionID>${#TestCase#SessionID}</sessionID>
</logout>Which would replace the expansion with the saved SessionID when the request is being sent.
Related Content
- 4 years ago
- 12 months ago
Recent Discussions
- 4 days ago
- 5 days ago