How to pass APIs URL from file to postman

Hello,
i am exploring postman from couple of weeks still new for me. i am curious if i can perform below task with post man or no ?
I have 500 API in file. i need to pass each of them and check status code.
Please help.

Assuming you are using a csv/json file, in your prerequest script you can do:

pm.request.url = pm.iterationData.get('<name of column with your url>');

This will set the url for the request.
If you also need to set the method, you can do the same thing

pm.request.method = pm.iterationData.get('<name of column with the http method>');
1 Like

Thank you for prompt response @allenheltondev
i wrote same script in prerequest and i have csv file with column name as “URL” i have selected that file while i run collection in runner, but What to put in Request url ? should i create variable of url ? without it console shows request url is empty.

for every run it should read url from file.

You could make it a variable, sure. If you did that, it actually would make my suggestion even simpler.

Instead of what I had suggested, you should be able to just pass the url variable directly in there.

image

1 Like