How to create a new request from a request response (url )

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Here’s an outline with best practices for making your inquiry.

My question:
Can we automate steps to ‘Send and download’ from a url which is in a request’s response

Details (like screenshots):
So I have a request and the response has property with a url to download a file .I have to manually click this url from response and it opens up a new get request in new tab with headers etc - and I click ‘Send and Download’ to download the excel file
If I try to save this link in a variable and use it in a request it doesn’t copy all the header to the new manually added request

How I found the problem:

I’ve already tried:

@sgolyala

This is a fairly standard function, so it should work.

Therefore, can you post screenshots of the issue showing what it does\doesn’t copy including the Console Logs (expanded) for each of the requests\responses.

Redacted where appropriate.

so this is the first response I get when I send a request and I use this link to download an excel file in the next request which can happen only manually (Hitting ‘Send and Download’ or ‘Send to a file’)
image


Is it possible to automate this in Postman when I send request with link and it downloads the excel file to local system

I have got a requirement to automate table export to excel file on many different pages we have - I have all these requests for each table in a collection
I can only hit the ‘send and download’ or ‘Save as a file’ manually on each request but not sure how to automate it within postman when running as a collection can be done

I can only recommend at this point to use the capture requests feature.

This will allow you to capture all of the API calls and work out what exactly is needed in the next request (which I’m assuming is some sort of get). It should give you an order of what API’s you need to call, and what data you need to parameterise and pass from one request to the next to get an end to end test.

It will show the headers and anything else that is needed for you to re-create the request in Postman. (Or speak to a DEV if possible that can explain how the API was built and what the request needs, which I’m assuming is some sort of GET for the next step).

Thankyou @michaelderekjones !!Really appreciate for your time to look into this
I think I found out the issue - I had to remove the auth on the send request where it will get the file from a location
This is resolved now but the next challenge is
I can only hit the ‘send and download’ or ‘Save as a file’ manually on each request but not sure how to automate it within postman when running as a collection can be done

If you use the capture requests feature, and then click on “send and download”, it will record what operation is sent to the browser so you can add this as the next request in your collection.

Capture requests will record all of the http requests. GET, POST, PUT, DELETE, etc.

Does that capture the Postman request because i’m trying to ask automating about the ‘Send and download’/‘Save as file’ in postman

It will capture all of your browser activity until you stop the capture.

Anything you do in the browser will be captured in Postman.

However reading back through your responses. Are you talking about saving a Postman request response to a file?

You mention you want to use it in the next request which should then generate an excel file. So I assumed it was something in the response that you wanted to write to a variable so it could be used in another GET request which actually gets the Excel file.

If you save the file you have in your screenshot, it will save a json file (which is the response format within the screenshot).

If you click on the link in the resourcePath, I’m assuming it will actually create a GET request to the endpoint\server and as it looks like a working URL, I suspect it will actually try and open the link.

Yes exactly I was talking about saving the postman request from the last step(clicking on url - get request) response to a file (which is an excel file)

It sounds like you need to retrieve certain elements from the response, not the whole response to use in the next GET request.

Do you know what the next GET request requires? Headers, body, etc?

If you don’t, then that is where the capture requests come in, and it should record what happens when you do click on the link, including the headers so you can create the GET request as the next step in your collection.

Have a look at the following stream.

You don’t need to review the whole stream, but the first half gives a good example of using Capture requests within Postman. The second part shows how to perform similar tests at the UI level using Cypress, which is also interesting, but you can skip that part if you want.

Frontend and API Testing Using Cypress and Postman - Postman news - Postman

:pray:Thankyou !Sure will look into this