Skip to content

Commit 6400241

Browse files
docs(cli-generator): document passing path/query params as individual flags (#6470)
Co-authored-by: jon.syla <jon.syla@postman.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 3c13e24 commit 6400241

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

fern/products/cli-generator/features.mdx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,28 @@ Paginated output works with all output formats. For table and CSV formats, heade
7777

7878
## Passing parameters
7979

80+
Path and query parameters can be passed two ways: as individual flags, or as a single JSON object. Request bodies use `--json`.
81+
8082
| Flag | Purpose |
8183
| --- | --- |
82-
| `--params <JSON>` | URL path and query parameters as a JSON object. |
84+
| `--<param>` | An individual path or query parameter, kebab-cased from its name in the spec. |
85+
| `--params <JSON>` | All path and query parameters as a single JSON object. Overrides individual flags. |
8386
| `--json <JSON>` | Request body for POST, PUT, and PATCH methods. |
8487

8588
```bash
86-
# Path + query parameters
89+
# Individual flags
90+
contoso plants get --plant-id abc
91+
92+
# The equivalent --params JSON object
8793
contoso plants get --params '{"plantId": "abc"}'
8894

8995
# Request body
9096
contoso plants create \
9197
--json '{"name": "Monstera", "species": "Monstera deliciosa", "sunlight": "indirect"}'
9298
```
9399

100+
Run `contoso <command> --help` to list a command's flags, or `--schema` for a machine-readable JSON contract. When a flag name differs from the spec, `--help` shows the original name as `(api: <name>)`, which is the key to use in `--params`.
101+
94102
## Server URL variables
95103

96104
For APIs with [templated server URLs](/learn/api-definitions/openapi/extensions/server-names-and-url-templating) (such as `https://api.example.com/stores/{store_hash}/v3`), the CLI automatically exposes each template variable as a CLI flag and environment variable.

0 commit comments

Comments
 (0)