@postman/postman-plugin 0.1.1-rc.0 → 0.1.2

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 (40) hide show
  1. package/README.md +14 -2
  2. package/dist/cli.js +7 -1
  3. package/dist/hosts/index.js +2 -1
  4. package/dist/hosts/kimi.js +5 -2
  5. package/dist/hosts/pi.js +84 -0
  6. package/dist/pi-extension.js +27 -0
  7. package/dist/run.js +16 -10
  8. package/dist/source.js +3 -1
  9. package/hooks/session-start-context.md +11 -0
  10. package/mcp.pi.json +14 -0
  11. package/package.json +21 -6
  12. package/skills/ai-readiness/SKILL.md +50 -0
  13. package/skills/api-discovery/SKILL.md +135 -0
  14. package/skills/api-discovery/reference/orbit.md +101 -0
  15. package/skills/api-documentation/SKILL.md +34 -0
  16. package/skills/api-documentation/reference/rest-api-best-practices.md +47 -0
  17. package/skills/api-engineer/SKILL.md +29 -0
  18. package/skills/api-mocking/SKILL.md +141 -0
  19. package/skills/api-monitoring/SKILL.md +137 -0
  20. package/skills/api-testing/SKILL.md +103 -0
  21. package/skills/bootstrap/SKILL.md +216 -0
  22. package/skills/bootstrap/reference/cli_installation.md +58 -0
  23. package/skills/ci-integration/SKILL.md +121 -0
  24. package/skills/collection-schema-v3/SKILL.md +210 -0
  25. package/skills/collection-schema-v3/reference/environment.md +63 -0
  26. package/skills/collection-schema-v3/reference/other_protocols.md +86 -0
  27. package/skills/datasets/SKILL.md +323 -0
  28. package/skills/flows/SKILL.md +212 -0
  29. package/skills/flows/reference/flow_cli_flags.md +111 -0
  30. package/skills/performance-testing/SKILL.md +71 -0
  31. package/skills/postman-mcp-server/SKILL.md +71 -0
  32. package/skills/postman-mcp-server/references/docs.md +88 -0
  33. package/skills/postman-mcp-server/references/learn.md +73 -0
  34. package/skills/postman-mcp-server/references/mcp-limitations.md +38 -0
  35. package/skills/postman-mcp-server/references/mock.md +101 -0
  36. package/skills/postman-mcp-server/references/search.md +83 -0
  37. package/skills/postman-mcp-server/references/security.md +129 -0
  38. package/skills/postman-mcp-server/references/setup.md +141 -0
  39. package/skills/postman-mcp-server/references/sync.md +85 -0
  40. package/skills/postman-mcp-server/references/test.md +84 -0
