As a part of Postman Tutorial – End to End , in this post, we will learn how can we upload an image using Postman or Perform Upload API testing using Postman.

Sample API:-

We will use Upload Image API provided by Imgur API.

If you see Upload Image API documentation, you will need below details to use API:-

Generating Client ID:-

You can get client id by Registering at Imgur site. Once you register, you need to Add an App. After that you can see your Client id as below:-

Creating Request in Postman:-

We have below things ready:-

URI:- https://api.imgur.com/3/upload

HTTP Verb :- POST

Client ID :- You know how to get.

Fields in Body :- See above image.

Let’s launch Postman app now and add URI and select POST method. We are expert in that now. If not, refer this article.

There is a different style to pass body to upload API. In normal POST request, we generally pass a JSON body by selecting “row” radio button under “Body” tab. In Upload API, we need to pass body by selecting “form-data” radio button. You can also notice the word “BODY formdata” in API documentation above.

Now you need to pass field values as shown in API documentation:-

Let’s first pass “image” field. Type key as “image” and remove focus from key field to save. 

Now mouse hover on “image” field, You should see a dropdown as below:-

When you click on drop down, you will see two options. Select “File” from that.

Once you select “File“, you will see a button to select image as shown below:-

Now click on “Select Files” control and Select the file. You will see file name as value.

Other fields are optional but we will pass “title” and “description” as below:-

We need to pass Client ID as an Authorization header as per API documentation shown above.

We are all set to upload image now. Click on Send button. You should see the response as below:-

You will see a field named “link” in JSON response. WHen you hit the URL in browser, you will see same uploaded image.

You can import above example collection from here. Do not forget to generate your client id and pass in Header tab.

You can find all Selenium related post here.
You can find all API manual and automation related posts here.
You can find frequently asked Java Programs here.

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

Leave a Reply