Create and manage collections using the Collection SDK

The Collection SDK is a Node.js module that allows you to work with Postman Collections and build them dynamically into your API project pipeline.

With the Collection SDK, you can create and manipulate collections, exporting them in a format that you can then integrate with other utilities, including Postman and Newman, Postman's command-line collection runner.

Accessing the Collection SDK

The Collection SDK is an open-source project. Visit the repo for more detail on using the module in your own projects. The SDK documentation provides an overview of the available objects and methods within the SDK, as well as an intro to the related concepts.

You can install the SDK from npm or directly from the repo. The following excerpt demonstrates using the SDK to read a file and parse it into a collection object in JavaScript:

var fs = require('fs'),
  Collection = require('postman-collection').Collection,
  myCollection;

myCollection = new Collection(JSON.parse
  (fs.readFileSync('sample-collection.json').toString()));

console.log(myCollection.toJSON());

The Collection SDK provides an interface for working with the data structures defined by the Postman Collection Schema. You can use the SDK methods to create and manipulate collection elements, define request detail, variables, authentication, and so on.

Get started with the Collection SDK from the project repo, installing it and using the methods to build collections in a way that suits your development or testing project. You can also fork and contribute to the project, or create issues for any problems or feature requests.

Next steps

If you're working with the Collection SDK to automate part of your collection run workflow, you can integrate your Collection SDK development with Newman, Postman's command-line collection runner:

Last modified: 2022/07/20


Postmanaut dancing. Illustration.