Hi All,
I have a project where I need to use postman runner to โPOSTโ values from a data file to an API endpoint of a service provider.
Below is how my JSON data file is structured
[{
"name": "Example",
"custom_fields": {
"account_number": "Example",
"street": "Example",
"city": "Example",
"state": "Example",
"country": "Example",
"zip": "Example",
"phone": "Example",
"website": "http://www.Example.com"
}
}]
My Post request is set to use the body as raw and is structured like this
{
"name": "{{name}}",
"custom_fields": {
"account_number": "{{custom_fields.account_number}}",
"street": "{{custom_fields.street}}",
"city": "{{custom_fields.city}}",
"state": "{{custom_fields.state}}",
"country": "{{custom_fields.country}}",
"zip": "{{custom_fields.zip}}",
"phone": "{{custom_fields.phone}}",
"website": "{{custom_fields.website}}"
}
}
When I run this through runner it pulls the account name {{name}} correctly but anything which is in the JSON array custom_fields just shows up as {{custom_fields.xxxxx}}
Below is what is shown in the body of the runner request
{
"name": "Example",
"custom_fields": {
"account_number": "{{custom_fields.account_number}}",
"street": "{{custom_fields.street}}",
"city": "{{custom_fields.city}}",
"state": "{{custom_fields.state}}",
"country": "{{custom_fields.country}}",
"zip": "{{custom_fields.zip}}",
"phone": "{{custom_fields.phone}}",
"website": "{{custom_fields.website}}"
}
}
Am I using runner incorrectly for what I want to achieve here?
How can I post the fields in the custom_fields array using runner?