I am trying to create a collection that will upload images and be able to run it in multiple iterations and want to use newman to run it.
For our API it only supports uploading images through using binary data.
https://www.getpostman.com/docs/requests - Postman does not support saving the files for both form-data and binary.
https://www.getpostman.com/docs/run_file_post_requests - They show how you can upload images with Newman using form-data, but not for binary.
Is it possible to use newman with binary image upload?
here is what you need in your request. I had to modify the src from the saved collection
{
"name": "Room Document",
"request": {
"url": "{{url}}/api/v1/folders/321/documents",
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "3242349-324432-23423423-23424",
"description": ""
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "file",
"type": "file",
"src": "blank.pdf"
}
]
},
"description": " "
},
"response": []
},
I used it like this which worked with the binary:
"body": {
"mode": "file",
"file": {
"src": "path/to/your/file.jpg"
}
}
That way you dont have to set the KEY, Type and so on. But you need to set it within the Header as
Content-Disposition: attachment; filename="file.jpg"
and in our case with
Content-Type: application/octet-stream
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With