How best to pass a large response object, edit it and then pass to request.
The tradional use case for our SOAP API is that a user will fetch a large object via one API call response, make an edit to an object property and pass that object into the request body of another API call to perform an update.
The object in question can be large and contain nested objects, the API will also delete any property if the property value is null so it's vital that the transfer from response to request transfers all nested properites as it could break the test.
What's the best way to replicate this in ReadyAPI? Mapping individual fields across from response to request is too time consuming due to the size of the object. I've tried using the property transfer step but I've had mixed results, can this be done in a groovy script step instead?
I'm a little confused so csn you clarify the following? It's possible with groovy but the scripters that may be able to help would need a lot more info:
You have an initial GET that returns a payload....what's the datatype of the response payload? You mention SOAP which means it must be XML, but you can but you dont often see a lot of complex nesting in XML, you seem to see more nesting in JSON. So! Is the datatype of your payloads XML/SOAP?
You have a GET, you grab response (which is large with nested attributes) edit it and then use some or all of the GETs response as the payload for a subsequent PUT PATCH or POST request?
When you say you 'edit it' how are you editing the response before you pass it onto the subsequent PUT/PATCH/POST.....are you not using groovy to do the editing? If not how are you editing the content before the transfer?
It would help to know what the current test steps you have in your testcases just to visualise??...e.g.
GET step PropertyTransfer Groovy Properties PUT/PATCH/POST step
It would also help people if they knew the structure and content of the response and request payloads you are talking about (just use dummy data if youre concerned about security)?
You say the payload of your GET is large with nested content and it'a time consuming to use the PropertyTransfer function and you'd like to use groovy, but even with groovy you would still have to code out a mapping between the attributes in your GET response to your PUT/PATCH/POST request so this could be time consuming also?
I understand what youre saying about if you have blank attributes it will blank out the field in the underlying database you are PUT/PATCH/POSTing to, but if you are using a specific records data from the GET in a subsequent update....if the attribute is blank in the GET surely you'd want to maintain that? Or am i misunderstanding the significance?
Ok..that's it for now,
Nice one, Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta