Skip to content

How To Use Postman Native App

API Testing Blog

Getting Started with the Postman Native App

The Postman native app is a powerful tool for API testing, offering a user-friendly interface and extensive features. This guide will walk you through the basics of using the Postman app, from setting up requests to managing collections and environments.

1. Installation and Setup

The Postman native app is available for download on Windows, macOS, and Linux operating systems. You can download the latest version from the Postman website. Once you’ve installed the app, you can sign in using your Postman account or create a new account.

2. Creating Your First Request

To start testing an API, you need to create a request. Here’s how to build a basic GET request:

  1. Open the Postman App: Launch the Postman app.
  2. Create a New Request: Click on the “New” button in the top left corner of the app.
  3. Select Request Type: Choose “GET” from the drop-down list.
  4. Enter Request URL: In the “Enter request URL” field, type the API endpoint you want to test. For example, https://api.example.com/users.
  5. Send the Request: Click the “Send” button.

3. Viewing Response Data

After you send a request, Postman displays the response details in the right panel. This includes:

  • Status Code: Indicates the success or failure of the request (e.g., 200 OK, 404 Not Found).
  • Headers: Key-value pairs that provide additional information about the response.
  • Body: The content of the response, which can be in various formats like JSON, XML, or plain text.

4. Using Parameters and Headers

You can customize requests by adding parameters and headers:

  1. Parameters: Click the “Params” tab and add key-value pairs to send data with the request.
  2. Headers: Click the “Headers” tab and add key-value pairs to modify request headers.

Example:

Request URL: https://api.example.com/users?page=2

Headers:

Authorization: Bearer <your_token>
Content-Type: application/json

5. Working with Collections

Collections help you organize and manage multiple requests. You can create collections to test different API endpoints or workflows.

  1. Create a Collection: Click the “Collections” button in the left sidebar and select “Create Collection.”
  2. Add Requests to Collections: Drag and drop requests into the collection or click the “Add Request” button.
  3. Run Collections: Click the “Run” button within a collection to execute all requests in order.

6. Using Environments

Environments enable you to manage different API configurations, such as base URLs and authentication tokens, in different environments (e.g., development, testing, production).

  1. Create an Environment: Click the “Environments” button in the left sidebar and select “Create Environment.”
  2. Add Variables: Define key-value pairs for variables like base URLs, API keys, and other sensitive data.
  3. Select Environments: Choose the appropriate environment for your request from the “Environment” dropdown in the top right corner.

Example:

Development Environment:

{{base_url}} = "https://api.example.com/dev"
{{api_key}} = "dev_api_key"

Production Environment:

{{base_url}} = "https://api.example.com/prod"
{{api_key}} = "prod_api_key"

7. Advanced Testing Techniques

Beyond basic requests and response analysis, Postman offers advanced features for comprehensive API testing:

  • Test Scripts: Write Javascript tests to validate response data and API behavior.
  • Pre-Request Scripts: Execute custom scripts before sending a request to modify request data or headers.
  • Assertions: Define expectations for response parameters and validate them during testing.
  • Mock Servers: Simulate API responses for testing purposes without relying on actual backend servers.

Example:

Test Script:

pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("Response body contains 'success'", function () {
pm.expect(pm.response.text()).to.include('success');
});

8. Managing Your Workspaces

Workspaces provide a collaborative environment for team members to share collections, environments, and other resources.

  1. Create a Workspace: Navigate to the “Workspaces” section in the left sidebar and create a workspace.
  2. Invite Team Members: Invite colleagues to join your workspace.
  3. Share Resources: Share collections, environments, and other assets with your team.

By following these steps and exploring Postman’s features, you can leverage the app to efficiently test APIs and ensure the quality of your applications.

API Testing Blog