Postman CLI dependency commands (postman dependency)
Postman CLI dependency commands (postman dependency)
This topic covers dependency commands for the Postman CLI.
Workspace dependencies let you reuse a collection, environment, or mock from another workspace in your local project.
postman dependency add
Adds a collection, environment, or mock from another workspace as a dependency of your local project, so you can reuse it. The command copies the element into your project’s postman/.dependencies/ directory and records it in your .postman/resources.yaml file.
Usage
The type of element to add as a dependency: collection, environment, or mock.
The name or ID of the element to add.
Options
The ID of the workspace the dependency comes from. Defaults to the current workspace.
Skips all confirmation prompts.
Prints the result as JSON for machine-readable output.
Examples
postman dependency list
Lists the workspace dependencies declared in your .postman/resources.yaml file.
Usage
Options
Lists only dependencies of the given type. The supported types are collection, environment, and mock.
Prints the result as JSON for machine-readable output.
Examples
postman dependency install
Fetches the dependencies declared in your .postman/resources.yaml file into your local project, so it has the collections, environments, and mocks it depends on. Run it after cloning a project or in CI, much like the npm install step of a Node.js project. Run it with no argument to install every declared dependency, or name one dependency to install only that one.
Usage
The dependency to install, given as its cloud ID, display name, or on-disk name, as shown by postman dependency list. Omit it to install every declared dependency.
Options
Installs only dependencies of the given type. The supported types are collection, environment, and mock.
Prints the result as JSON for machine-readable output.
Examples
postman dependency update
Refreshes declared dependencies to the latest content from their source. For each dependency, it fetches the latest version of the cloud entity and overwrites its local files in place. Run it with no argument to update every declared dependency, or name one dependency to update only that one.
Usage
The dependency to update, given as its cloud ID, display name, or on-disk name, as shown by postman dependency list. Omit it to update every declared dependency.
Options
Updates only dependencies of the given type. The supported types are collection, environment, and mock.
Prints the result as JSON for machine-readable output.
Examples
postman dependency remove
Removes a workspace dependency and deletes its local files. Identify the dependency by its cloud ID, display name, or on-disk name, as shown by postman dependency list. Removing a collection also removes the environments pinned to it, unless another collection pins them too. The command prompts for confirmation unless you pass --yes, which is required when you run the command outside an interactive terminal.
Usage
The dependency to remove, given as its cloud ID, display name, or on-disk name.
Options
Matches only dependencies of the given type. The supported types are collection, environment, and mock.
Skips the confirmation prompt. Required when you run the command outside an interactive terminal or with --json.
Prints the result as JSON for machine-readable output.