Forum Discussion

Nisse's avatar
Nisse
New Contributor
6 years ago

Use value in JSON response (from Post HTTP) for next test step GET HTTP

I have tried to search on Google for a solution to this and it might exist (I am very new to this!) but I haven't been able to find it. This is what it´s all about:

 

I want to create a test suite where I create a consent with the post operation "postConsent" sent in to the operation as a JSON:

 

1) Sent as POST https://<apim-address>/axs/v1/consents/

 

And the response come back as JSON:

{
"consentStatus": 3,
"consentId": "91d99eb6-4442-4a88-82b2-752ca8d01406",
"scaMethods": [ {

|

|

 

The value of 'consentId' (91d99eb6-4442-4a88-82b2-752ca8d01406) - of course different for every new POST sent - is used in next test step where we want to check the status of the consent. That is done by 

 

2) GET https://<apim-address>/axs/v1/consents/91d99eb6-4442-4a88-82b2-752ca8d01406/status

 

Where the response from the GET come back as JSON as well. 

 

And also in a third step it would be feasible to use the consentId again in a GET operation 

 

3) GET https://<apim-address>/axs/v1/consents/91d99eb6-4442-4a88-82b2-752ca8d01406

 

And maybe even in a 4th step if we want to delete the consentId:

 

4) DELETE https://<apim-address>/axs/v1/consents/91d99eb6-4442-4a88-82b2-752ca8d01406

 

I have tried with property transfer but have not been able to store the value of consentId in a variable to put into each of the following GET and DELETE operations. I guess it´s possible? The property transfer window seem to have no groovy support. 

 

Thanx in advance!

 

/Nisse

No RepliesBe the first to reply