Postman Challenge: Day 1 - API Client

Postman Challenge: Day 1 - API Client

Postman, a widely popular API testing tool, has launched the "15 days of Postman - for testers" challenge. This challenge consists of 15 different API testing tasks and challenges designed to elevate your testing prowess. By successfully completing all tasks, you'll earn a prestigious badge to showcase your achievement. Let's embark on this journey together and conquer each challenge over the next 15 days.

This challenge is designed for intermediate level of testers which means basic knowledge of Postman is required. Postman has also provided an introductory video on YouTube to guide through the challenge.

Getting Started

  • First login to your Postman account or signup for a free account if you don't have one. Now we will create a public workspace in Postman. Make sure you keep it public so you are eligible to validate your submissions and receive badge.

Create Workspace

  • Your workspace name must be unique, otherwise it will result failure of test cases when we try to submit our daily challenges.
  • Now head over to the "15 days of Postman - for testers" workspace and let's fork our Day 1 challenge.

Create a Fork

Day 1 Task - API Client

Now we have all set to begin our challenge, so let's head over to our workspace where we have forked the task and go to the first folder "API Client" and read the documentation which cover instructions, learning objectives and concepts covered.

  • According to instructions, we need to copy the cURL request mentioned in the plain text format and import it to our collection.
  • So let's click on Import button on top of the side bar and paste the cURL request.
  • This will convert a API request payload from plain text to Postman request. Let's save it with CTRL/CMD + S and save it under API Client Folder. We will also rename the request as echo as per the instructions. You can click on the request name to rename it.
  • Let's follow the instructions and review and send the request and learn about HTTP request method, Request URL, Request body, Sending the request, Checking the response for HTTP status code, Response time, Response size and Response body.
    Postman Screen
  • To fulfill the test requirement, we need to change the default text of the payload from "Hello world!" and change it to our own text. I have changed it to "Hello from QA Club!".
  • Now we are at half way of our challenge and need to validate and submit our task.

Preparation for the Solution

  • In order to submit the solution we have completed above, we need to submit our collection as well as workspace and Postman pre-generated tests will validate it whether we have submitted the correct solution or not.
  • Both of this endpoints requires to have valid postman_api_key submitted as a Header to authorize the request.

Generating an API Key

  • To generate a Postman API Key, click on your user avatar on top right of the Postman Screen and click on Settings.
  • Click on API Keys -> Generate API Key
  • Copy and store it at safe place as we will not be able to copy it again.

Setting up Environment

  • As we are going to use some variables to use it in out collection, it's good practice to store collection variables in a separate environment and use it accordingly.
  • So let's head over to Environment tab in the left sidebar and then click on + sign to Create a new Environment and give the name.
  • Let's create a new variable type secret in the environment called postman_api_key and paste the API key we have generated earlier. Now whenever we want to access the postman_api_key within collection, we can use {{postman_api_key}} instead of typing loooooong hash values every single time.
  • This also applicable for any other variables we want to use.
  • Now let's go back to our collection, and select the active environment from the top right drop down and select our environment. Without this action, environment and it's variables are still unknown to the collection.
  • Alternatively, we can also store variables as collection variables by clicking on collection name, and selecting variables tab. In this case, scope of the variables will be limited to that particular collection and cannot be accessed outside of this collection. As we want to use this environment for other challenges as well, we are going to prefer the environment variables rather than collection variables.

Getting the Collection ID and Workspace ID

  • To submit the solution, we need to provide our collection_uid and workspace_id which we can store in as variables in our environment, so when we send the request, it will pass the values from there.
  • Collection ID: To get the collection ID, click on your collection name and then click on i information icon on the right side bar.
    Collection ID
  • Workspace ID: To get the workspace ID, click on the workspace name and click on the i information icon on the top right corner.
    Workspace ID

Submit the Solution

  • Now we are ready to submit the solution. Let's double check that we have all variables in place like collection id, workspace id and postman api key.
  • Once we have all shorted out, let's send the first request for submit collection and make sure we have all tests passing.
    Submit the collection
  • Now same way, will run send our final request to submit the workspace and also double check all tests are passing.

Whoo-hoo! Congratulations! You've completed the Day 1 challenge. Stay tuned for Day 2, and happy testing!