@postman/postman-plugin 0.1.0 → 0.1.2-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/dist/hosts/index.js +2 -1
- package/dist/hosts/pi.js +84 -0
- package/dist/pi-extension.js +27 -0
- package/dist/source.js +3 -1
- package/hooks/session-start-context.md +11 -0
- package/mcp.pi.json +14 -0
- package/package.json +21 -6
- package/skills/ai-readiness/SKILL.md +50 -0
- package/skills/api-discovery/SKILL.md +135 -0
- package/skills/api-discovery/reference/orbit.md +101 -0
- package/skills/api-documentation/SKILL.md +34 -0
- package/skills/api-documentation/reference/rest-api-best-practices.md +47 -0
- package/skills/api-engineer/SKILL.md +29 -0
- package/skills/api-mocking/SKILL.md +141 -0
- package/skills/api-monitoring/SKILL.md +137 -0
- package/skills/api-testing/SKILL.md +103 -0
- package/skills/bootstrap/SKILL.md +216 -0
- package/skills/bootstrap/reference/cli_installation.md +58 -0
- package/skills/ci-integration/SKILL.md +121 -0
- package/skills/collection-schema-v3/SKILL.md +210 -0
- package/skills/collection-schema-v3/reference/environment.md +63 -0
- package/skills/collection-schema-v3/reference/other_protocols.md +86 -0
- package/skills/datasets/SKILL.md +323 -0
- package/skills/flows/SKILL.md +212 -0
- package/skills/flows/reference/flow_cli_flags.md +111 -0
- package/skills/performance-testing/SKILL.md +71 -0
- package/skills/postman-mcp-server/SKILL.md +71 -0
- package/skills/postman-mcp-server/references/docs.md +88 -0
- package/skills/postman-mcp-server/references/learn.md +73 -0
- package/skills/postman-mcp-server/references/mcp-limitations.md +38 -0
- package/skills/postman-mcp-server/references/mock.md +101 -0
- package/skills/postman-mcp-server/references/search.md +83 -0
- package/skills/postman-mcp-server/references/security.md +129 -0
- package/skills/postman-mcp-server/references/setup.md +141 -0
- package/skills/postman-mcp-server/references/sync.md +85 -0
- package/skills/postman-mcp-server/references/test.md +84 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-mocking
|
|
3
|
+
description: Stands up a fake backend that behaves like a real API — from a collection or an OpenAPI spec, running locally or pushed to Postman's cloud for a durable URL — plus request-time scenario and status-code overrides for testing failure paths. Use when the user asks to "mock this API," "create a mock server," "fake the backend," "run tests without hitting the real API," or "simulate an error/out-of-stock response." Covers `postman mock`. Depends on bootstrap for the workspace id only once a mock is pushed to the cloud (`-w`, or the workspace linked in `.postman/resources.yaml`) — generating and running a mock locally needs nothing from bootstrap.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API Mocking
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This skill covers the Postman CLI (`postman mock`) for **Code Mocks** — the
|
|
11
|
+
code-based mock product. It is not the postman-app UI (Local Mode sidebar,
|
|
12
|
+
Agent Mode tools, Simulations), nor the older classic/collection mocks that
|
|
13
|
+
serve saved collection examples from a `*.mock.pstmn.io` URL — that's a
|
|
14
|
+
different product (the MCP `createMock` flow), not this skill.
|
|
15
|
+
|
|
16
|
+
A **local** mock is two files on disk: `config.yaml` (name, port, scenarios) and
|
|
17
|
+
`default.js` — a plain Node HTTP server, and the mock itself, not a wrapper
|
|
18
|
+
around one. Generating, inspecting, running, and calling a local mock work for
|
|
19
|
+
a logged-out guest. Only sharing it — pushing to the cloud and deploying a
|
|
20
|
+
durable URL — needs `postman login`. The progression is one model in three
|
|
21
|
+
places: local folder ──`push`──▶ Code Mock (cloud definition) ──`deploy`──▶
|
|
22
|
+
Mock Server (the reachable URL).
|
|
23
|
+
|
|
24
|
+
Default path: write a local folder, then `mock push` later if something other
|
|
25
|
+
than you needs to hit it over the network (a teammate, CI elsewhere, a webhook
|
|
26
|
+
sender). A purely local mock answering a `postman request` on your machine
|
|
27
|
+
never needs cloud. The exception is `generate -w`, which creates the mock in a
|
|
28
|
+
workspace only and writes no local files — use that only when you intentionally
|
|
29
|
+
skip the repo copy.
|
|
30
|
+
|
|
31
|
+
## Process
|
|
32
|
+
|
|
33
|
+
1. **Generate.** `postman mock generate -n NAME` with no source scaffolds a
|
|
34
|
+
sample shopping-cart mock (`POST /cart/items`, `GET /cart`, `POST /checkout`)
|
|
35
|
+
— the fastest way to a server that already answers, useful whenever the
|
|
36
|
+
point is exercising mock *behavior* rather than a specific API's shape. Pass
|
|
37
|
+
a real source — `postman mock generate SOURCE -n NAME`, where `SOURCE` is a
|
|
38
|
+
collection file/directory or an `openapi.yaml` — when the endpoints need to
|
|
39
|
+
mirror an actual API. Either form writes `config.yaml` + `default.js` into
|
|
40
|
+
`postman/mocks/NAME/` (default port 4500).
|
|
41
|
+
- `postman mock generate SOURCE --update ./postman/mocks/NAME` regenerates
|
|
42
|
+
the default handler from the source in place, keeping the existing name,
|
|
43
|
+
port, and scenarios. `--update` still needs the `SOURCE`; it cannot be
|
|
44
|
+
combined with `--output`.
|
|
45
|
+
- `-w <workspaceId>` saves the mock to a cloud workspace *instead of* the
|
|
46
|
+
repository — it writes no local files and requires being logged in. Cannot
|
|
47
|
+
be combined with `--output`, `--force`, or `--update`. Prefer local
|
|
48
|
+
generate + later `push` when you still need `mock run` from a folder.
|
|
49
|
+
2. **Run it.** `postman mock run ./postman/mocks/NAME` starts the server and
|
|
50
|
+
prints the bound URL (`... at http://localhost:PORT`). If the port in
|
|
51
|
+
`config.yaml` is taken and `--port` wasn't passed explicitly, it falls back
|
|
52
|
+
to a free OS-assigned port instead of erroring — read the real port off that
|
|
53
|
+
line rather than assuming the configured one. Naming `--port N` explicitly
|
|
54
|
+
makes a taken port a hard error; `--port auto` always picks a free one.
|
|
55
|
+
3. **Call it.** Plain `postman request localhost:PORT/route` returns the
|
|
56
|
+
default scenario's response. Two headers can change that per-request, with no
|
|
57
|
+
restart: `x-mock-scenario: <name>` selects a scenario the mock defines
|
|
58
|
+
(valid names live in `config.yaml`); a name the mock doesn't define is not an
|
|
59
|
+
error — it falls back to the default scenario. `x-mock-response-code: <code>`
|
|
60
|
+
filters an endpoint's saved example responses to the one with that status, so
|
|
61
|
+
it only changes anything when that endpoint actually has an example for that
|
|
62
|
+
code — mocks generated from a collection/spec with multiple example statuses
|
|
63
|
+
honor it; the built-in sample mock has one response per route and ignores it.
|
|
64
|
+
A wrong route comes back as `Endpoint not defined`. There's no hot reload: a
|
|
65
|
+
`default.js` edit does nothing until you Ctrl+C the running server and
|
|
66
|
+
`mock run` it again.
|
|
67
|
+
4. **Push it, if it needs to leave your machine.**
|
|
68
|
+
`postman mock push ./postman/mocks/NAME` is safe to re-run — `Created` the
|
|
69
|
+
first time, `Updated` after — and records the cloud mapping in
|
|
70
|
+
`.postman/resources.yaml`; commit that change. If a mock server is already
|
|
71
|
+
live for this mock, the push updates what it serves.
|
|
72
|
+
5. **Deploy it, for a URL that outlives your terminal.**
|
|
73
|
+
`postman mock deploy CLOUD_ID -s SLUG -y` prints
|
|
74
|
+
`https://SLUG.mock.<team-domain>.postman.dev`. Deployed private by default —
|
|
75
|
+
callers need a Postman API key (`x-api-key`) — add `--public` only when the
|
|
76
|
+
mock should be reachable by anyone with the URL. `--auto-deploy` re-publishes
|
|
77
|
+
the live server automatically whenever the mock changes; even without it, a
|
|
78
|
+
later `push` already updates a live server, so you only re-`deploy` for the
|
|
79
|
+
first URL or after taking the server down.
|
|
80
|
+
6. **See who's calling it.** `postman mock get CLOUD_ID` (table or `--json`)
|
|
81
|
+
returns `mockServerId`; feed that into `postman mock log MOCK_SERVER_ID` for
|
|
82
|
+
call entries (filter with `--method` / `--status` / `--path` / `--since` /
|
|
83
|
+
`--until` / `--limit`, or `--json`). An empty log means the URL genuinely
|
|
84
|
+
hasn't been hit — a rejected caller still shows up, recorded with its failing
|
|
85
|
+
status code.
|
|
86
|
+
7. **Tear down.**
|
|
87
|
+
- Local: `postman mock delete ./path --yes` — refuses while that mock is
|
|
88
|
+
**running** locally; stop `mock run` first.
|
|
89
|
+
- Cloud: `postman mock delete CLOUD_ID --yes` — refuses while the mock is
|
|
90
|
+
**running locally** *or* **deployed**; stop the local run and take the
|
|
91
|
+
mock server down first.
|
|
92
|
+
Cloud delete doesn't touch `.postman/resources.yaml`; drop that line by hand
|
|
93
|
+
afterward or the repo keeps claiming a mock that's gone.
|
|
94
|
+
|
|
95
|
+
To point real request/assertion runs at a mock instead of hand-editing
|
|
96
|
+
base-URL variables, see the `api-testing` skill's `--use-mock`/`--mock` flags
|
|
97
|
+
on `collection run`.
|
|
98
|
+
|
|
99
|
+
## The two ids that matter
|
|
100
|
+
|
|
101
|
+
- **Code-mock id** — the `id` in `config.yaml`, and the id that `push` and
|
|
102
|
+
`generate -w` print (often the same value). Use it for `get`, `deploy`,
|
|
103
|
+
`delete`, and `run` by cloud id.
|
|
104
|
+
- **`mockServerId`** — a different value from `mock get CLOUD_ID` (table or
|
|
105
|
+
`--json`). Use it for `mock log`, and nothing else.
|
|
106
|
+
|
|
107
|
+
## Critical Rules
|
|
108
|
+
|
|
109
|
+
1. **When you're not signed in, every gated cloud command fails closed:**
|
|
110
|
+
`Authentication required. Run postman login or provide --api-key`, exit 1,
|
|
111
|
+
nothing half-done. (Signed in but lacking access fails differently — a
|
|
112
|
+
permission or missing-workspace error.) Whether a command is gated is decided
|
|
113
|
+
by what you pass it, not the verb — `mock get`/`mock run` take either a local
|
|
114
|
+
path (ungated) or a cloud ID (gated); `mock list` is gated only when called
|
|
115
|
+
with no path.
|
|
116
|
+
2. **`push` is what moves an existing local mock to the cloud — `-w` at
|
|
117
|
+
`generate` time is optional, not a fork you must choose up front.** A mock
|
|
118
|
+
built as a guest can be pushed and deployed later with no rework. Do not
|
|
119
|
+
assume `generate -w` left a `postman/mocks/NAME/` folder to `run`.
|
|
120
|
+
3. **`--public` on `deploy` is the one action here with real exposure** — it
|
|
121
|
+
stands up a server anyone with the URL can hit, with no API key. The default
|
|
122
|
+
(private) is the safe one; confirm intent before adding it.
|
|
123
|
+
4. **To change a mock:** refresh it from a source with
|
|
124
|
+
`postman mock generate SOURCE --update PATH`, or edit `default.js` by hand
|
|
125
|
+
and restart `mock run`. Never pass a code-mock id to `mock log` — that
|
|
126
|
+
command takes a `mockServerId`.
|
|
127
|
+
5. **`-w`/`--workspace` only exists on `generate`, `list`, `push`, and
|
|
128
|
+
`deploy`.** `get`, `run`, `log`, and `delete` already take a path or an id
|
|
129
|
+
that says where the mock is — there's nothing left for `-w` to resolve on
|
|
130
|
+
those.
|
|
131
|
+
|
|
132
|
+
## Verification
|
|
133
|
+
|
|
134
|
+
A mock isn't done because `generate` or `run` exited 0 — hit it with
|
|
135
|
+
`postman request` and check the actual status/body, or `mock get CLOUD_ID
|
|
136
|
+
--json` for a cloud one, then state whether it ended up local or cloud, and
|
|
137
|
+
(if deployed) private or public. For a scenario check, confirm a *valid* name
|
|
138
|
+
from `config.yaml` actually changed the response — a typo'd name falls back to
|
|
139
|
+
the default, so a 200 alone proves nothing. For a status-code check, use an
|
|
140
|
+
endpoint that has an example for that code (not the sample mock). A passing
|
|
141
|
+
exit code from `request` is not enough.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-monitoring
|
|
3
|
+
description: Creates, schedules, and manages Postman Monitors — recurring checks against a live API — triggers ad hoc runs, inspects job/run history to diagnose failures, and hosts self-hosted execution runners for monitors on a private network. Use when the user asks to "set up a monitor," "run this monitor now," "check monitor results," "pause/resume a monitor," or "set up a runner for our internal APIs." Covers `postman monitor` (create, update, delete, list, get, pause, resume, run, jobs, runs) and `postman runner` (start, list, regions).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API Monitoring
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
A Monitor is a recurring, scheduled check against a live API. The CLI now
|
|
11
|
+
owns its full lifecycle: `monitor create`/`update`/`delete`/`pause`/`resume`
|
|
12
|
+
manage the schedule and configuration, `monitor list`/`get` discover and
|
|
13
|
+
inspect existing ones, `monitor run` triggers an ad hoc run, and `monitor
|
|
14
|
+
jobs`/`monitor runs` inspect what actually happened during a run. There is
|
|
15
|
+
no remaining task here that has to go through the Postman app.
|
|
16
|
+
|
|
17
|
+
`postman runner` is a separate, infrastructure-level concern: it starts a
|
|
18
|
+
self-hosted execution agent so Monitor runs can reach APIs that live behind
|
|
19
|
+
a private network Postman's cloud can't reach directly, and it lists the
|
|
20
|
+
values (Postman regions or self-hosted runner ids) that `monitor
|
|
21
|
+
create`/`update --runner` accepts.
|
|
22
|
+
|
|
23
|
+
## Creating and scheduling a monitor
|
|
24
|
+
|
|
25
|
+
`monitor create -c <collectionId>` is the minimum — name defaults to the
|
|
26
|
+
linked collection's own name. Workspace comes from `-w`, or falls back to
|
|
27
|
+
the workspace named in the local `.postman/resources.yaml` manifest;
|
|
28
|
+
without either, creation fails. `--schedule <cron>` plus `--timezone`
|
|
29
|
+
(defaults to the host machine's zone) set when it fires; `--runner`
|
|
30
|
+
(repeatable) says where from — a Postman region name (`postman runner
|
|
31
|
+
regions`) or a self-hosted runner's id (`postman runner list`), and both
|
|
32
|
+
can be mixed in the same monitor. `--notify-email` (repeatable) and
|
|
33
|
+
`--notification-limit` control failure alerts. The run itself is shaped by
|
|
34
|
+
the same options as a collection run — `--retry` (service caps at 2),
|
|
35
|
+
`--timeout`, `--delay`, `--strict-ssl`/`--insecure`,
|
|
36
|
+
`--follow-redirects`/`--block-redirects`, and dataset iteration via
|
|
37
|
+
`--dataset-id`/`--dataset-view-id`/`--iteration-count`/
|
|
38
|
+
`--iteration-strategy`. Creation triggers an immediate run by default; pass
|
|
39
|
+
`--no-run-now` to skip that.
|
|
40
|
+
|
|
41
|
+
## Updating, pausing, and deleting
|
|
42
|
+
|
|
43
|
+
`monitor update <monitorId>` takes the same schedule/runner/notification/
|
|
44
|
+
run-option flags as `create`, plus `--clear-notifications` to wipe every
|
|
45
|
+
recipient. It cannot change the linked collection or environment — delete
|
|
46
|
+
and recreate the monitor instead — and it does not pause or resume; use
|
|
47
|
+
`monitor pause`/`monitor resume` for that. `monitor delete <monitorId>`
|
|
48
|
+
prompts for confirmation unless `-y`/`--yes` is passed, and is permanent.
|
|
49
|
+
|
|
50
|
+
## Discovering and inspecting monitors
|
|
51
|
+
|
|
52
|
+
`monitor list` filters by `-w`/`-c`/`--environment`/`--owner`/`--team`/
|
|
53
|
+
`--active`. `--runner <id>` filters to a *self-hosted* runner id (not a
|
|
54
|
+
Postman region) and can't be combined with the other filters. Page with
|
|
55
|
+
`--limit`/`--cursor`; `--offset` is accepted by the service but silently
|
|
56
|
+
ignored, so the CLI rejects it locally rather than returning a page that
|
|
57
|
+
looks right but isn't — use `--cursor` from the previous page's response.
|
|
58
|
+
`--columns` picks which fields show, `-f`/`--filter` matches on name within
|
|
59
|
+
the page already returned (not a server-side search), and `--sort name|active`
|
|
60
|
+
orders it. `monitor get <monitorId>` shows one monitor's full configuration.
|
|
61
|
+
|
|
62
|
+
## Triggering a run
|
|
63
|
+
|
|
64
|
+
`monitor run <monitorId>` runs an existing Monitor synchronously and prints
|
|
65
|
+
the result — useful in CI to get a pass/fail right after a deploy rather
|
|
66
|
+
than waiting for the next scheduled tick. `-t/--timeout` (default 15
|
|
67
|
+
minutes) caps how long the CLI waits for completion; a timeout hit here is
|
|
68
|
+
the CLI giving up on waiting, not the Monitor itself failing. `--async`
|
|
69
|
+
submits the run and returns immediately with its job id and Postman URL
|
|
70
|
+
instead of waiting at all — reach for this over a long `-t` when the caller
|
|
71
|
+
doesn't need the verdict inline. `--json` prints only the verdict as JSON,
|
|
72
|
+
for scripting. `-x/--suppress-exit-code` overrides the default
|
|
73
|
+
fail-on-failed-run exit code, for a caller that wants to see failures
|
|
74
|
+
without breaking a pipeline step.
|
|
75
|
+
|
|
76
|
+
## Diagnosing a run
|
|
77
|
+
|
|
78
|
+
`monitor jobs list <monitorId>` lists a monitor's recent jobs; `monitor jobs
|
|
79
|
+
get <jobId>` reports one job's terminal state and its per-region run
|
|
80
|
+
outcomes — a monitor with runners in multiple regions runs once per region
|
|
81
|
+
per job. `monitor runs get <runId>` goes one level deeper: which test
|
|
82
|
+
assertions ran during one attempt, which failed, and why. Reach for these
|
|
83
|
+
instead of re-running blind after a `-t` timeout, or whenever the task is
|
|
84
|
+
explaining *why* a monitor failed rather than just that it did.
|
|
85
|
+
|
|
86
|
+
## Private (self-hosted) runners
|
|
87
|
+
|
|
88
|
+
A private runner — the CLI's `runner regions` calls the same thing a
|
|
89
|
+
"private-runner" value — is an agent you run inside your own network so
|
|
90
|
+
Monitor traffic originates there instead of from Postman's cloud IPs. Reach
|
|
91
|
+
for one only when the monitored API sits behind a VPN, firewall, or on-prem
|
|
92
|
+
network that Postman's cloud can't reach directly; a public API should just
|
|
93
|
+
use a Postman region (`--runner us-east`, etc.) since that needs no
|
|
94
|
+
infrastructure of your own to run or maintain.
|
|
95
|
+
|
|
96
|
+
`runner start --id <id> --key <key>` (from the Postman app) registers a
|
|
97
|
+
runner that executes monitor runs from your own infrastructure instead of
|
|
98
|
+
Postman's cloud. Extra
|
|
99
|
+
flags cover the runner's own networking: `--region eu` for EU residency,
|
|
100
|
+
`--proxy`/`--egress-proxy`/`--egress-proxy-authz-url` for outbound routing,
|
|
101
|
+
`--ssl-extra-ca-certs` for a private CA, and `--metrics`/`--metrics-port`
|
|
102
|
+
for a health-check endpoint. Analytics are sent by default; `--no-report-events`
|
|
103
|
+
opts out. `runner list` shows the team's registered self-hosted runners —
|
|
104
|
+
feed an id from here into `monitor create/update --runner` or `monitor list
|
|
105
|
+
--runner`. `runner regions` lists the Postman-region and private-runner
|
|
106
|
+
values valid for `--runner` on `monitor create`/`update`, including a
|
|
107
|
+
static IP where one is configured — check here before guessing a region
|
|
108
|
+
string.
|
|
109
|
+
|
|
110
|
+
## Critical Rules
|
|
111
|
+
|
|
112
|
+
1. **`update` can't move a monitor to a different collection or environment,
|
|
113
|
+
and doesn't pause/resume it.** Delete and recreate for the former; use
|
|
114
|
+
`pause`/`resume` for the latter.
|
|
115
|
+
2. **A `monitor run -t` timeout is a wait cap, not a monitor failure.**
|
|
116
|
+
Don't report "the monitor failed" from a timeout without checking
|
|
117
|
+
`monitor jobs get`/`monitor runs get` (or the Postman app) for what the
|
|
118
|
+
run actually did after the CLI gave up waiting — or avoid the wait
|
|
119
|
+
entirely with `--async`.
|
|
120
|
+
3. **`--runner` on `monitor create`/`update` takes a region name or a
|
|
121
|
+
self-hosted runner id — check `runner regions`/`runner list` before
|
|
122
|
+
guessing a string,** and don't suggest `runner start` unless the target
|
|
123
|
+
API genuinely isn't reachable from Postman's cloud.
|
|
124
|
+
4. **`monitor list --offset` doesn't work — use `--cursor`,** and
|
|
125
|
+
`--runner` there can't be combined with the other filters.
|
|
126
|
+
5. **`monitor delete` is permanent.** Confirm intent before passing `-y` to
|
|
127
|
+
skip its prompt.
|
|
128
|
+
|
|
129
|
+
## Verification
|
|
130
|
+
|
|
131
|
+
State the monitor/job/run id and the actual pass/fail result or
|
|
132
|
+
configuration change, not just that the command exited. For `run`, state
|
|
133
|
+
whether it completed synchronously or was submitted `--async` (a job id is
|
|
134
|
+
not yet a verdict — resolve it with `monitor jobs get` before reporting a
|
|
135
|
+
result). If a self-hosted runner was started, confirm it registered (the
|
|
136
|
+
Postman app, or `runner list`, shows it as connected) before assuming
|
|
137
|
+
monitor runs will route through it.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-testing
|
|
3
|
+
description: Runs tests against an API from the command line — a single ad-hoc request, a full collection of pm.test assertions, or matching real captured app traffic against a collection contract. Use when the user asks to "test this endpoint," "run this collection," "check the API still works," or "verify my app's requests match the contract." Covers `postman request`, `postman collection run`, and `postman application test`. Depends on bootstrap when the target is a cloud collection or workspace-bound environment; a bare URL or local collection needs nothing from bootstrap.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API Testing
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Three tools, matched to what already exists:
|
|
11
|
+
|
|
12
|
+
| Have | Use |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| Just a URL to check, with no saved request | `postman request` |
|
|
15
|
+
| A request already saved in a collection | `postman collection run <collection-path> -i <request-id-name-or-path>` |
|
|
16
|
+
| A collection with `pm.test` assertions saved in it | `postman collection run` |
|
|
17
|
+
| A real app (browser flow, CLI, service) whose traffic should match a collection's contract | `postman application test` |
|
|
18
|
+
|
|
19
|
+
Don't reach for the heavier tool when the lighter one already answers the
|
|
20
|
+
question — a one-off endpoint check doesn't need a collection, and a
|
|
21
|
+
collection run doesn't need Playwright.
|
|
22
|
+
|
|
23
|
+
## `postman request` — over curl, not instead of testing
|
|
24
|
+
|
|
25
|
+
A single request with Postman's resolution built in: `-e` resolves
|
|
26
|
+
`{{variables}}` from an environment file the same way a collection run
|
|
27
|
+
would, `--auth-*` flags cover basic/bearer/digest/oauth/aws/etc. without
|
|
28
|
+
hand-building headers, and `--retry`/`--timeout` handle flaky endpoints.
|
|
29
|
+
`--script-post-request` can run `pm.test(...)` assertions inline — the exit
|
|
30
|
+
code counts *failed assertions*, not just HTTP status, so a 200 with a
|
|
31
|
+
failing test still exits nonzero. Useful for a quick check or a CI health
|
|
32
|
+
check; not the place to accumulate assertions that should outlive one
|
|
33
|
+
command — those belong saved in a collection.
|
|
34
|
+
|
|
35
|
+
Before constructing a URL, headers, auth, and body on the command line, look
|
|
36
|
+
for a matching `*.request.yaml` under `postman/collections/`. If it exists,
|
|
37
|
+
execute the saved request through its collection:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
postman collection run "postman/collections/Orders API" -i "create order"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Do not copy the saved YAML fields into `postman request`; that bypasses the
|
|
44
|
+
collection's inherited variables, auth, scripts, and maintained payload. The
|
|
45
|
+
`postman request` positional target is a URL, not a `.request.yaml` path. When
|
|
46
|
+
there is no saved request but its body already lives in a separate file, keep
|
|
47
|
+
the file as the source of truth with `--body @path/to/payload.json` instead of
|
|
48
|
+
inlining its contents.
|
|
49
|
+
|
|
50
|
+
## `collection run` — the assertion suite
|
|
51
|
+
|
|
52
|
+
Debugging a request's behavior during a run (why a `pm.test` failed, what a
|
|
53
|
+
request actually sends) means reading the request's own YAML — see the
|
|
54
|
+
`collection-schema-v3` skill for that file format before assuming a field's
|
|
55
|
+
shape.
|
|
56
|
+
|
|
57
|
+
Runs every request in a collection (or a subset via `-i`, repeatable),
|
|
58
|
+
executing whatever `pm.test` scripts are already saved in it.
|
|
59
|
+
`-d`/`--iteration-data` (or the beta `--iteration-data-dataset` +
|
|
60
|
+
`--iteration-data-view` pair) drives data-driven runs across a CSV/JSON
|
|
61
|
+
file or a Postman Dataset. `-r junit,html` for CI-consumable reports.
|
|
62
|
+
`--use-mock`/`--mock` redirects the run at a mock instead of a real backend
|
|
63
|
+
(see the `api-mocking` skill) — reach for this to test request/assertion
|
|
64
|
+
logic without depending on a live service.
|
|
65
|
+
|
|
66
|
+
## `application test` — contract-matching real traffic
|
|
67
|
+
|
|
68
|
+
This doesn't send its own requests. It runs your existing test command
|
|
69
|
+
(`--command "npx playwright test"`, or config-driven via
|
|
70
|
+
`postman.config.cjs` targets), captures the network traffic that command
|
|
71
|
+
generates, and matches/asserts it against your Postman collections —
|
|
72
|
+
answering "did my app's actual calls conform to the contract," not "does
|
|
73
|
+
this endpoint respond correctly." `--capture-only` skips the matching step
|
|
74
|
+
entirely and just exports what was captured as a new v3 collection,
|
|
75
|
+
organized by host — a way to bootstrap a collection from real traffic
|
|
76
|
+
rather than authoring one from scratch. Results upload to Postman
|
|
77
|
+
automatically after each run; `--report-events=false` skips that for a run
|
|
78
|
+
that shouldn't be recorded.
|
|
79
|
+
|
|
80
|
+
## Critical Rules
|
|
81
|
+
|
|
82
|
+
1. **Don't reach for `application test` for something a plain
|
|
83
|
+
`collection run` covers.** It exists specifically for matching *captured*
|
|
84
|
+
app traffic (via Playwright or similar), not for driving requests itself.
|
|
85
|
+
2. **`postman request`'s exit code reflects failed `pm.test` assertions, not
|
|
86
|
+
HTTP status alone.** A nonzero exit on a 200 response usually means a
|
|
87
|
+
post-request script assertion failed, not a network problem.
|
|
88
|
+
3. **Assertions meant to be reused belong in the collection, not on the
|
|
89
|
+
command line.** A `--script-post-request` test on `collection run` runs
|
|
90
|
+
once and leaves nothing for the next person; save it as a `pm.test` in
|
|
91
|
+
the request instead.
|
|
92
|
+
4. **`--use-mock` is the way to test without a live backend** — prefer it
|
|
93
|
+
over standing up ad hoc fakes or skipping tests that need a dependency.
|
|
94
|
+
5. **Reuse a saved request instead of reconstructing it.** If a matching v3
|
|
95
|
+
request exists, use `collection run <collection-path> -i <request>`; reserve
|
|
96
|
+
`postman request` for genuinely ad-hoc requests.
|
|
97
|
+
|
|
98
|
+
## Verification
|
|
99
|
+
|
|
100
|
+
State the actual result (pass/fail counts, exit code), not just that the
|
|
101
|
+
command ran. For `application test`, state whether it ran in match mode or
|
|
102
|
+
`--capture-only` — they answer different questions and shouldn't be
|
|
103
|
+
reported the same way.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bootstrap
|
|
3
|
+
description: Resolves the Postman CLI, authenticates when the task needs it, and manages the filesystem/workspace binding for a repository. Use when the user asks to set up Postman, enable filesystem workflows, authenticate, initialize, import, connect, pull, push, sync, or share a workspace — and before skills that need a linked workspace, only when the CLI, linked workspace, or spec path has not already been confirmed.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Bootstrap Postman for This Repo
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
One-time and idempotent: every other Postman skill in this plugin reads the
|
|
11
|
+
values this one records and re-derives none of them. Finding an existing
|
|
12
|
+
`postman/` tree or an OpenAPI file is a signal to inspect, not to assume this
|
|
13
|
+
repo is already set up.
|
|
14
|
+
|
|
15
|
+
## Rules
|
|
16
|
+
|
|
17
|
+
- Make ad-hoc HTTP calls with `postman request`, never `curl` or another
|
|
18
|
+
client. If the request already exists in a collection, preserve its saved
|
|
19
|
+
auth, variables, scripts, and payload by using `postman collection run
|
|
20
|
+
<collection-path> -i <request>` instead of reconstructing it on the command
|
|
21
|
+
line; see `api-testing`.
|
|
22
|
+
- Never invent a subcommand or a flag. Run `-h` first and believe it.
|
|
23
|
+
- Lint specs with `postman spec lint`, never `postman api …` — the API Builder
|
|
24
|
+
is deprecated in v12+ and the CLI prints no warning.
|
|
25
|
+
- Local commands need no login; only commands that reach the Postman
|
|
26
|
+
workspace do. Don't force a login the task doesn't need.
|
|
27
|
+
- A missing `postman` binary means install it. Route to `postman-mcp-server`
|
|
28
|
+
only after an install has been attempted and actually failed.
|
|
29
|
+
- Never fabricate a workspace id, spec path, or collections directory. Report
|
|
30
|
+
the gap and stop.
|
|
31
|
+
- Never echo an API key or session token into output, logs, or summaries.
|
|
32
|
+
- "Present" is not "current": check the version and existing links before
|
|
33
|
+
setting anything up.
|
|
34
|
+
- Wire up an existing repo only. Never scaffold a new API or a starter spec.
|
|
35
|
+
- Write no host-specific paths — the same `skills/` directory loads on every
|
|
36
|
+
route.
|
|
37
|
+
- Do not use `init` or `workspace create` to share or import a workspace that
|
|
38
|
+
already exists. Choose the direction of sync from the lifecycle table below.
|
|
39
|
+
|
|
40
|
+
## Ask the CLI: `-h`
|
|
41
|
+
|
|
42
|
+
The CLI is self-describing at different levels. Walk down only as far as the
|
|
43
|
+
question needs:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
postman -h # resources: collection, spec, mock, monitor, workspace, api, flows…
|
|
47
|
+
postman <resource> -h # that resource's actions
|
|
48
|
+
postman <resource> <action> -h # real flags, defaults, and worked `Eg.` lines
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Read the third level before writing any command that carries a flag — it is the
|
|
52
|
+
only place defaults are stated, and a wrong default fails silently. Live output
|
|
53
|
+
is authoritative over any summary, including this file. There is also no single
|
|
54
|
+
verb for "is the workspace linked and synced": run `postman workspace -h` and
|
|
55
|
+
pick from what it prints.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
# Process
|
|
60
|
+
|
|
61
|
+
Three steps, in order. Stop at the first that fails and report which one.
|
|
62
|
+
|
|
63
|
+
## 1. Resolve the CLI
|
|
64
|
+
|
|
65
|
+
### 1.1 Check what is already there
|
|
66
|
+
|
|
67
|
+
**Present, and at which version?**
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
command -v postman && postman --version
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Current?** Never blocking — no network is a normal answer. But don't call a
|
|
74
|
+
feature missing without having made this comparison.
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm view postman-cli version
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 1.2 Install only if missing
|
|
81
|
+
|
|
82
|
+
**Preferred — npm, all platforms:**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm install -g postman-cli
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Windows, or avoiding a global npm install:** use the platform installers in
|
|
89
|
+
[reference/cli_installation.md](reference/cli_installation.md). Every route puts
|
|
90
|
+
`postman` on `PATH`.
|
|
91
|
+
|
|
92
|
+
**Updating a copy that already exists:** use the same route that installed it.
|
|
93
|
+
curl-installed binaries don't take `npm install -g` cleanly.
|
|
94
|
+
|
|
95
|
+
**If every route fails:** name what blocked you — no Node, no shell, no write
|
|
96
|
+
access, or a hosted session that cannot install — then hand off to the
|
|
97
|
+
`postman-mcp-server` skill. An attempted install that actually failed is the
|
|
98
|
+
only thing that qualifies.
|
|
99
|
+
|
|
100
|
+
## 2. Establish the filesystem and workspace bindings
|
|
101
|
+
|
|
102
|
+
### 2.1 Authenticate only if this step needs it
|
|
103
|
+
|
|
104
|
+
Local commands need no login, and `postman init` is among them — its own help
|
|
105
|
+
says *"No authentication, and safe in CI."* Skip this entirely unless the
|
|
106
|
+
command you're about to run pulls or pushes an existing workspace, or shares
|
|
107
|
+
one with a team.
|
|
108
|
+
|
|
109
|
+
**With an API key — preferred, non-interactive:**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
[ -n "$POSTMAN_API_KEY" ] && postman login --with-api-key "$POSTMAN_API_KEY"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Browser flow, when that variable is unset:**
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
postman login
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Never echo the key or token.** Auth state lives in the CLI's own config; this
|
|
122
|
+
skill writes no credential file. Report that authentication succeeded, nothing
|
|
123
|
+
more.
|
|
124
|
+
|
|
125
|
+
### 2.2 Inspect both sides before choosing a command
|
|
126
|
+
|
|
127
|
+
Read `.postman/resources.yaml` for `localResources` and `workspace.id`, and
|
|
128
|
+
inspect the local `postman/` tree. When the user names an existing workspace or
|
|
129
|
+
asks to import, sync, or share one, use `workspace list --json` and `workspace
|
|
130
|
+
get <id> --elements --json` to confirm the workspace side. Never create a
|
|
131
|
+
second workspace merely because this repository is not connected yet.
|
|
132
|
+
|
|
133
|
+
Prefer filesystem-first work: materialize an existing workspace with
|
|
134
|
+
`workspace pull <id>`, or initialize local files with `postman init --no-cloud`
|
|
135
|
+
when no workspace exists. Then inspect, edit, diff, and validate the
|
|
136
|
+
version-controlled files before any push.
|
|
137
|
+
|
|
138
|
+
| Existing state and intent | Use | Why |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| No workspace exists; start locally | `postman init --json --no-cloud` | Creates the git-native filesystem without requiring login. |
|
|
141
|
+
| No workspace exists; create and bind one | `postman workspace create --visibility <value>` or the explicit init creation path | Creation is the requested lifecycle event. |
|
|
142
|
+
| Workspace exists; enable filesystem work | `postman workspace pull <workspace-id>` | Connects the workspace to the repository and materializes its entities under `postman/`. |
|
|
143
|
+
| Workspace exists; record only the Git binding | `postman workspace connect-git <workspace-id> [path]` | Binds without downloading its contents. |
|
|
144
|
+
| Bound workspace; the workspace is authoritative | `postman workspace pull` | Refreshes local files from the connected workspace. |
|
|
145
|
+
| Bound workspace; local files are authoritative | `postman workspace diff --push-strategy default`, then `postman workspace push` | Previews and publishes creates/updates without deleting unmatched workspace entities. |
|
|
146
|
+
| “Share this existing workspace with my team” and it is already team-accessible | Diff, then `postman workspace push` | Publishes local contents to the existing workspace; `create` would make a duplicate. |
|
|
147
|
+
|
|
148
|
+
If “share” also requires changing a personal workspace's visibility or team
|
|
149
|
+
permissions, inspect its metadata first. `push` synchronizes entities; it does
|
|
150
|
+
not change access control. Do not create a replacement to work around a missing
|
|
151
|
+
metadata-update command.
|
|
152
|
+
|
|
153
|
+
`workspace diff` is read-only. Match its push strategy to the intended push.
|
|
154
|
+
`--push-strategy force-sync` can delete workspace entities absent locally, so use it
|
|
155
|
+
only when the user explicitly requests mirroring and approves the shown
|
|
156
|
+
deletions. Do not add `-y` merely to bypass a prompt.
|
|
157
|
+
|
|
158
|
+
### 2.3 Initialize only when there is no workspace to pull
|
|
159
|
+
|
|
160
|
+
`postman init --json` is the agent-facing form. It writes
|
|
161
|
+
`.postman/resources.yaml` and scaffolds `postman/` for specs, collections and
|
|
162
|
+
environments. Downstream skills read that file and nothing else.
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
postman init --json --no-cloud # local only, no workspace
|
|
166
|
+
postman init --json --visibility personal # also create and bind a workspace
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Use `--visibility` only when a new workspace is actually wanted. If the
|
|
170
|
+
workspace already exists, use `pull` to enable the filesystem workflow;
|
|
171
|
+
use `push` only when publishing local changes to an already-bound workspace.
|
|
172
|
+
|
|
173
|
+
**The workspace step is interactive** without `--no-cloud` or `--visibility`.
|
|
174
|
+
|
|
175
|
+
**Read the payload, not stderr.** Take `bindings` and `exitCode` from the JSON.
|
|
176
|
+
Each binding reports a `source` of `inferred` or `none` — an inferred spec is a
|
|
177
|
+
guess worth confirming before building on it.
|
|
178
|
+
|
|
179
|
+
**Exit codes that are not failures:** 2 means several specs could be
|
|
180
|
+
authoritative, so re-run with `--spec <path>`. 5 means the local files were
|
|
181
|
+
written but the requested workspace was not created — it does *not* mean re-run.
|
|
182
|
+
|
|
183
|
+
## 3. Verify and report
|
|
184
|
+
|
|
185
|
+
### 3.1 Checkpoints
|
|
186
|
+
|
|
187
|
+
- `postman --version` returned a real version.
|
|
188
|
+
- Auth is confirmed, or established as not required for this task.
|
|
189
|
+
- `.postman/resources.yaml` names a spec or a collections directory.
|
|
190
|
+
- `workspace.id` is set, or the run was deliberately local-only — `--no-cloud`
|
|
191
|
+
leaves it empty and still exits 0, which is a pass, not a gap.
|
|
192
|
+
- After `pull`, expected workspace entities exist under `postman/`. After
|
|
193
|
+
`push`, report created/updated entities and conflicts; do not claim a
|
|
194
|
+
workspace is shared unless its access level permits the intended teammates.
|
|
195
|
+
|
|
196
|
+
"The CLI is installed" is not the bar, and a loaded skill configures nothing.
|
|
197
|
+
|
|
198
|
+
### 3.2 Summary format
|
|
199
|
+
|
|
200
|
+
```md
|
|
201
|
+
## Postman bootstrap
|
|
202
|
+
- **CLI**: <version> (latest: <version> | not checked)
|
|
203
|
+
- **Auth**: <api-key | browser | not required for this task>
|
|
204
|
+
- **Workspace**: <id | none — local only>
|
|
205
|
+
- **Spec path**: <path (inferred | explicit) | none — user must create>
|
|
206
|
+
- **Collections dir**: <path | none — user must create>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
# Reference Files
|
|
212
|
+
|
|
213
|
+
- `collection-schema-v3` skill — read when inspecting or writing the
|
|
214
|
+
collection files this skill resolves.
|
|
215
|
+
- [CLI Installation](reference/cli_installation.md) — read for install, update
|
|
216
|
+
and uninstall commands per platform.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Postman CLI Installation
|
|
2
|
+
|
|
3
|
+
A global install, on `PATH`, installed by one of three tools depending on
|
|
4
|
+
platform. Whichever one put the binary there is the one to use again when
|
|
5
|
+
updating it — mixing tools leaves two `postman` binaries and a `PATH`
|
|
6
|
+
question.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
**npm (all platforms):**
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g postman-cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**macOS, Linux, and WSL (curl):**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
curl -o- "https://dl-cli.pstmn.io/install/unix.sh" | sh
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Windows (PowerShell):**
|
|
23
|
+
|
|
24
|
+
```powershell
|
|
25
|
+
powershell.exe -NoProfile -InputFormat None -ExecutionPolicy AllSigned -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://dl-cli.pstmn.io/install/win64.ps1'))"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Check for drift
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
postman --version # installed
|
|
32
|
+
npm view postman-cli version # latest published
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Update
|
|
36
|
+
|
|
37
|
+
Run the same command that installed it — the npm, curl or PowerShell line
|
|
38
|
+
above, whichever put the binary there. Using a different one leaves two
|
|
39
|
+
`postman` binaries and a `PATH` question. Never `npm install -g` over a copy
|
|
40
|
+
that came from the curl installer or a system package manager.
|
|
41
|
+
|
|
42
|
+
The CLI has no self-update verb. `postman skills update` is a different
|
|
43
|
+
thing: it refreshes a repository's committed `postman/skills/`, not the
|
|
44
|
+
binary.
|
|
45
|
+
|
|
46
|
+
## Uninstall
|
|
47
|
+
|
|
48
|
+
npm installations:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm uninstall -g postman-cli
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Other install methods: delete the `postman` binary from its install
|
|
55
|
+
directory (`%USERPROFILE%\AppData\Local\Microsoft\WindowsApps` on Windows,
|
|
56
|
+
`/usr/local/bin` on macOS/Linux/WSL).
|
|
57
|
+
|
|
58
|
+
Source: https://learning.postman.com/docs/postman-cli/postman-cli-installation/
|