Forum Discussion

LennSar's avatar
LennSar
Contributor
3 years ago

Write Rest request content to file

Hi there,

I'm randomly generating  the content of a rest put request which I execute several times after another (everytime with new content). Afterwards I'd like to check whether the content was written as expected but since I can't access the put request as a reference anymore I thought about writing the content to file every time and than use that file as a reference for the later check.

Here's an example of how the request looks like in ReadyApi

Problem now is: I don't know how I could write this into a file. Any suggestions? 

 

Thanks!

 

Lennart

2 Replies

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 3

    As mentioned elsewhere, you might want to look at the datasink step

  • richie's avatar
    richie
    Community Hero

    Hey LennSar 

    As always i'm a bit lost on what you want (the problem is me, not you!), but
    if i understand correctly, as ChrisAdams said you can use the DataSink to write out responses.....do you want the responses? The way i read your post, it seemed like you wanted the input payloads for later comparison?
    Then i changed my mind after re-reading and then thought you wanted to confirm the sequential PUTs updated the endpoints database correctly. If you want to verify a CRUD transaction, i always follow up with a GET to retrieve the updated detail to assert the changes were made successfully and if there isn't a GET method available i use a JDBC step to do the same.

    Still unsure what youre after or if any of my comments are relevant!๐Ÿ˜‰

    Cheers!

    Rich