What I have done is place the file I need to download in an env file, along with other variables I need set. For example:
ENV file:
{
“id”: “f63730ed-92e7-f8a8-fb8b-005993bd5197”,
“name”: “local”,
“values”: [
{
“enabled”: true,
“key”: “server”,
“value”: “https://192.168.77.158:443”,
“type”: “text”
},
{
“enabled”: true,
“key”: “version”,
“value”: “1”,
“type”: “text”
},
{
“enabled”: true,
“key”: “file_to_upload_env”,
“value”: “CSdev.apk”,
“type”: “text”
},
{
“enabled”: true,
“key”: “application_id_ref_env”,
“value”: “8870087b359399d6f22a249e7c6342f5”,
“type”: “text”
},
{
“enabled”: true,
“key”: “platform_type_env”,
“value”: “android”,
“type”: “text”
}
],
“timestamp”: 1519766311494,
“_postman_variable_scope”: “environment”,
“_postman_exported_at”: “2018-03-01T20:37:16.339Z”,
“_postman_exported_using”: “Postman/5.5.2”
}
I then exported my Collection from Postman. In the exported JSON file I substitute the “*_env” files above into the JSON (i.e. . This then allows me to run the collection from Newman. The only negative is I need an env file for each file I am operating on, so I wrap the Newman CLI with a shell script that invokes each env file.
In the collection file for example:
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "app",
"src": "{{file_to_upload_env}}",
"description": "IPA / APK / Other",
"type": "file"
}
]
},
If I could iterate I would not need to have multiple environment files.