Skip to content

How To Use Postman In Google Chrome

API Testing Blog

Installing Postman on Chrome

Postman is not directly installed on Google Chrome. It is a separate application that integrates with the Chrome browser. It’s available as a browser extension and a standalone desktop app. Here’s how to get it:

  1. Install the Postman Chrome Extension: Visit the Chrome Web Store and search for “Postman.”
  2. Click the “Add to Chrome” button. The extension will then be installed in your browser.

Setting up Your First Request

Creating a New Request

  1. Open Postman: Click the Postman icon in your Chrome toolbar.
  2. Create a New Request: Click the “New” button (the blue plus icon) to create a new request.

Request Methods

  • GET: Retrieves data from a server.
  • POST: Sends data to a server to create a new resource.
  • PUT: Updates an existing resource on the server.
  • DELETE: Removes a resource from the server.

Entering the Request URL

  1. Enter the API endpoint: In the “Request URL” field, enter the URL of the API you want to test. For example: https://reqres.in/api/users

Adding Headers

  • Click on the “Headers” tab.
  • Enter the key and value for each header. Headers provide additional information about the request. Example:
Key: Content-Type
Value: application/json

Adding the Request Body

For POST, PUT requests, you may need to provide data in the request body.

  • Click on the “Body” tab.
  • Choose the appropriate format:
    • Raw: For unformatted data (e.g., JSON, XML).
    • form-data: For sending form data.
    • x-www-form-urlencoded: For sending form data in URL-encoded format.

Example JSON Request Body:

{
"name": "Morpheus",
"job": "Leader"
}

Sending the Request

  • Click the “Send” button.

Understanding the Response

  • Status Code: Indicates the success or failure of the request.
  • Response Headers: Provide information about the response, such as content type and encoding.
  • Response Body: Contains the data returned by the server.

Example Response Body (JSON):

{
"name": "Morpheus",
"job": "Leader",
"id": 1,
"createdAt": "2022-08-13T14:59:11.693Z"
}

Working with Collections

Organising Requests into Collections

  • Create a new collection: Click the “Collections” tab, then “Create Collection.”
  • Add requests to the collection: Drag and drop requests from the “Requests” tab into your new collection.
  • Running Collections: Run a complete sequence of test cases by using the “Runner” feature.

Postman’s Features for API Testing

Assertions

  • Verify Response Data: Use “Tests” tab to add assertions to verify the expected values in the response using JavaScript code.
  • Example Assertion:
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});

Environments

  • Store API Credentials: Create separate environments to manage different configurations (URLs, API keys, etc.) for different projects or environments.

Mock Servers

  • Simulate Backend Services: Create mock servers to test your application before real backend APIs are available.

Using Postman Effectively

  • Automate Your Tests: Integrate Postman with CI/CD tools like Jenkins to run tests automatically.
  • Collaborate with Teams: Share collections and environments with your team members.
  • Explore Advanced Features: Discover other advanced features like:
    • Pre-request Scripts: Automatically execute JavaScript code before a request is sent.
    • Test Suites: Organize tests into suites for better management.
    • Webhooks: Trigger actions in external services based on test results.

By mastering these core features, you’ll be able to use Postman to streamline your API testing workflow and ensure the quality of your applications.

API Testing Blog