Skip to content

Update documentation with new assets filter by attribute values #1091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions content/rest-api/filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,40 @@ Finally, if you want to get the assets updated in the last 4 days, you can use t
/api/rest/v1/asset-families/model_pictures/assets?search={"updated":[{"operator":"SINCE LAST N DAYS","value":4}]}
```

### By attribute values

:::: availability versions=7.0,SaaS editions=EE

You can filter assets on their attribute values using the `search` query parameter. Put your attribute filters under the `values` key. Each property under `values` is an attribute identifier. For scopable/localizable attributes, you can optionally specify a `channel` and/or `locale` in the filter. If omitted, the API will try to use the `channel`/`locales` provided in the request.

Supported types and operators:
- text: `=`, `CONTAINS`, `DOES NOT CONTAIN`, `STARTS WITH`, `ENDS WITH`, `IS EMPTY`, `IS NOT EMPTY`
- number: `=`, `IS EMPTY`, `IS NOT EMPTY`
- boolean: `=`, `IS EMPTY`, `IS NOT EMPTY`
- date: `=`, `<`, `>`, `BETWEEN`, `NOT BETWEEN`, `IS EMPTY`, `IS NOT EMPTY`
- option/option_collection: `IN`, `IS EMPTY`, `IS NOT EMPTY`
- record: `=`, `IN`, `IS EMPTY`

Notes:
- Filtering on attribute types `media_file` and `media_link` is not supported. The API will return a 422 error.
- Attribute identifiers must match the regex `^[a-zA-Z0-9_]+$`.
- For `record` attributes, use operator `=` with value `true` to express non-empty (and `false` for empty). There is no `IS NOT EMPTY` operator for record.

#### Examples

Filter by a text attribute value:

```
/api/rest/v1/asset-families/{asset_family_code}/assets?search={"values":{"title":{"operator":"CONTAINS","value":"summer","locale":"en_US","channel":"ecommerce"}}}
```

Filter by an option (simple or collection):

```
/api/rest/v1/asset-families/{asset_family_code}/assets?search={"values":{"usage":{"operator":"IN","value":["web","print"]}}}
```
::::

### Asset values by locale

::: availability versions=3.2,4.0,5.0,6.0,7.0,SaaS editions=EE
Expand Down