Mapping CSV values to variables


#1

Hello all. First post here. I’m pretty new to working with APIs and am running into an issue. I have a CSV of values that I would like to map into a variable called sitename. The logic I have in mind is: Map value 1 into variable -> POST -> map value 2 into variable -> POST -> etc. etc. I’ve been trying to do this in collection runner but have yet to get it to properly fill. Here is the full JSON of my request:

{
“profile”: {
“name”: “{{sitename}}”,
“description”: “Members of this group can access resources at the {{sitename}} site.”
}
}

Any help would be greatly appreciated!


#2

Looks good so far!

What does your CSV look like? If you’re using sitename as the variable in your body, you must use sitename as your CSV column header, so at the most basic level your CSV might look like:

sitename
abc
def
ghi
jkl

This will iterate 4 times and swap out the value each time for the next row.

The documentation adds some extra context too:
https://learning.getpostman.com/docs/postman/collection_runs/working_with_data_files/#working-with-the-sample-files