Blog 6 – API Testing Tool


Today I want to talk about my experience using the Postman tool to test API.  I am taking CS493 Cloud application development along with the CS467 Capstone class this quarter. This blog would be served as a reflection of my learning experience.

Before I took this class, I barely paid any attention to APIs or URLs, whether it is RESTful or not, etc. What do the words on URL mean, whether it meant to transfer or share data or to delete them?

In this blog, I would like to go over how to use Postman to test APIs for your work on Github.

There are four types of API requests: POST, GET, PATCH, PUT and DELETE.

POST is for the creation of a certain item, for example, if you want to create a gist on your GitHub account you would like to put POST at the beginning of your URL, and enter the web URL after the POST. See the picture below:

After the request body is entered as JSON, it would be sent to the designated website. And after the request is successfully accepted, the status code would show 201 successes. To validate that, you can enter the test code in Postman Tests tab, when executed, it would either give you green light or red light, with green light showing success and red light indicating test failure.

After your creation of the object, you may edit it. In order to edit, you can choose whether to edit completely – PUT (all attributes are getting edited), or edit it partially – PATCH.

To view your existing creation, you can use GET method prior to your targeted URL, and put your GitHub id following it, as follows:

I wrote my test to validate whether or not the current number of gists is 22 in my GitHub account.

After you are done, you may delete your gist by using the DELETE method, to verify whether the delete is successful, I would test if the status code is 204, if it is 204 it means it is successful. Failure to delete would give the user a 401 code meaning bad credentials or bad requests.

If you want to know more about postman testing, I recommend the following website, I found it very clear and helpful:

https://learning.postman.com/docs/sending-requests/requests/

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *