@postman/postman-plugin 0.3.0 → 0.4.1-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.
Files changed (48) hide show
  1. package/README.md +46 -9
  2. package/dist/hosts/antigravity.js +47 -0
  3. package/dist/hosts/codex-hooks.js +68 -0
  4. package/dist/hosts/codex.js +87 -8
  5. package/dist/hosts/copilot.js +60 -0
  6. package/dist/hosts/index.js +3 -1
  7. package/dist/json-rpc.js +113 -0
  8. package/dist/system.js +40 -3
  9. package/mcp.pi.json +2 -2
  10. package/package.json +1 -1
  11. package/skills/ai-readiness/SKILL.md +40 -44
  12. package/skills/api-discovery/SKILL.md +64 -145
  13. package/skills/api-discovery/reference/orbit.md +17 -5
  14. package/skills/api-documentation/SKILL.md +41 -46
  15. package/skills/api-engineer/SKILL.md +78 -23
  16. package/skills/api-mocking/SKILL.md +117 -163
  17. package/skills/api-monitoring/SKILL.md +52 -129
  18. package/skills/api-simulation/SKILL.md +130 -178
  19. package/skills/api-simulation/reference/sim_yaml_schema.md +41 -103
  20. package/skills/api-testing/SKILL.md +48 -95
  21. package/skills/bootstrap/SKILL.md +123 -224
  22. package/skills/ci-integration/SKILL.md +53 -113
  23. package/skills/collection-schema-v3/SKILL.md +43 -204
  24. package/skills/collection-schema-v3/reference/http.md +150 -0
  25. package/skills/datasets/SKILL.md +89 -315
  26. package/skills/datasets/reference/spreadsheets.md +25 -0
  27. package/skills/flows/SKILL.md +57 -206
  28. package/skills/flows/reference/flow_cli_flags.md +3 -2
  29. package/skills/performance-testing/SKILL.md +46 -62
  30. package/skills/performance-testing/references/jmeter-import/README.md +82 -0
  31. package/skills/performance-testing/references/jmeter-import/import-report.md +52 -0
  32. package/skills/performance-testing/references/jmeter-import/mapping-table.md +95 -0
  33. package/skills/performance-testing/references/jmeter-import/postman-perf-capabilities.md +56 -0
  34. package/skills/performance-testing/references/jmeter-import/script-translation.md +97 -0
  35. package/skills/postman-mcp-server/SKILL.md +53 -59
  36. package/skills/postman-mcp-server/references/docs.md +0 -1
  37. package/skills/postman-mcp-server/references/learn.md +10 -9
  38. package/skills/postman-mcp-server/references/mock.md +0 -1
  39. package/skills/postman-mcp-server/references/search.md +0 -1
  40. package/skills/postman-mcp-server/references/security.md +0 -1
  41. package/skills/postman-mcp-server/references/setup.md +0 -1
  42. package/skills/postman-mcp-server/references/sync.md +0 -1
  43. package/skills/postman-mcp-server/references/test.md +0 -1
  44. package/skills/variables/SKILL.md +44 -87
  45. package/skills/webhook-testing/SKILL.md +103 -0
  46. package/skills/webhook-testing/reference/forwarding.md +10 -0
  47. package/skills/webhook-testing/reference/outbound_webhooks.md +25 -0
  48. package/skills/webhook-testing/reference/webhook_scripts.md +163 -0
@@ -1,169 +1,123 @@
1
1
  ---
2
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 a workspace and deployed at 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 workspace (`-w`, or the workspace linked in `.postman/resources.yaml`) — generating and running a mock locally needs nothing from bootstrap.
3
+ description: Finds, builds, runs and publishes a stand-in for one API — the owning team's published mock when there is one, otherwise one built from its spec or collection that behaves like the real API, stateful when callers write then read. Use when something needs an API that isn't built or reachable yet (a frontend, client or demo), when other teams should build against your API before it ships, or when asked to mock an API or fake a backend. To run and test your own code against the services it calls, use api-simulation. Covers `postman mock` and `postman dependency add mock`.
4
4
  ---
5
5
 
6
6
  # API Mocking
