Help with paramertization

I have a request and I want to parameterize some fields in the Body, below is an example. I appreciate any help.

Request:
http://website/request

Body: (I want to parametrize the first and last names only)
request": {
“FirstName”: “{{chris}}”,
“LastName”: “{{tom}}”,
“Email”: “ctom@company.net”,

Hi Chris,

The way you have that setup should work fine:

Body:

{
"FirstName":"{{first_name}}",
"LastName":"{{last_name}}"
}

You then just need to add first_name and last_name as variables either:

  • In an Environment
  • As Global Variables

See Intro to environments and globals on our Learning Center for more info.

You can also set them programmatically from the Sandbox, using pm.variables.set('name','value'). This will declare a run-scoped variable with whatever value you want — useful when you need to set this value based on (e.g.) response data from another request.

Hi JP,

I appreciate your help.

  1. I read the Postman article on parameterization and I was hoping to use the Collection Runner with a CVS/JSON file that contains my test data.

  2. I can’t test our API yet as it’s still being worked on so I’m wondering if there’s a public API GET request with a payload that I could use to play around with?

Happy I could help!

Yep! Try Postman Echo: https://docs.postman-echo.com/

Hey John, I believe I finally got the parametrization working. What I’d like to do next is see which row is being used for each run. Using the CSV File example below, when I use the Collection Runner, in the output, I’d like to see something like “Test Data: InvalidEmail.”

If you know of a better way to do this then plz let me know.

CSV File:
LOEmail,BranchNumber,AppId,BorrowerFirstName,BorrowerLastName
HappyPath,srao@company.com,331,9464099213815567,Chris,rao
InvalidEmail,srao@company.net,331,9464099213815567,Chris,rao