-
Hi Ranga, But I have one question. I have a use case where I have to test an API which only supports PUT and not PATCH for modifications on objects. Which means I always have to include a JSON body with the full set of attributes with the PUT request. What a client has to do is getting the whole object, modifying those attributes it wants to modify and write the whole object back with PUT. I can of course create a PUT request test and insert a static JSON body with attributes I want to modify. Which works. But unfortunately some of the attributes returned by the API can be changed by the service (or service admins). I don't care about these attributes but if I try to write back outdated/invalid values to them the PUT request and thus the whole test fails. Which is misleading. Therefore I have to check always before the test the values of these attributes for the objects and update my static JSON bodies in the Thunder tests. Which is quite cumbersome. What I would like to do is: get the object with one GET Request, store the JSON body in an local environment variable, modify some attributes (including multivalue attributes). Then with a second PUT request use the content of the local environment variable as body and send it to the server. I managed to store the whole JSON body of the GET request in the local environment using the "text" keyword. But I got stuck there. Is there a way to modify the stored body and send it in a PUT request? Thanks you, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @tw3001, will test here and see what is the best way for this use-case and get back to you. |
Beta Was this translation helpful? Give feedback.
-
Hi, you can save the json response fields from 1st request from Tests tab and use those variables in the 2nd request. Making the dynamic field values as variables like below example |
Beta Was this translation helpful? Give feedback.
Hi, you can save the json response fields from 1st request from Tests tab and use those variables in the 2nd request.
Making the dynamic field values as variables like below example