Search code examples
postmanpostman-collection-runner

How can I use a data variable within a postman endpoint URL that is not a query parameter?


I have an endpoint URL such as https://example.com/{{variable}}.json . I would like to use Collection Runner in Postman to run multiple requests to that endpoint, and upload a CSV file with multiple IDs to appear in place of that variable in the endpoint URL.

I can do this if the variable appears in the body of the request or within query parameters, but I cannot figure out how to do this if the variable is placed in the URL itself in this format.

If I use a collection/environment/global variable, it simply places the saved data into the URL, rather than data from the uploaded CSV using Collection Runner.


Solution

  • Make sure you are having variable in the first row of your csv file as below. and remove variable from your collection/environment/global variables.

    variable
    123 
    456 
    789
    

    In postman runner, select the collection and load the csv file in data, set the iterations to the required number.

    Now when you run the collection, each iteration will take a new value from the csv file.

    Refer this blog for a detailed explanation.