Testing API with Postman, API
What is API?
API stands for Application Programming Interface, which helps different application softwares to be in contact with each other. When a developer uses the API when creating or developing an application software, it helps to save time and energy. At the same time, control access to resources and communication between services can be provided by using API.
Why use Postman?
Let's have a look at Postman:
Postman is a tool that allows you to test your APIs easily without the need for long codes and prepare your API documentation. It can also be called as rest client. Postman can also be used as a plug-in for Chrome.
You can add Postman to Chrome as a plug-in from this link.
For API testing, Postman must be downloaded first. So install it from here before you start.
Using Postman for Testing API
First, there must be a collection as indicated in the screenshot below. If it is to be created for the first time, it can be created from the pop-up window as below. Select "Collection" under the "Create New" section.
On the other hand, if you already have a "collection" and the "environment", you can skip this section.
Now, we can start creating our request by clicking the "New" button.
We see the window in the first photo and now we click on the "Request" under the "Create New" part.
Then, the method of request can be chosen.
Authorization, Header, Body information settings are arranged according to API calling method.
Finally, you can submit your request by clicking the "Send" button and you will see the results as shown in the screenshot below.
The status code called as "200 (2xx)" results in the Status field indicate that the test was correct. In Time part you can see how long the process took place and in Size part you can see the size of the process.
You can change the type and appearance of the result from the upper left part as you want.
Other results and their meanings in the "Status":
- 201 — Successful request, data was created.
- 204 — Empty response.
- 400 — Bad Request. The request couldn't be understood or some required parameters are missing.
- 401 — Unauthorized access. Authentication failed or the user doesn't have the permission for the request.
- 403 — Forbidden or access denied.
- 404 — Data not found.
- 405 — Method isn't allowed or the requested method is unsupported.
- 500 — Internal server error.
- 503 — Unavailable service .
image4io uses Postman to test its API. This tool is based on user-experience and it can be used easily to see the outputs.