Capturing data from Multiple path variables

I have an endpoint: https://myendpoint.com/“product_id” and in the response is an “inStock” response with the value “Yes” or “No”.

I’ve been able to work out how to return the data for one “product_id” I need using bodyData etc in the Tests tab.

What I would like to do is to be able to return those systematically for different “product_id” - can this be done with a path variable and a CSV upload in Runner?

I know all the product numbers so could type them all in manually to return the value, but would like to know it there is someway to return the GET call data automatically by supplying all the URL variables in one file and having Postman iterate though each.

The console response would look something like:

GET https://myendpoint.com/10008
Yes

GET https://myendpoint.com/10009
No

I have looked at multiple tutorials, but they all seem to deal with variables that are being POST via the call rather than retrieving multiple endpoints.

In short, I would like to call multiple unique API URLS and retain one specific value in the body data for each URL

Thanks

     https://myendpoint.com/{{Id}}

What stops you from using variable in url

Right! So I can do that and set an initial variable value, my question now is how do I supply the list of additional value variables for each call?

Is it a CSV with ‘Id’ as a column and just all the ids comma separated?

E: id1, id2, id3

Thank you!

@allpointsnorth, no the column name should be Id and the rows should have different values so that every value is picked for different run.

image

And this file will go as input for your collection runner :blush:

Please let us know if this still doesn’t fulfil your request.

2 Likes

Ahh! Amazing, thank you! That worked perfectly!

Thank you @bpricilla and @praveendvd

1 Like

Hi @allpointsnorth ,

I see you got a solution to the problem. I’m having a similar problem but I’m not able to resolve following your process. Please advice
 How did you set your variables to connect to the CSV data file. Please help!

@bpricilla @praveendvd
Please help!

You just have to add the csv as datafile when u use collection runner or newman . The mapping of column name as variable is done automatically . you dont have to do anything :tada: