SDKs overview

Postman offers software development kits (SDKs) and libraries designed to extend its API development and testing capabilities programmatically. While Postman itself is primarily a graphical user interface (GUI) application for designing, testing, and documenting APIs, its SDKs facilitate automation, integration into CI/CD pipelines, and advanced scripting. The core official SDK is Newman, a Node.js-based command-line collection runner for Postman collections. Beyond official tooling, the platform's extensive usage has fostered a variety of community-contributed libraries that interact with Postman's ecosystem or complement its functionalities. These tools enable developers to manage collections, environments, and API requests outside the Postman application, enhancing workflow flexibility and enabling headless execution of API tests.

The Postman platform also exposes a comprehensive Workspace and Team API, allowing programmatic interaction with Postman data, including collections, environments, mocks, and monitors. This API itself serves as a foundation for building custom integrations and tools, though it requires direct HTTP requests rather than a dedicated client library from Postman. The focus of Postman's official SDK strategy is on enabling automation and headless operation of existing Postman assets, particularly through Newman, which is critical for continuous integration and automated testing workflows.

Official SDKs by language

Postman's primary official SDK is Newman, a command-line collection runner. It is developed and maintained by Postman and is central to automating API testing and integrating Postman workflows into development pipelines. While Postman supports various API types like REST, GraphQL, and SOAP within its application, Newman specifically targets the execution of Postman Collections. Other languages do not have official, dedicated SDKs from Postman for client-side API interaction with the Postman platform itself, beyond direct use of the Postman API via standard HTTP libraries.

The following table summarizes the key official SDK:

Language Package Name Description Maturity
Node.js newman Command-line collection runner for Postman. Executes collections saved in JSON format. Supports reporters, data files, and environment variables. Stable, actively maintained

Newman functions by taking a Postman Collection exported as a JSON file and running all its requests sequentially or based on defined workflows. It can also integrate with environment files and data files to provide dynamic testing capabilities, making it a versatile tool for automated API testing within a CI/CD pipeline, such as with AWS CodeBuild or Google Cloud Build.

Installation

The installation process for Newman, Postman's official command-line collection runner, primarily involves Node.js and its package manager, npm. Before installation, ensure Node.js is installed on your system. You can verify this by running node -v and npm -v in your terminal.

Newman (Node.js)

Prerequisites:

  • Node.js (LTS version recommended)
  • npm (Node Package Manager, typically bundled with Node.js)

Installation steps:

  1. Open your terminal or command prompt.

  2. Install Newman globally using npm:

    npm install -g newman

    The -g flag ensures Newman is installed globally, making it accessible from any directory in your command line.

  3. Verify the installation by checking the Newman version:

    newman -v

    This command should output the installed Newman version, confirming successful installation.

For more advanced usage and configuration, refer to the official Newman documentation.

Quickstart example

This quickstart demonstrates how to run a Postman Collection using Newman from the command line. This example assumes you have an exported Postman Collection JSON file (e.g., MyCollection.json) and optionally an environment file (e.g., MyEnvironment.json).

1. Export your Postman Collection

In the Postman desktop or web application:

  1. Open the desired collection.
  2. Click the ... (more actions) icon.
  3. Select Export.
  4. Choose the recommended collection format (e.g., Collection v2.1) and save the JSON file (e.g., my_api_collection.json).
  5. (Optional) If your collection uses environment variables, export your environment in a similar way (e.g., my_environment.json).

2. Run the collection with Newman

Open your terminal or command prompt, navigate to the directory where you saved your JSON files, and execute the following command:

newman run my_api_collection.json -e my_environment.json -r cli,htmlextra

Explanation of command-line options:

  • newman run my_api_collection.json: This is the basic command to execute the specified Postman Collection.
  • -e my_environment.json: (Optional) Specifies an environment file to use during the collection run. This allows you to define variables that your requests can access.
  • -r cli,htmlextra: Specifies the reporters to use.
    • cli: Provides a summary of the run directly in the command line.
    • htmlextra: Generates a detailed, human-readable HTML report in the newman directory, useful for sharing or archival. You may need to install newman-reporter-htmlextra separately using npm install -g newman-reporter-htmlextra.

After execution, Newman will output the test results to the console (due to the cli reporter) and generate an HTML report (if htmlextra is used). This demonstrates a fundamental use case for Newman in continuous integration and automated testing environments.

Community libraries

While Postman officially maintains Newman, the popularity of the Postman platform has led to the development of numerous community-contributed libraries and tools. These libraries often address specific use cases, provide integrations with other systems, or offer alternative ways to interact with Postman's data and workflows. Many community projects focus on enhancing reporting, enabling custom scripting, or facilitating deeper integration with various programming languages and frameworks.

Examples of common types of community contributions include:

  • Custom Newman Reporters: Beyond the built-in CLI, JSON, and Junit reporters, community members have developed various custom reporters for Newman, such as HTML reports (like newman-reporter-htmlextra), Slack notifications, or database logging. These reporters help teams visualize test results in preferred formats or integrate them into existing communication channels.
  • Postman Collection Generators: Tools that programmatically generate Postman Collections from API specifications like OpenAPI (formerly Swagger) or RAML. These can streamline the process of creating test suites from design-first API approaches.
  • Language-specific Client Libraries: While not officially sanctioned by Postman for interacting with the Postman application itself, developers often create client libraries in various languages (e.g., Python, Java, Go) to consume APIs that were designed and documented using Postman. These are generally standard HTTP clients wrapped with convenient methods for specific API consumption patterns.
  • Integration with CI/CD Tools: Scripts and plugins that simplify the integration of Newman runs into popular CI/CD pipelines beyond basic command execution, offering more robust error handling or environment provisioning.
  • Data Management Tools: Utilities for managing Postman environments, global variables, or data files in a more automated fashion, especially in large-scale testing scenarios.

Developers seeking specific functionality not covered by official Postman tools are encouraged to explore community forums and open-source repositories (e.g., GitHub). Searching for "Postman" alongside the desired programming language or integration target often yields relevant community projects.