{"id":134882,"plugin_id":"plugin_asdk_app_6a6b12e06c5c8191ac5d5252fa5f92c8","kind":"skill","collection_source":"plugin_package","comparison_source":"plugin_package","observed_at":"2026-12-03T18:16:06.474Z","digest":"3493b0a5d9ec687ba2d2d519e6b2e108853f077cafe421cd6f6b846459ad03b3","against":101691,"payload":{"description":"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. Finds, builds, runs and publishes a stand-in for one API — a published mock when its owner or a verified publisher has one, otherwise one built from its spec or collection, stateful when callers write then read, answering with real records from a sheet or database. To run your own code against the services it calls, use postman:api-simulation. Covers `postman mock` and `postman dependency add mock`.","included_files":[],"name":"api-mocking","skill_md_contents":"---\nname: api-mocking\ndescription: 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. Finds, builds, runs and publishes a stand-in for one API — a published mock when its owner or a verified publisher has one, otherwise one built from its spec or collection, stateful when callers write then read, answering with real records from a sheet or database. To run your own code against the services it calls, use postman:api-simulation. Covers `postman mock` and `postman dependency add mock`.\n---\n\n# API Mocking\n\nA mock is a folder, `config.yaml` plus a handler such as `default.js`, that\nanswers like an API. The handler is a Node HTTP server that calls\n`listen(process.env.PORT)`. It loads as CommonJS even in an ESM project, so\n`import` fails: use `require`. The same mock lives in your repo\n(`postman/mocks/<name>/`, run with `postman mock run`, no sign-in needed),\nin a Postman workspace after `postman mock push`, where other teams pull it\nfrom, and on a mock server after `postman mock deploy`, for callers that\ncan't run it themselves.\n\n`postman init --json` at the repo root scaffolds the directory API work lives\nin: `postman/` beside the code, registered in `.postman/resources.yaml`, with\n`postman/specs/` and `postman/collections/` for the contract a mock is\ngenerated from and checked against. That gives the mock, and the work around\nit, a place that outlasts the session: the next session or a teammate reruns\nit instead of rebuilding it. Init needs no sign-in or approval. Signed out, it\nstarts a temporary session, so commands that need a session work before the\nuser has an account; see **postman:workspaces**' \"What init unlocks\".\n\nSeveral APIs at once, for a service, a frontend or a test suite? Use\n`postman:api-simulation`, which gets each member's mock here.\n\n## Use a published mock first\n\nWhen the API belongs to another team or a third-party provider, look for a\npublished mock before writing one: a maintained mock encodes the contract\nand the service's state; yours encodes a guess.\n\nA published mock lives in its owner's workspace, which only a signed-in CLI\ncan search and pull from (see **postman:api-discovery**). Signed out, build one\ninstead and say the search was skipped.\n\n1. Find the mock.\n   - **Another team's service:** find the owner's workspace with\n     `postman search workspaces \"<service>\" -o json`. Name the service\n     plainly, as your code does, not by what it returns: a description\n     matches lookalike services. Prefer a Git-connected workspace\n     (`isGitConnected`) named for that service, then list its mocks with\n     `postman mock list -w <workspaceId> --json`. `postman search mocks`\n     misses some, and a same-named mock in another workspace isn't the\n     owner's.\n   - **A third-party API,** such as a payment or email provider: search\n     mocks directly with\n     `postman search mocks \"<provider>\" --ownership all -o json`. The\n     workspace that holds one is rarely named for the provider, and the\n     default ownership searches only your organization. Prefer a `codeMock`\n     named for the provider from a verified organization\n     (`organization.isVerified`).\n\n   A `classicMock` only replays a collection's saved examples: `postman mock`\n   can't pull or run it, so call one at `https://<mockId>.mock.pstmn.io` with\n   `postman request`, or generate a code mock from its collection.\n2. Pull it with `postman dependency add mock <mockId>`, run the folder it\n   writes with `postman mock run`, and use it as it is. Commit\n   `postman/.dependencies/` when CI should run it without signing in;\n   otherwise CI restores it with `dependency install`, which needs a sign-in\n   (see **postman:api-discovery**). Never edit `postman/.dependencies/`:\n   `dependency update` overwrites it, so copy a mock to `postman/mocks/` to\n   change it. A mock is code that runs as you; pull only from publishers you\n   trust.\n\n## Or build one that behaves like the real API\n\nCallers shouldn't be able to tell the difference on the paths they use. A\nmock that returns invented JSON passes your tests and fails against the\nreal service.\n\n- **Start from the contract.** `postman mock generate <spec or collection>`\n  writes each documented response. It's a replay: a `POST` and a later\n  `GET` share nothing, and it accepts any request, so a call that breaks the\n  contract still gets its answer. `x-mock-response-code` picks only a\n  documented status; any other code gets the default 200, so put the errors\n  callers handle (the unknown-id 404, the conflict 409, the bad-input 400) in\n  the contract. From a spec\n  it serves the server URL's base path (`/v2/...`); from a collection,\n  routes start after the base-URL variable. `--update` regenerates the\n  handler and overwrites your edits. With no contract, write it from how\n  your code calls the API and say what you assumed.\n- **Answer from the real records.** When the data an API serves already\n  lives in a catalog sheet, a CSV or a database table, put it in a dataset\n  (named, queryable tables built from your CSV, JSON, sheet or database)\n  and have the handler query it per request: it returns real ids, prices\n  and edge cases, while hand-written JSON returns what you invented and\n  drifts as the data changes. The same dataset also feeds the API's tests,\n  CI and monitors, so there's no separate seed file to keep in step. To\n  create the dataset's `.dataset.yaml` file, see **postman:datasets**. `mock run\n  --dataset <that file>` gives the handler `pm.datasets('<datasetId>')`,\n  which takes the `id:` from that file, not its name or path. It works\n  signed out for file sources, and a `--ref-only` source serves edits to\n  the file without a restart.\n\n  ```js\n  // Parameters bind to $1, $2, ... in order.\n  const { rows } = await pm.datasets('<datasetId>')\n    .executeQuery('SELECT * FROM products WHERE sku = $1', [sku]);\n  const found = [];\n  for await (const r of rows) found.push(r); // rows can be read only once\n  if (!found.length) { res.writeHead(404); return res.end(); }\n  res.writeHead(200, { 'Content-Type': 'application/json' });\n  res.end(JSON.stringify(found[0])); // CSV values are text: \"price\":\"9.99\"\n  ```\n\n  With `interceptRequests: true` (below), a failed query, such as a wrong\n  id, answers `500` with the reason. A mock that only needs the contract's\n  examples needs no dataset, and writes followed by reads still belong in\n  `pm.state`. For a demo or a frontend that needs a backend it can write to\n  and read back, seeded from those same rows, `mock generate --dataset`\n  bakes up to 20 rows per table into a stateful handler. It needs a sign-in\n  and sends the rows to Postman, so use fixture data, and rerun with\n  `--update` after the data changes.\n- **Set `interceptRequests: true` in `config.yaml`.** Without it `req.body`\n  and `req.query` are undefined, `x-mock-session` is ignored, and a throw in\n  an async handler kills the mock instead of returning a `500`.\n- **Make it stateful when callers write then read.** Keep records in\n  `pm.state`, seed them on first use, add a reset route so a test can start\n  clean, and answer an unknown id with the real 404. Every `mock run` starts\n  empty.\n- **Know who shares state.** Locally, all callers share one state unless\n  each sends `x-mock-session: <id>`. A mock server deployed from the CLI\n  isolates each caller: one that keeps neither the same `x-mock-session` nor\n  the `pm_mock_session` cookie starts from the seed on every request, so its\n  `POST` and later `GET` never meet.\n- **Scenarios** are named handlers in `config.yaml`'s `scenarios` list, picked\n  per request with `x-mock-scenario: <name>`. An unknown name falls back to\n  the default locally but is a `404` on a mock server.\n\n## Check it against the contract\n\n`postman mock run` prints the URL it bound; a busy configured port moves\nunless you pass `--port`, so take the URL from that line. Nothing reloads:\nrestart it after an edit.\n\nA mock checked against the handler you just wrote proves nothing, so call\nit with requests from the contract: `postman request`, or the API's\ncollection with\n`postman collection run <collection> --use-mock \"{{baseUrl}} mock:postman/mocks/<name>\"`\n(`--mock` alone only starts it). That form replaces the variable's whole\nvalue, base path included, so a mock generated from a spec that serves\n`/v2/...` answers `404`; start that one with `--mock <path> --port <n>` and\npass `--env-var \"baseUrl=http://localhost:<n>/v2\"`. To check your own calls\nagainst a contract, compare each one, from the code or a simulation log,\nwith the spec; the mock won't reject a wrong one.\n\n## Publish it for other teams\n\n- **Push it to the service's own workspace,** the one this repo is linked\n  to or the one the user names, never one chosen by name match: other\n  teams' simulations look there. Signed out with no session, the push fails\n  with `Authentication required`; after `postman init --json` it lands in a\n  temporary workspace with no sign-in, which the user keeps by claiming it\n  with `postman signup`. Keep it\n  honest: change the mock in the same PR as the API and run the API's\n  collection against it, so the person reviewing sees the contract change\n  and the mock callers will get side by side.\n- **Deploy only when a caller needs a URL.** The server takes a slug of 3–32\n  lowercase letters, digits and single hyphens, starting and ending with a\n  letter or digit; the CLI accepts more, and its default can be too long.\n  It's private: callers send an API key as `x-api-key`, or, if they can\n  view the workspace, an access token as `x-access-token`. Deploying needs a\n  paid plan or the temporary session from `postman init`; a team's first\n  server can take minutes to answer, and teams that review deploys hold them\n  for approval. Each later `push` changes what every caller of the server\n  gets, so treat it as a release, not a backup.\n- **Write it for where it runs.** A mock server runs each scenario as one\n  file with Node's built-ins, not `fs` or `child_process`: no local\n  `require`s, no `pm.mock` examples, no environment, no console output, and\n  no caller `authorization`, `cookie` or `x-api-key` headers. A mock that\n  relies on any of these works locally and breaks once deployed.\n- **Ask before `--public`.** It serves the mock and its data to anyone with\n  the URL, and a scripted redeploy can't make it private again.\n\n## Before you say it's done\n\nA mock isn't done because it started. Call it: a documented error comes\nback, a valid scenario changes the response, a `POST` then `GET` shows state\nif it should. Say where it runs and who can call it, where it lives (the\ncheckout, a workspace, or a mock server), and what you assumed. What you\nassumed, kept with the PR that lands the mock, lets the person reviewing tell\nresponses taken from the contract from ones that were guessed, and tells the\nnext session what still needs the real API.\n"},"changes":[{"path":"/description","type":"changed","before":"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. Finds, builds, runs and publishes a stand-in for one API — a published mock when its owner or a verified publisher has one, otherwise one built from its spec or collection that behaves like the real API, stateful when callers write then read. To run and test your own code against the services it calls, use api-simulation. Covers `postman mock` and `postman dependency add mock`.","after":"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. Finds, builds, runs and publishes a stand-in for one API — a published mock when its owner or a verified publisher has one, otherwise one built from its spec or collection, stateful when callers write then read, answering with real records from a sheet or database. To run your own code against the services it calls, use postman:api-simulation. Covers `postman mock` and `postman dependency add mock`."},{"path":"/skill_md_contents","type":"changed","before":"---\nname: api-mocking\ndescription: 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. Finds, builds, runs and publishes a stand-in for one API — a published mock when its owner or a verified publisher has one, otherwise one built from its spec or collection that behaves like the real API, stateful when callers write then read. To run and test your own code against the services it calls, use api-simulation. Covers `postman mock` and `postman dependency add mock`.\n---\n\n# API Mocking\n\nA mock is a folder, `config.yaml` plus a handler such as `default.js`, that\nanswers like an API. The handler is a Node HTTP server that calls\n`listen(process.env.PORT)`. It loads as CommonJS even in an ESM project, so\n`import` fails: use `require`. The same mock lives in your repo\n(`postman/mocks/<name>/`, run with `postman mock run`, no sign-in needed),\nin a Postman workspace after `postman mock push`, where other teams pull it\nfrom, and on a mock server after `postman mock deploy`, for callers that\ncan't run it themselves.\n\nSeveral APIs at once, for a service, a frontend or a test suite? Use\n`api-simulation`, which gets each member's mock here.\n\n## Use a published mock first\n\nWhen the API belongs to another team or a third-party provider, look for a\npublished mock before writing one: a maintained mock encodes the contract\nand the service's state; yours encodes a guess.\n\nEvery step below needs a signed-in CLI. Check `postman status` first; signed\nout, skip to building one and say the search was skipped.\n\n1. Find the mock.\n   - **Another team's service:** find the owner's workspace with\n     `postman search workspaces \"<service>\" -o json`. Name the service\n     plainly, as your code does, not by what it returns: a description\n     matches lookalike services. Prefer a Git-connected workspace\n     (`isGitConnected`) named for that service, then list its mocks with\n     `postman mock list -w <workspaceId> --json`. `postman search mocks`\n     misses some, and a same-named mock in another workspace isn't the\n     owner's.\n   - **A third-party API,** such as a payment or email provider: search\n     mocks directly with\n     `postman search mocks \"<provider>\" --ownership all -o json`. The\n     workspace that holds one is rarely named for the provider, and the\n     default ownership searches only your organization. Prefer a `codeMock`\n     named for the provider from a verified organization\n     (`organization.isVerified`).\n\n   A `classicMock` only replays a collection's saved examples: `postman mock`\n   can't pull or run it, so call one at `https://<mockId>.mock.pstmn.io` with\n   `postman request`, or generate a code mock from its collection.\n2. Pull it with `postman dependency add mock <mockId>`, run the folder it\n   writes with `postman mock run`, and use it as it is. Commit\n   `postman/.dependencies/` when CI should run it without signing in;\n   otherwise CI restores it with `dependency install`, which needs a sign-in\n   (see **api-discovery**). Never edit `postman/.dependencies/`:\n   `dependency update` overwrites it, so copy a mock to `postman/mocks/` to\n   change it. A mock is code that runs as you; pull only from publishers you\n   trust.\n\n## Or build one that behaves like the real API\n\nCallers shouldn't be able to tell the difference on the paths they use. A\nmock that returns invented JSON passes your tests and fails against the\nreal service.\n\n- **Start from the contract.** `postman mock generate <spec or collection>`\n  writes each documented response. It's a replay: a `POST` and a later\n  `GET` share nothing, and it accepts any request, so a call that breaks the\n  contract still gets its answer. `x-mock-response-code` picks only a\n  documented status; any other code gets the default 200, so put the errors\n  callers handle (the unknown-id 404, the conflict 409, the bad-input 400) in\n  the contract. From a spec\n  it serves the server URL's base path (`/v2/...`); from a collection,\n  routes start after the base-URL variable. `--update` regenerates the\n  handler and overwrites your edits. With no contract, write it from how\n  your code calls the API and say what you assumed.\n- **Set `interceptRequests: true` in `config.yaml`.** Without it `req.body`\n  and `req.query` are undefined, `x-mock-session` is ignored, and a throw in\n  an async handler kills the mock instead of returning a `500`.\n- **Make it stateful when callers write then read.** Keep records in\n  `pm.state`, seed them on first use, add a reset route so a test can start\n  clean, and answer an unknown id with the real 404. Every `mock run` starts\n  empty.\n- **Know who shares state.** Locally, all callers share one state unless\n  each sends `x-mock-session: <id>`. A mock server deployed from the CLI\n  isolates each caller: one that keeps neither the same `x-mock-session` nor\n  the `pm_mock_session` cookie starts from the seed on every request, so its\n  `POST` and later `GET` never meet.\n- **Scenarios** are named handlers in `config.yaml`'s `scenarios` list, picked\n  per request with `x-mock-scenario: <name>`. An unknown name falls back to\n  the default locally but is a `404` on a mock server.\n\n## Check it against the contract\n\n`postman mock run` prints the URL it bound; a busy configured port moves\nunless you pass `--port`, so take the URL from that line. Nothing reloads:\nrestart it after an edit.\n\nA mock checked against the handler you just wrote proves nothing, so call\nit with requests from the contract: `postman request`, or the API's\ncollection with\n`postman collection run <collection> --use-mock \"{{baseUrl}} mock:postman/mocks/<name>\"`\n(`--mock` alone only starts it). That form replaces the variable's whole\nvalue, base path included, so a mock generated from a spec that serves\n`/v2/...` answers `404`; start that one with `--mock <path> --port <n>` and\npass `--env-var \"baseUrl=http://localhost:<n>/v2\"`. To check your own calls\nagainst a contract, compare each one, from the code or a simulation log,\nwith the spec; the mock won't reject a wrong one.\n\n## Publish it for other teams\n\n- **Push it to the service's own workspace,** the one this repo is linked\n  to or the one the user names, never one chosen by name match: other\n  teams' simulations look there. Signed out, the push fails but the local\n  mock still works; build it, say so and ask the user to sign in. Keep it\n  honest: change the mock in the same PR as the API and run the API's\n  collection against it.\n- **Deploy only when a caller needs a URL.** The server takes a slug of 3–32\n  lowercase letters, digits and single hyphens, starting and ending with a\n  letter or digit; the CLI accepts more, and its default can be too long.\n  It's private: callers send an API key as `x-api-key`, or, if they can\n  view the workspace, an access token as `x-access-token`. Deploying needs a paid plan; a team's first\n  server can take minutes to answer, and teams that review deploys hold them\n  for approval. Each later `push` changes what every caller of the server\n  gets, so treat it as a release, not a backup.\n- **Write it for where it runs.** A mock server runs each scenario as one\n  file with Node's built-ins, not `fs` or `child_process`: no local\n  `require`s, no `pm.mock` examples, no environment, no console output, and\n  no caller `authorization`, `cookie` or `x-api-key` headers. A mock that\n  relies on any of these works locally and breaks once deployed.\n- **Ask before `--public`.** It serves the mock and its data to anyone with\n  the URL, and a scripted redeploy can't make it private again.\n\n## Before you say it's done\n\nA mock isn't done because it started. Call it: a documented error comes\nback, a valid scenario changes the response, a `POST` then `GET` shows state\nif it should. Say where it runs and who can call it, where it lives, and\nwhat you assumed.\n","after":"---\nname: api-mocking\ndescription: 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. Finds, builds, runs and publishes a stand-in for one API — a published mock when its owner or a verified publisher has one, otherwise one built from its spec or collection, stateful when callers write then read, answering with real records from a sheet or database. To run your own code against the services it calls, use postman:api-simulation. Covers `postman mock` and `postman dependency add mock`.\n---\n\n# API Mocking\n\nA mock is a folder, `config.yaml` plus a handler such as `default.js`, that\nanswers like an API. The handler is a Node HTTP server that calls\n`listen(process.env.PORT)`. It loads as CommonJS even in an ESM project, so\n`import` fails: use `require`. The same mock lives in your repo\n(`postman/mocks/<name>/`, run with `postman mock run`, no sign-in needed),\nin a Postman workspace after `postman mock push`, where other teams pull it\nfrom, and on a mock server after `postman mock deploy`, for callers that\ncan't run it themselves.\n\n`postman init --json` at the repo root scaffolds the directory API work lives\nin: `postman/` beside the code, registered in `.postman/resources.yaml`, with\n`postman/specs/` and `postman/collections/` for the contract a mock is\ngenerated from and checked against. That gives the mock, and the work around\nit, a place that outlasts the session: the next session or a teammate reruns\nit instead of rebuilding it. Init needs no sign-in or approval. Signed out, it\nstarts a temporary session, so commands that need a session work before the\nuser has an account; see **postman:workspaces**' \"What init unlocks\".\n\nSeveral APIs at once, for a service, a frontend or a test suite? Use\n`postman:api-simulation`, which gets each member's mock here.\n\n## Use a published mock first\n\nWhen the API belongs to another team or a third-party provider, look for a\npublished mock before writing one: a maintained mock encodes the contract\nand the service's state; yours encodes a guess.\n\nA published mock lives in its owner's workspace, which only a signed-in CLI\ncan search and pull from (see **postman:api-discovery**). Signed out, build one\ninstead and say the search was skipped.\n\n1. Find the mock.\n   - **Another team's service:** find the owner's workspace with\n     `postman search workspaces \"<service>\" -o json`. Name the service\n     plainly, as your code does, not by what it returns: a description\n     matches lookalike services. Prefer a Git-connected workspace\n     (`isGitConnected`) named for that service, then list its mocks with\n     `postman mock list -w <workspaceId> --json`. `postman search mocks`\n     misses some, and a same-named mock in another workspace isn't the\n     owner's.\n   - **A third-party API,** such as a payment or email provider: search\n     mocks directly with\n     `postman search mocks \"<provider>\" --ownership all -o json`. The\n     workspace that holds one is rarely named for the provider, and the\n     default ownership searches only your organization. Prefer a `codeMock`\n     named for the provider from a verified organization\n     (`organization.isVerified`).\n\n   A `classicMock` only replays a collection's saved examples: `postman mock`\n   can't pull or run it, so call one at `https://<mockId>.mock.pstmn.io` with\n   `postman request`, or generate a code mock from its collection.\n2. Pull it with `postman dependency add mock <mockId>`, run the folder it\n   writes with `postman mock run`, and use it as it is. Commit\n   `postman/.dependencies/` when CI should run it without signing in;\n   otherwise CI restores it with `dependency install`, which needs a sign-in\n   (see **postman:api-discovery**). Never edit `postman/.dependencies/`:\n   `dependency update` overwrites it, so copy a mock to `postman/mocks/` to\n   change it. A mock is code that runs as you; pull only from publishers you\n   trust.\n\n## Or build one that behaves like the real API\n\nCallers shouldn't be able to tell the difference on the paths they use. A\nmock that returns invented JSON passes your tests and fails against the\nreal service.\n\n- **Start from the contract.** `postman mock generate <spec or collection>`\n  writes each documented response. It's a replay: a `POST` and a later\n  `GET` share nothing, and it accepts any request, so a call that breaks the\n  contract still gets its answer. `x-mock-response-code` picks only a\n  documented status; any other code gets the default 200, so put the errors\n  callers handle (the unknown-id 404, the conflict 409, the bad-input 400) in\n  the contract. From a spec\n  it serves the server URL's base path (`/v2/...`); from a collection,\n  routes start after the base-URL variable. `--update` regenerates the\n  handler and overwrites your edits. With no contract, write it from how\n  your code calls the API and say what you assumed.\n- **Answer from the real records.** When the data an API serves already\n  lives in a catalog sheet, a CSV or a database table, put it in a dataset\n  (named, queryable tables built from your CSV, JSON, sheet or database)\n  and have the handler query it per request: it returns real ids, prices\n  and edge cases, while hand-written JSON returns what you invented and\n  drifts as the data changes. The same dataset also feeds the API's tests,\n  CI and monitors, so there's no separate seed file to keep in step. To\n  create the dataset's `.dataset.yaml` file, see **postman:datasets**. `mock run\n  --dataset <that file>` gives the handler `pm.datasets('<datasetId>')`,\n  which takes the `id:` from that file, not its name or path. It works\n  signed out for file sources, and a `--ref-only` source serves edits to\n  the file without a restart.\n\n  ```js\n  // Parameters bind to $1, $2, ... in order.\n  const { rows } = await pm.datasets('<datasetId>')\n    .executeQuery('SELECT * FROM products WHERE sku = $1', [sku]);\n  const found = [];\n  for await (const r of rows) found.push(r); // rows can be read only once\n  if (!found.length) { res.writeHead(404); return res.end(); }\n  res.writeHead(200, { 'Content-Type': 'application/json' });\n  res.end(JSON.stringify(found[0])); // CSV values are text: \"price\":\"9.99\"\n  ```\n\n  With `interceptRequests: true` (below), a failed query, such as a wrong\n  id, answers `500` with the reason. A mock that only needs the contract's\n  examples needs no dataset, and writes followed by reads still belong in\n  `pm.state`. For a demo or a frontend that needs a backend it can write to\n  and read back, seeded from those same rows, `mock generate --dataset`\n  bakes up to 20 rows per table into a stateful handler. It needs a sign-in\n  and sends the rows to Postman, so use fixture data, and rerun with\n  `--update` after the data changes.\n- **Set `interceptRequests: true` in `config.yaml`.** Without it `req.body`\n  and `req.query` are undefined, `x-mock-session` is ignored, and a throw in\n  an async handler kills the mock instead of returning a `500`.\n- **Make it stateful when callers write then read.** Keep records in\n  `pm.state`, seed them on first use, add a reset route so a test can start\n  clean, and answer an unknown id with the real 404. Every `mock run` starts\n  empty.\n- **Know who shares state.** Locally, all callers share one state unless\n  each sends `x-mock-session: <id>`. A mock server deployed from the CLI\n  isolates each caller: one that keeps neither the same `x-mock-session` nor\n  the `pm_mock_session` cookie starts from the seed on every request, so its\n  `POST` and later `GET` never meet.\n- **Scenarios** are named handlers in `config.yaml`'s `scenarios` list, picked\n  per request with `x-mock-scenario: <name>`. An unknown name falls back to\n  the default locally but is a `404` on a mock server.\n\n## Check it against the contract\n\n`postman mock run` prints the URL it bound; a busy configured port moves\nunless you pass `--port`, so take the URL from that line. Nothing reloads:\nrestart it after an edit.\n\nA mock checked against the handler you just wrote proves nothing, so call\nit with requests from the contract: `postman request`, or the API's\ncollection with\n`postman collection run <collection> --use-mock \"{{baseUrl}} mock:postman/mocks/<name>\"`\n(`--mock` alone only starts it). That form replaces the variable's whole\nvalue, base path included, so a mock generated from a spec that serves\n`/v2/...` answers `404`; start that one with `--mock <path> --port <n>` and\npass `--env-var \"baseUrl=http://localhost:<n>/v2\"`. To check your own calls\nagainst a contract, compare each one, from the code or a simulation log,\nwith the spec; the mock won't reject a wrong one.\n\n## Publish it for other teams\n\n- **Push it to the service's own workspace,** the one this repo is linked\n  to or the one the user names, never one chosen by name match: other\n  teams' simulations look there. Signed out with no session, the push fails\n  with `Authentication required`; after `postman init --json` it lands in a\n  temporary workspace with no sign-in, which the user keeps by claiming it\n  with `postman signup`. Keep it\n  honest: change the mock in the same PR as the API and run the API's\n  collection against it, so the person reviewing sees the contract change\n  and the mock callers will get side by side.\n- **Deploy only when a caller needs a URL.** The server takes a slug of 3–32\n  lowercase letters, digits and single hyphens, starting and ending with a\n  letter or digit; the CLI accepts more, and its default can be too long.\n  It's private: callers send an API key as `x-api-key`, or, if they can\n  view the workspace, an access token as `x-access-token`. Deploying needs a\n  paid plan or the temporary session from `postman init`; a team's first\n  server can take minutes to answer, and teams that review deploys hold them\n  for approval. Each later `push` changes what every caller of the server\n  gets, so treat it as a release, not a backup.\n- **Write it for where it runs.** A mock server runs each scenario as one\n  file with Node's built-ins, not `fs` or `child_process`: no local\n  `require`s, no `pm.mock` examples, no environment, no console output, and\n  no caller `authorization`, `cookie` or `x-api-key` headers. A mock that\n  relies on any of these works locally and breaks once deployed.\n- **Ask before `--public`.** It serves the mock and its data to anyone with\n  the URL, and a scripted redeploy can't make it private again.\n\n## Before you say it's done\n\nA mock isn't done because it started. Call it: a documented error comes\nback, a valid scenario changes the response, a `POST` then `GET` shows state\nif it should. Say where it runs and who can call it, where it lives (the\ncheckout, a workspace, or a mock server), and what you assumed. What you\nassumed, kept with the PR that lands the mock, lets the person reviewing tell\nresponses taken from the contract from ones that were guessed, and tells the\nnext session what still needs the real API.\n"}],"summary":"Fields changed: 2. /description, /skill_md_contents.","summary_kind":"deterministic","summary_metadata":{}}