Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit c99f82e

Browse files
committed
v3 docs: Describe syntax & patterns for query parameters
- Add a new "Query Parameters" section under "Concepts" - Call out encoding of commas in query param values (must be encoded twice if they appear in list values, e.g. `names=a%2Cb` for a resource named `a,b`). [finishes #173720501] Authored-by: Reid Mitchell <rmitchell@pivotal.io>
1 parent f3a89c1 commit c99f82e

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

docs/v3/source/includes/concepts/_filters.md.erb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## Filters
22

3-
Endpoints which return lists of resources also support filtering the returned resources using query parameters.
4-
The available filter parameters are described in a resource's "list" endpoint in the section "Query parameters".
3+
Endpoints which return lists of resources also support filtering the returned resources using query parameters. Each
4+
resource's list endpoint documents the allowed filters for that endpoint. For details about the syntax of query parameters
5+
in general, see [query parameters](#query-parameters).
56

67
#### Examples
78

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Query Parameters
2+
3+
Clients can assume that query parameters on the API will always follow these rules:
4+
5+
- Parameter names (before the `=`, and ignoring any modifiers like `[gt]`) will only contain characters `a-z` (lowercase) and `-`.
6+
- When a parameter accepts multiple values, these will be represented as a comma-delimited list of strings (see [filters](#filters)).
7+
8+
Because commas are used to separate list entries, **parameter values that contain commas must be percent-encoded**. For example, to retrieve apps named either `a,b` or `c,d`, the request would look like `GET /v3/apps?names=a%2Cb,c%2Cd`. Note that the commas within the app names are encoded (as `%2C`), but the comma separating the two app names is not. If a client is encoding the whole query string before sending it to the API, the commas within the app names will end up double-encoded.

docs/v3/source/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ includes:
5353
- concepts/metadata
5454
- concepts/pagination
5555
- concepts/procfiles
56+
- concepts/query_parameters
5657
- concepts/relationships
5758
- concepts/status_codes
5859
- concepts/timestamps

0 commit comments

Comments
 (0)