Search code examples
arraysrestpostman

Postman Chrome: how to use variables from an array for the URL


Sorry to bother you, but I really would use some help on the below:

I am using Postman Chrome extension against an Rest API. My URI is like the following and the request type is PUT:

PUT https://{{api-fqdn}}/some/path/to/something/ROLE111

I have about 100 roles with different names.

Instead of passing each time different role name at the end of the URI, how could I use Postman to scan an array and replace all the values inside using a variable, such as {{rolename}}?


Solution

  • Take a look at using the native Postman app with the Collection Runner. You can create a data file (either JSON or CSV) with your different role names, The runner will replace that variable placeholder with the data from the file.

    More info can be found here: https://learning.postman.com/docs/postman/collection-runs/working-with-data-files/