7
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, the Simulations surface), 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 workspace and deploying a
20
- durable URL — needs `postman login`. The progression is one model in three
21
- places: local folder ──`push`──▶ Code Mock (workspace 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 a workspace. 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
- Mocking another team's service, or the services your own service calls? Use
32
- `api-simulation`, which checks each owner's workspace for a published mock
33
- before anything is generated here.
34
-
35
- ## Process
36
-
37
- 1. **Generate.** `postman mock generate -n NAME` with no source scaffolds a
38
- sample shopping-cart mock (`POST /cart/items`, `GET /cart`, `POST /checkout`)
39
- — the fastest way to a server that already answers, useful whenever the
40
- point is exercising mock *behavior* rather than a specific API's shape. Pass
41
- a real source — `postman mock generate SOURCE -n NAME`, where `SOURCE` is a
42
- collection file/directory or an `openapi.yaml` — when the endpoints need to
43
- mirror an actual API. Either form writes `config.yaml` + `default.js` into
44
- `postman/mocks/NAME/` (default port 4500).
45
- - `postman mock generate SOURCE --update ./postman/mocks/NAME` regenerates
46
- the default handler from the source in place, keeping the existing name,
47
- port, and scenarios. `--update` still needs the `SOURCE`; it cannot be
48
- combined with `--output`.
49
- - `-w <workspaceId>` saves the mock to a workspace *instead of* the
50
- repository — it writes no local files and requires being logged in. Cannot
51
- be combined with `--output`, `--force`, or `--update`. Prefer local
52
- generate + later `push` when you still need `mock run` from a folder.
53
- 2. **Run it.** `postman mock run ./postman/mocks/NAME` starts the server and
54
- prints the bound URL (`... at http://localhost:PORT`). If the port in
55
- `config.yaml` is taken and `--port` wasn't passed explicitly, it falls back
56
- to a free OS-assigned port instead of erroring — read the real port off that
57
- line rather than assuming the configured one. Naming `--port N` explicitly
58
- makes a taken port a hard error; `--port auto` always picks a free one.
59
- 3. **Call it.** Plain `postman request localhost:PORT/route` returns the
60
- default scenario's response. Two headers can change that per-request, with no
61
- restart: `x-mock-scenario: <name>` selects a scenario the mock defines
62
- (valid names live in `config.yaml`); a name the mock doesn't define is not an
63
- error — it falls back to the default scenario. `x-mock-response-code: <code>`
64
- filters an endpoint's saved example responses to the one with that status, so
65
- it only changes anything when that endpoint actually has an example for that
66
- code — mocks generated from a collection/spec with multiple example statuses
67
- honor it; the built-in sample mock has one response per route and ignores it.
68
- A wrong route comes back as `Endpoint not defined`. There's no hot reload: a
69
- `default.js` edit does nothing until you Ctrl+C the running server and
70
- `mock run` it again.
71
- 4. **Push it, if it needs to leave your machine.**
72
- `postman mock push ./postman/mocks/NAME` is safe to re-run — `Created` the
73
- first time, `Updated` after — and records the workspace mapping in
74
- `.postman/resources.yaml`; commit that change. If a mock server is already
75
- live for this mock, the push updates what it serves.
76
- 5. **Deploy it, for a URL that outlives your terminal.**
77
- `postman mock deploy WORKSPACE_MOCK_ID -s SLUG -y` prints
78
- `https://SLUG.mock.<team-domain>.postman.dev`. Deployed private by default —
79
- callers need a Postman API key (`x-api-key`) — add `--public` only when the
80
- mock should be reachable by anyone with the URL. `--auto-deploy` re-publishes
81
- the live server automatically whenever the mock changes; even without it, a
82
- later `push` already updates a live server, so you only re-`deploy` for the
83
- first URL or after taking the server down.
84
- 6. **See who's calling it.** `postman mock get WORKSPACE_MOCK_ID` (table or `--json`)
85
- returns `mockServerId`; feed that into `postman mock log MOCK_SERVER_ID` for
86
- call entries (filter with `--method` / `--status` / `--path` / `--since` /
87
- `--until` / `--limit`, or `--json`). An empty log means the URL genuinely
88
- hasn't been hit — a rejected caller still shows up, recorded with its failing
89
- status code.
90
- 7. **Tear down.**
91
- - Local: `postman mock delete ./path --yes` — refuses while that mock is
92
- **running** locally; stop `mock run` first.
93
- - Workspace: `postman mock delete WORKSPACE_MOCK_ID --yes` — refuses while the mock is
94
- **running locally** *or* **deployed**; stop the local run and take the
95
- mock server down first.
96
- Workspace deletion doesn't touch `.postman/resources.yaml`; drop that line by hand
97
- afterward or the repo keeps claiming a mock that's gone.
98
-
99
- To point real request/assertion runs at a mock instead of hand-editing
100
- base-URL variables, see the `api-testing` skill's `--use-mock`/`--mock` flags
101
- on `collection run`.
102
-
103
- To develop a service against mocks of every upstream it calls, started together
104
- as one simulation, see the `api-simulation` skill and `postman simulation run`.
105
-
106
- ## Stateful mocks
107
-
108
- A mock generated from a collection or spec replays its examples, so a `POST`
109
- and a later `GET` share nothing. To make a mock remember, keep its records in
110
- `pm.state` inside `default.js`. `pm.state` is the mock's async key-value
111
- store: `get`, `set`, `delete`, `has`, `keys` and `clear`. The sample from
112
- `postman mock generate -n NAME` already uses it, and shows the pattern.
113
-
114
- Every `mock run` or `simulation run` starts the mock with empty state; during
115
- the run, its handler creates, reads, updates and deletes records through
116
- `pm.state`. A deployed mock server keeps its state between requests.
117
-
118
- - Set `interceptRequests: true` in `config.yaml` so `req.body` and `req.query`
119
- arrive parsed.
120
- - Seed the starting records on first use, and add a reset route that clears
121
- and reseeds them, so a test can start clean.
122
- - Answer an unknown id with the real service's 404, not an empty `200`.
123
- - Every caller shares one state unless it sends `x-mock-session`. Locally that
124
- needs `interceptRequests: true`; a deployed server reads it only when the
125
- mock has sessions enabled.
126
-
127
- ## The two ids that matter
128
-
129
- - **Code-mock id** — the `id` in `config.yaml`, and the id that `push` and
130
- `generate -w` print (often the same value). Use it for `get`, `deploy`,
131
- `delete`, and `run` by workspace mock id.
132
- - **`mockServerId`** — a different value from `mock get WORKSPACE_MOCK_ID` (table or
133
- `--json`). Use it for `mock log`, and nothing else.
134
-
135
- ## Critical Rules
136
-
137
- 1. **When you're not signed in, every gated workspace command fails closed:**
138
- `Authentication required. Run postman login or provide --api-key`, exit 1,
139
- nothing half-done. (Signed in but lacking access fails differently — a
140
- permission or missing-workspace error.) Whether a command is gated is decided
141
- by what you pass it, not the verb — `mock get`/`mock run` take either a local
142
- path (ungated) or a workspace mock ID (gated); `mock list` is gated only when called
143
- with no path.
144
- 2. **`push` is what moves an existing local mock to the workspace — `-w` at
145
- `generate` time is optional, not a fork you must choose up front.** A mock
146
- built as a guest can be pushed and deployed later with no rework. Do not
147
- assume `generate -w` left a `postman/mocks/NAME/` folder to `run`.
148
- 3. **`--public` on `deploy` is the one action here with real exposure** — it
149
- stands up a server anyone with the URL can hit, with no API key. The default
150
- (private) is the safe one; confirm intent before adding it.
151
- 4. **To change a mock:** refresh it from a source with
152
- `postman mock generate SOURCE --update PATH`, or edit `default.js` by hand
153
- and restart `mock run`. Never pass a code-mock id to `mock log` — that
154
- command takes a `mockServerId`.
155
- 5. **`-w`/`--workspace` only exists on `generate`, `list`, `push`, and
156
- `deploy`.** `get`, `run`, `log`, and `delete` already take a path or an id
157
- that says where the mock is — there's nothing left for `-w` to resolve on
158
- those.
159
-
160
- ## Verification
161
-
162
- A mock isn't done because `generate` or `run` exited 0 — hit it with
163
- `postman request` and check the actual status/body, or `mock get WORKSPACE_MOCK_ID
164
- --json` for a pushed one, then state whether it ended up local, pushed, or deployed, and
165
- (if deployed) private or public. For a scenario check, confirm a *valid* name
166
- from `config.yaml` actually changed the response — a typo'd name falls back to
167
- the default, so a 200 alone proves nothing. For a status-code check, use an
168
- endpoint that has an example for that code (not the sample mock). A passing
169
- exit code from `request` is not enough.
8
+ A mock is a folder, `config.yaml` plus a handler such as `default.js`, that
9
+ answers like an API. The handler is a Node HTTP server that calls
10
+ `listen(process.env.PORT)`. It loads as CommonJS even in an ESM project, so
11
+ `import` fails: use `require`. The same mock lives in your repo
12
+ (`postman/mocks/<name>/`, run with `postman mock run`, no sign-in needed),
13
+ in a Postman workspace after `postman mock push`, where other teams pull it
14
+ from, and on a mock server after `postman mock deploy`, for callers that
15
+ can't run it themselves.
16
+
17
+ Several APIs at once, for a service, a frontend or a test suite? Use
18
+ `api-simulation`, which gets each member's mock here.
19
+
20
+ ## Use the owner's mock first
21
+
22
+ When the API belongs to another team, look for their published mock before
23
+ writing one: theirs encodes their contract and their service's state; yours
24
+ encodes a guess. It needs `postman login`; signed out, build one and say the
25
+ owner search was skipped.
26
+
27
+ 1. Find the owner's workspace with `postman search workspaces "<service>" -o json`.
28
+ Name the service plainly, as your code does, not by what it returns: a
29
+ description matches lookalike services. Prefer a Git-connected workspace
30
+ (`isGitConnected`) named for that service.
31
+ 2. List its mocks with `postman mock list -w <workspaceId> --json`.
32
+ `postman search mocks` misses some, and its `classicMock` results only
33
+ replay a collection's saved examples: `postman mock` can't pull or run
34
+ them, so call one at `https://<mockId>.mock.pstmn.io` with
35
+ `postman request`, or generate a code mock from its collection. A
36
+ same-named mock in another workspace isn't the owner's.
37
+ 3. Pull it with `postman dependency add mock <mockId>` and use it as it is.
38
+ Never edit `postman/.dependencies/`: `dependency update` overwrites it,
39
+ so copy a mock to `postman/mocks/` to change it. A pulled copy loses
40
+ `interceptRequests`, so fork one whose handler reads `req.body` or relies
41
+ on sessions. A mock is code that runs as you; pull only from workspaces
42
+ you trust.
43
+
44
+ ## Or build one that behaves like the real API
45
+
46
+ Callers shouldn't be able to tell the difference on the paths they use. A
47
+ mock that returns invented JSON passes your tests and fails against the
48
+ real service.
49
+
50
+ - **Start from the contract.** `postman mock generate <spec or collection>`
51
+ writes each documented response. It's a replay: a `POST` and a later
52
+ `GET` share nothing, and it accepts any request, so a call that breaks the
53
+ contract still gets its answer. `x-mock-response-code` picks only a
54
+ documented status; any other code gets the default 200, so put the errors
55
+ callers handle (the unknown-id 404, the conflict 409, the bad-input 400) in
56
+ the contract. From a spec
57
+ it serves the server URL's base path (`/v2/...`); from a collection,
58
+ routes start after the base-URL variable. `--update` regenerates the
59
+ handler and overwrites your edits. With no contract, write it from how
60
+ your code calls the API and say what you assumed.
61
+ - **Set `interceptRequests: true` in `config.yaml`.** Without it `req.body`
62
+ and `req.query` are undefined, `x-mock-session` is ignored, and a throw in
63
+ an async handler kills the mock instead of returning a `500`.
64
+ - **Make it stateful when callers write then read.** Keep records in
65
+ `pm.state`, seed them on first use, add a reset route so a test can start
66
+ clean, and answer an unknown id with the real 404. Every `mock run` starts
67
+ empty.
68
+ - **Know who shares state.** Locally, all callers share one state unless
69
+ each sends `x-mock-session: <id>`. A mock server deployed from the CLI
70
+ isolates each caller: one that keeps neither the same `x-mock-session` nor
71
+ the `pm_mock_session` cookie starts from the seed on every request, so its
72
+ `POST` and later `GET` never meet.
73
+ - **Scenarios** are named handlers in `config.yaml`'s `scenarios` list, picked
74
+ per request with `x-mock-scenario: <name>`. An unknown name falls back to
75
+ the default locally but is a `404` on a mock server.
76
+
77
+ ## Check it against the contract
78
+
79
+ `postman mock run` prints the URL it bound; a busy configured port moves
80
+ unless you pass `--port`, so take the URL from that line. Nothing reloads:
81
+ restart it after an edit.
82
+
83
+ A mock checked against the handler you just wrote proves nothing, so call
84
+ it with requests from the contract: `postman request`, or the API's
85
+ collection with
86
+ `postman collection run <collection> --use-mock "{{baseUrl}} mock:postman/mocks/<name>"`
87
+ (`--mock` alone only starts it). That form replaces the variable's whole
88
+ value, base path included, so a mock generated from a spec that serves
89
+ `/v2/...` answers `404`; start that one with `--mock <path> --port <n>` and
90
+ pass `--env-var "baseUrl=http://localhost:<n>/v2"`. To check your own calls
91
+ against a contract, compare each one, from the code or a simulation log,
92
+ with the spec; the mock won't reject a wrong one.
93
+
94
+ ## Publish it for other teams
95
+
96
+ - **Push it to the service's own workspace,** the one this repo is linked
97
+ to or the one the user names, never one chosen by name match: other
98
+ teams' simulations look there. Signed out, the push fails but the local
99
+ mock still works; build it, say so and ask the user to sign in. Keep it
100
+ honest: change the mock in the same PR as the API and run the API's
101
+ collection against it.
102
+ - **Deploy only when a caller needs a URL.** The server takes a slug of 3–32
103
+ lowercase letters, digits and single hyphens, starting and ending with a
104
+ letter or digit; the CLI accepts more, and its default can be too long.
105
+ It's private: callers send an API key as `x-api-key`, or, if they can
106
+ view the workspace, an access token as `x-access-token`. Deploying needs a paid plan; a team's first
107
+ server can take minutes to answer, and teams that review deploys hold them
108
+ for approval. Each later `push` changes what every caller of the server
109
+ gets, so treat it as a release, not a backup.
110
+ - **Write it for where it runs.** A mock server runs each scenario as one
111
+ file with Node's built-ins, not `fs` or `child_process`: no local
112
+ `require`s, no `pm.mock` examples, no environment, no console output, and
113
+ no caller `authorization`, `cookie` or `x-api-key` headers. A mock that
114
+ relies on any of these works locally and breaks once deployed.
115
+ - **Ask before `--public`.** It serves the mock and its data to anyone with
116
+ the URL, and a scripted redeploy can't make it private again.
117
+
118
+ ## Before you say it's done
119
+
120
+ A mock isn't done because it started. Call it: a documented error comes
121
+ back, a valid scenario changes the response, a `POST` then `GET` shows state
122
+ if it should. Say where it runs and who can call it, where it lives, and
123
+ what you assumed.
@@ -1,138 +1,61 @@
1
1
  ---
2
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).
3
+ description: Use when setting up recurring API checks, running or diagnosing a Postman Monitor, changing its schedule, or reaching private APIs through a self-hosted runner. Reuses collection assertions to detect live regressions and traces failures to individual run evidence. Use for requests such as "check this API every minute".
4
4
  ---
