Use variable in request URL?

My request URL is:
https://api.limblecmms.com:443/v2/assets/{{assetID}}/fields

I created ‘assetID’ as a variable in the URL. How can I use the Pre-Request Script to make this iterate thru a list of integers as variable ‘assetID’?

For example… I want assetID = 10, 11, 12, 13, 14, 15.

Hey @lewism1992 :wave:

Welcome to the Postman Community! :postman:

What have you tried so far? Are you looking to use a datefile with the Runner or are you trying to achieve this in a different way?

Hello Danny,

Honestly, I’m not quite sure. Postman was brand new to me only a few days ago, so I am unfamiliar with a Runner and datefile. What do you recommend?

I was hoping that I could write a simple For loop to iterate thru integers…

There are a number of ways that it could be done, both with and without the Runner.

Using a datafile (Either a JSON or CSV) which holds the values you would like to iterate over would be easier without needing to create any scripts.

The column name in the CSV or the object key in the JSON file will be the same name as your {{assetID}} placeholder variable. Each iteration would use a new value in the request URL and replace the variable.

I’ve attached the doc from the learning center but i’m happy to go through any follow up questions you may have: