How to connect Linux and update a .json from postman pre-req

I have a requirement to connect the Linux terminal and update a value in the .json file. Can anyone guide me to complete this task.

Thanks in advance.

Hey @rkishore.qa :wave:

Welcome to the Postman Community! :postman:

I’m unsure what you mean here by “connect the Linux terminal” :thinking:

You wouldn’t be able to access anything like that from the scripts sandbox - Do you have any further information about what you’re trying to do?

Hi Danny,

Before running each test case from the Postman collection, we are adjusting some .json and .xml files in the server location manually. Now we are planning to automate of this from Pre-req tab in Postman.

Is there an endpoint that you’re hitting to update that file with a POST or PATCH request?

You can make async calls from the pre-request scripts using pm.sendRequest().

I’m assuming this is a test server, so adding a Samba share for where the files are located should be possible.

I would then use PowerShell to adjust the files, and finally call the Newman command line from the same PowerShell script to run the Collection.

Or create an API on the server for updating the test files, which can be called with Postman. (This would be preferable, but usually requires developer assistance). This is also how we do start up and clean down scripts. We usually get the developers to create a specific API to delete records, etc so we can confirm that the system is in a known state before we start a particular test.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.