Dynamic Post Data on POST or PUT (REST)
Hi guys,
Lets assume the following scenario.
I've created a test with 3 steps.
Step 1: GET -> GetUser. This give me a JSON response with a bunch of fields such as userid, email, name etc.
Step 2: Transfer properties. The only property that makes sense is the whole response.
Step 3: POST -> SetUserActive.
I now need to generate some JSON based on the response that was transfered, and add it to the header for the next request. I cannot seem to find a way to do that.
So I set the MediaType to "application/json"
The text below that curently gets the reposnse from my initial request, but I need to alter it, and create a new json strong based on some of the values. Now I can use xpath in the transfer properties section to get specific values, but still still does not explain how I can create a custom json string just below the post header.
I am using the free version for now. I've submitted a request for the company to get the pro version but this is hampered by redtape...
{ "responseCode": "1", "responseDescription": "Fully Registered User", "userBiographicalInformation": { "firstName": "Joe", "lastName": "Bloggs", "contactnumber": "0111234567", "Id": "1234567890123", "emailAddress": "someone@somewhere.com" } }
Then for the query on the POST message it should be:
{ "accountId": "123456", "userType": "Fully Registered User", "Id": "0123456789012" "firstName": "Fred", "lastName": "Bloggs", "contactnumber": "0821234567", "emailAddress": "fred@bloggs.com", "marketingYN": "N",
}
In other words I can extract most of the information from the request response. For Testing the rest of the data will be hardcoded.
So I was hoping forsomething like looks like this:
{ "accountId": "123456", "userType": {properties.userType}, "Id": {properties.Id} "firstName": {properties.firstName}, "lastName": {properties.lastName}, "contactnumber": {properties.contactNumber}, "emailAddress": {properties.emailAddress}, "marketingYN": "N",
}