5
5
 
6
6
  # API Monitoring
7
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. Runner activity is published to the connected
103
- workspace by default; `--no-report-events` keeps it local. `runner list`
104
- shows the team's registered self-hosted runners —
105
- feed an id from here into `monitor create/update --runner` or `monitor list
106
- --runner`. `runner regions` lists the Postman-region and private-runner
107
- values valid for `--runner` on `monitor create`/`update`, including a
108
- static IP where one is configured — check here before guessing a region
109
- string.
110
-
111
- ## Critical Rules
112
-
113
- 1. **`update` can't move a monitor to a different collection or environment,
114
- and doesn't pause/resume it.** Delete and recreate for the former; use
115
- `pause`/`resume` for the latter.
116
- 2. **A `monitor run -t` timeout is a wait cap, not a monitor failure.**
117
- Don't report "the monitor failed" from a timeout without checking
118
- `monitor jobs get`/`monitor runs get` (or the Postman app) for what the
119
- run actually did after the CLI gave up waiting — or avoid the wait
120
- entirely with `--async`.
121
- 3. **`--runner` on `monitor create`/`update` takes a region name or a
122
- self-hosted runner id — check `runner regions`/`runner list` before
123
- guessing a string,** and don't suggest `runner start` unless the target
124
- API genuinely isn't reachable from Postman's cloud.
125
- 4. **`monitor list --offset` doesn't work — use `--cursor`,** and
126
- `--runner` there can't be combined with the other filters.
127
- 5. **`monitor delete` is permanent.** Confirm intent before passing `-y` to
128
- skip its prompt.
8
+ A monitor turns a saved collection into recurring evidence about a live API.
9
+ It can catch behavior that changes after deployment or between developer
10
+ sessions, but only if its assertions, environment, and execution location
11
+ exercise the guarantees users depend on.
12
+
13
+ 1. Reuse the collection's meaningful assertions before scheduling it. A
14
+ request returning 200 is a weak health signal if the response can violate
15
+ the contract. Check auth, target environment, and write side effects; use
16
+ **api-testing** to establish what the collection actually verifies.
17
+ 2. Choose cadence, timezone, execution location, and alert recipients from
18
+ the operational need. `postman monitor create -c <collection-id>` uses
19
+ the linked workspace unless one is supplied. Inspect command-specific
20
+ `-h` and available service options for supported schedules and limits.
21
+ Creation starts an immediate run by default; `--no-run-now` avoids that
22
+ when only scheduling was requested. A schedule expressed in the host's
23
+ default timezone can fire at the wrong operational time.
24
+ 3. Choose a Postman region for a reachable public API. Use a self-hosted
25
+ runner when the target is reachable only inside the user's network;
26
+ running one adds infrastructure to maintain. `postman runner regions`
27
+ provides valid hosted locations and `runner list` provides registered
28
+ private runner IDs. `monitor create/update --runner` accepts either;
29
+ multiple locations help distinguish API failures from regional reachability.
30
+ 4. Preserve monitor identity when updating schedule or run settings.
31
+ `monitor update` cannot change its collection or environment and does not
32
+ pause it; use `pause`/`resume` for that. A different collection/environment
33
+ requires a replacement, so plan the handoff before deleting the old
34
+ monitor and its continuity. Permanent deletion needs explicit intent.
35
+ 5. Use `postman monitor run <id>` for an immediate verdict, such as after a
36
+ deploy. `--async` returns a job handle when the caller need not wait.
37
+ The CLI timeout caps waiting, not execution; after a timeout, inspect
38
+ the submitted job instead of sending duplicate traffic or reporting failure.
39
+ 6. Diagnose at the level of the evidence. `monitor jobs list <monitor-id>`
40
+ finds jobs, `monitor jobs get <job-id>` shows terminal state and regional
41
+ outcomes, and `monitor runs get <run-id>` shows assertions within an
42
+ attempt. A failing region, a connection error, and a failed assertion
43
+ imply different fixes. Preserve normal exit-code failures for CI gates.
44
+
45
+ For discovery, `monitor list` supports workspace and collection filters;
46
+ use its returned cursor for pagination rather than offset. Its runner filter
47
+ is for a self-hosted ID and cannot be combined with other filters; a page-local
48
+ name filter does not establish absence across all pages.
49
+
50
+ For a private runner, use `runner start` with the registered ID and key and
51
+ verify that it connects before assigning runs. Inspect its help for proxy,
52
+ private CA, residency, and health-metric options only when the network requires
53
+ them. Runner activity is reported by default; `--no-report-events` disables
54
+ that reporting when the task requires it. Use **bootstrap** for unresolved
55
+ authentication rather than placing runner keys in repository files.
129
56
 
130
57
  ## Verification
131
58
 
132
- State the monitor/job/run id and the actual pass/fail result or
133
- configuration change, not just that the command exited. For `run`, state
134
- whether it completed synchronously or was submitted `--async` (a job id is
135
- not yet a verdict — resolve it with `monitor jobs get` before reporting a
136
- result). If a self-hosted runner was started, confirm it registered (the
137
- Postman app, or `runner list`, shows it as connected) before assuming
138
- monitor runs will route through it.
59
+ Report the actual monitor configuration or terminal job/run outcome, including
60
+ where it executed and which checks failed. A created monitor, accepted job,
61
+ or connected runner alone does not prove the API passed its health checks.