Binary mode file upload with newman iterationData

Hello,

I have an API that has a PUT endpoint that allows uploading any binary files to a cloud storage location.

This API does not support form-data, only binary. If I use postman, and switch to binary mode in the request body and select a local file, the file is uploaded successfully.

My issue is that I need to upload multiple files so I started looking into running this test using newman with a data file (iterationData). Because the filename and filepath vary for each iteration, I cannot select a binary file in the body, and was hoping that I could use raw body with a JSON with body.mode = “file” and body.src = “filepath/filename”. I can upload successfully, but my issue is that the file uploaded is the body json and not the actual binary file specified in body.src that resides in my local disk.

Has anyone any suggestions for me to try? Again, this API does NOT support form-data.

Thank you!

For those running into similar issues, the key is to edit the postman collection JSON in your favorite text editor and set the PUT request body to:

"request": { "method": "PUT", "body": { "mode": "file", "file": { "src": "{{object_src}}" } }, ...

Next is to edit your iteration data JSON file to be an array of JSON objects with an object_src property pointing to the path on your local disc for the file you’re trying to upload.

There is no way to achieve similar results from the Postman interface itself.