Basics of API Testing Using Postman
APIs(Application Programming Interfaces) are very commonly used in development. Postman is a tool that can be used for API Testing. In this article, we will learn how to do simple API Testing using Postman.
- Go to your workspace in Postman.
- Click on the + symbol to open a new tab.
- Enter the API Endpoint where it says, “Enter request URL” and select the method (action type GET, POST, etc.) for that request as shown below.
- Click on the Send button.
Now as you can see in the tab below, the response received from the API is shown along with the status 200 which implies that the request has succeeded.
For a post method, you can also specify the body of the request in any of the formats listed.
- Select method as POST and write the request URL.
- In this example, we will be sending request data in JSON format. For this, Go to Body and select raw from the radio buttons listed. Then, select JSON.
- Write the request body(you can also enter headers if required) and hit Send.
As you can see in the image above, status 201 is received implying that the request was successful and the resource has been created. More information related to the API call can be found under the “Headers”. You can also save the request by clicking on the save button and adding it to a collection in Postman.