Here I will show you how to call file upload REST API using Postman. Postman is a very popular REST client tool which is used to test your REST services. It is also used to test your REST service which uploads a single file or multiple files to remote server.
There are other REST client extensions in Chrome and Firefox browsers but these extensions do not allow to test your file upload REST services. Even you can use Curl command or any other clients to test your file upload service.
REST service or API that uploads a single file or multiple files, Postman tool
Call File Upload REST API
I am going to show you here an example how to call file upload REST API using Postman.
The REST service that allows single or multiple files to be uploaded can be written in any programming languages. Only thing you need to make sure is while you want to upload multiple files you need to hold Ctrl key (on Windows OS) for selecting multiple files using browse or Select Files button.
Make sure you have the Postman tool installed in your system.
Next open the Postman tool and follow the instructions given below to test file upload REST service.
- Select HTTP method type as POST.
- Enter the file upload REST service URL in the input field on the right side of the above method.
- Next select Body -> form-data.
- Now input your file parameter name for the Key. On the right side column you will see a pale-grey-on-white dropdown for File with two options – File and Text. Select option File.
- Next you will get Select Files button. So select your file and hit the Send button. If your REST service supports multiple files upload then you can select multiple files for upload.
The important areas have been highlighted in the below image:
Be careful with explicit Content-Type header and let the Postman fill this header for you. But, if you want to set the
Content-Type: multipart/form-data, then you need to set the boundary field correctly.
Hope you got an idea how to call file upload REST service using Postman.