Postman test multi-images API endpoint

Brian Mutinda
3 min readSep 14, 2022

--

Laptop on a desk
Photo by Christopher Gower on Unsplash

I am a mobile developer and I deal with a lot of API endpoint integrations therefore I’ll spend a bit of time testing endpoints with postman.

One of the troubles I had was testing how to send multiple images through postman for an API created in Laravel (PHP Framework) that required images inform of an array. (Here is the link to the backend repo if you are curious)

Below is a list of steps on how I did it and how you can achieve it too.

Step 1: Setup

Under the “body” section select “form-data” as shown below.

Post request body section

Step 2: Fields

Set the request field name / variable (that will contain the images) in my case the name is “fileName” and make sure to select field type as “file” type on the drop down as shown below.

Set variable / request field name

Note: I added “[]” on “fileName” field, this is essential on Laravel as the data will be treated as an array / collection. This is very important before you proceed.

Step 3: Final step

Tap on “Select Files” as shown below.

Upload files

Once your files interface is open select as many files as you need. (On Linux and windows long press CTRL + right click to highlight and select multiple files. On Mac I think you have to long press Command to select multiple files).

In my case I selected 2 files as shown below. When you select multiple files the number of files is shown instead of the name of the individual files.

Number of files selected

It’s that simple. Comment below if this tutorial has been helpful to you.

Happy coding and testing.

If you find this article interesting or helpful and want to say thanks, you can buy me a coffee. Any amount is appreciated.

You will not only keep me caffeinated but motivated to produce more content.

Thank you so much for your consideration.

--

--

Brian Mutinda

Flutter (mobile application) developer sharing my knowledge, expertise, life experiences and discoveries with the world through writing.