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

Commit 49f603c

Browse files
Brian Cunniereidmit
andcommitted
V3 docs: Upgrade Guide: filtering with inequality
- Technically, this also includes filtering with equality, specifically multiple filtering. - We call out the differences between V3 and V2 inequality queries (no preamble, different operators) [finishes #173277412] Co-authored-by: Brian Cunnie <bcunnie@pivotal.io> Co-authored-by: Reid Mitchell <rmitchell@pivotal.io>
1 parent 805220c commit 49f603c

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

  • docs/v3/source/includes/upgrade_guide/conceptual_changes

docs/v3/source/includes/upgrade_guide/conceptual_changes/_filtering.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,25 @@ A few common filters have been also renamed in V3:
2929

3030
<sup>1</sup> In V3, order is ascending by default. Prefix the `order_by` value with `-` to make it descending. For example, `?order_by=-name` would order a list of resources by `name` in descending order.
3131

32-
Read more about [filtering in V3](#filtering).
32+
Filtering inequalities has changed in V3: V3 dispenses with the `q=` preamble,
33+
uses `created_ats` instead of `timestamp` and uses bracket operators (`[lt]`,
34+
`[gt]`, `[lte]`, `[gte]`). For example, to request all audit events occurring on
35+
New Year's Day, one would use the following query: `GET
36+
/v3/audit_events?created_ats[lt]=2020-01-02T00:00:00Z&created_ats[gt]=2019-12-31T23:59:59Z`.
37+
38+
The corresponding V2 query would be `GET
39+
/v2/events?q=timestamp<2020-01-02T00:00:00Z&q=timestamp>2019-12-31T23:59:59Z`.
40+
41+
Filtering on equality has also changed: V3 dispenses with the `q=` preamble and
42+
uses the pluralized field (e.g. `names`) on the left side of the equals sign.
43+
For filtering on inclusion in a set, V3 allows passing multiple values separated
44+
by commas.
45+
46+
For example, to request the organizations by
47+
their name ("finance" and "marketing"), one would use the following query:
48+
`/v3/organizations?names=finance,marketing`
49+
50+
The corresponding V2 query would be `GET
51+
/v2/organizations?q=name%20IN%20finance,marketing`
52+
53+
Read more about [filtering in V3](#filters).

0 commit comments

Comments
 (0)