Here we will see 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 file to remote server.
We have other REST client extensions in Chrome and Firefox browsers but these extensions do not allow to test our 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 file
We will see here an example how to call file upload REST API using Postman.
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 Choose Files button. So select your file and hit the Send button.
The main 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.
Thanks for reading.