@@ -0,0 +1,47 @@
1
+ # REST API Design Practices
2
+
3
+ - **Resource naming.** Nouns, not verbs, in the path (`POST /orders`, not
4
+ `POST /createOrder`). Plural collections, consistent casing, nesting
5
+ reflects real relationships and rarely goes past two levels deep.
6
+ - **HTTP methods.** GET is read-only and safe to repeat. POST creates.
7
+ PUT replaces a whole resource and is idempotent. PATCH updates part of
8
+ one. DELETE removes and is idempotent. Never use GET to change state.
9
+ - **Status codes.** 2xx for success (201 + `Location` on create, 204 for
10
+ no body), 4xx for client mistakes (401 vs. 403 vs. 404 vs. 409 vs. 422
11
+ each mean something distinct), 5xx for server failure. Inconsistent
12
+ codes are one of the most common sources of client bugs.
13
+ - **Error responses.** One consistent shape across every endpoint, with a
14
+ stable machine-readable `code` plus a human-readable `message`, and all
15
+ validation failures returned together rather than one at a time.
16
+ - **Versioning.** Decide the strategy (URI path like `/v2/users`, or a
17
+ version header) before the first breaking change forces the question.
18
+ A breaking change is a removed/renamed field, a changed type, or a
19
+ changed auth requirement — additive changes don't need a new version.
20
+ - **Pagination.** Page/offset pagination is simple but can skip or repeat
21
+ items when the underlying data changes mid-list; cursor-based
22
+ pagination avoids that and holds up better for feeds and high-write
23
+ data. Either way, return the metadata a client needs to fetch the next
24
+ page without guessing.
25
+ - **Filtering, sorting, searching.** Query parameters with names that say
26
+ what they filter/sort on, not internal field names.
27
+ - **Auth.** API keys for server-to-server; OAuth bearer tokens when a
28
+ request needs to represent a specific user, scoped rather than
29
+ all-or-nothing. HTTPS always. Rate limits communicated through response
30
+ headers, not discovered by hitting them.
31
+ - **Idempotency.** GET/PUT/DELETE are naturally or by-design idempotent;
32
+ POST isn't, so a client that might retry a POST (payments, especially)
33
+ needs an idempotency key the server can recognize on retry.
34
+ - **Content type and shape.** JSON by default; keep response bodies flat
35
+ rather than deeply nested, and let a client ask for only the fields it
36
+ needs on large resources.
37
+ - **Observability.** Log method, endpoint, status, and latency per
38
+ request; return a request ID in the response so a client's bug report
39
+ can be traced to server-side logs.
40
+ - **Backward compatibility.** Add fields instead of changing or removing
41
+ them where possible. When something really must go, announce it, give
42
+ a migration path, and run the old and new versions side by side for a
43
+ window — a deprecation header on responses beats a changelog entry
44
+ nobody reads.
45
+ - **Testing.** Beyond the happy path: auth failures, validation errors,
46
+ rate limiting, and retries — the same edge cases a thin API-readiness
47
+ score (see `ai-readiness`) tends to catch missing coverage for.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: api-engineer
3
+ description: Default entry point for API engineering work — designing, implementing, mocking, testing, monitoring, documenting, or deploying an API.
4
+ ---
5
+
6
+ # API Engineer
7
+
8
+ ## Foundations
9
+ 1. Contract comes first. Establish and document the contract before starting implementation.
10
+ 2. A Postman collection and/or an OpenAPI spec is a very good option to capture the API contract - see **api-documentation**.
11
+ 3. Always validate the change against the contract you started with. Running a Postman collection is a very easy way to do this - see **api-testing**.
12
+ 4. Always propose next steps. Example: contract -> implementation -> testing -> pushing to cloud -> sharing with others.
13
+ 5. Don't jump straight into implementation. Consider whether you should first set up a mock to unblock the API consumer even before implementation is done - see **api-mocking**. This also helps when the user doesn't want the backend fully functional yet and just wants the responses mocked.
14
+ 6. Don't push to the cloud workspace (`postman workspace push`) without user consent. The recommended way to push to the cloud is a CI step on PR merge - see **ci-integration**.
15
+ 7. For high-quality API search results, use **api-discovery**.
16
+ 8. No is an acceptable answer. Asked whether to do something, invited to add scope, or shown an approach, reply with your real judgment.
17
+ 9. Prefer filesystem-first Postman workflows. For an existing cloud workspace,
18
+ `postman workspace pull <id>` connects it and materializes its collections,
19
+ environments, and specs locally. When no cloud workspace exists, `postman
20
+ init --no-cloud` initializes the local structure. Work against those files,
21
+ validate them, and push only with user consent; sharing an already-bound
22
+ workspace means `workspace push`, not creating a duplicate. See
23
+ **bootstrap** for the lifecycle decision table.
24
+ 10. When actual use exposes a concrete Postman CLI gap or a misleading skill, handle the user's task first — then use `postman feedback` to report the gaps/bugs. Exclude secrets, user data, and proprietary content
25
+
26
+ ## Dos
27
+ 1. Prove it works - validate the task against the contract. See **api-testing**.
28
+ 2. Just do it - never block on the human. When tempted to ask "should I do X?" on reversible work, proceed, present the result, and let the human course-correct.
29
+ 3. Fight for good API design. See **api-documentation**.
@@ -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.