Secrets Hub query language
Secrets Hub query language
This topic describes the Secrets Hub query language.
Note: Currently, you can use the query language only in Get Secrets.
Comparison operators
operators | Description | Filter Syntax | Example |
---|---|---|---|
EQ | Filters the returned records to include only fields with a specific value. | https://url/api?filter=field EQ value | Returns records where the name equals my-name :https://url/api?filter=name EQ my-name |
CONTAINS | Filters the returned records to include fields that contain a specific value or part of it. | https://url/api?filter=field CONTAINS value | Returns records where the name contains my , such as my-secret :https://url/api?filter=name CONTAINS my |
NOTCONTAINS | Filters the returned records to exclude fields that contain a specific value or part of it. | https://url/api?filter=field NOTCONTAINS value | Returns records where the name does not contain my , such as our-secret :https://url/api?filter=name NOTCONTAINS my |
Logical operators
Operator | Description | Filter Syntax | Example |
---|---|---|---|
AND | Combines multiple conditions in a filtering expression to return the desired records. | https://url/api?filter=<field> <operator> <value> AND <field> <operator> <value> ... | Returns records where name contains my and storeName contains our :https://url/api?filter=name CONTAINS my AND storeName CONTAINS our |
Escape characters and spaces
Spaces
To filter for a value that contains spaces, wrap the query field value either with single or double quotes:
- Filter:
https://url/api?filter=name CONTAINS "my value"
- Filter:
https://url/api?filter=name CONTAINS 'my value'
Escaping single or double quotes
As the double or single quote character is used to wrap values with spaces, it should be escaped when used as part of a value.
The following example shows a query value that includes quotes. When used in a filter, the quotes must be escaped:
Filter:
https://url/api?filter=name CONTAINS "my\"some value in between\" value"
- In the filter above, the inner double quotes inside the value are escaped with a backslash (
\
) before each quote. This ensures the filter includes the quotes as part of the value.
- In the filter above, the inner double quotes inside the value are escaped with a backslash (
Filter:
https://url/api?filter=name CONTAINS 'my\'some value in between\' value'
- In the filter above, the inner single quotes inside the value are escaped with a backslash (
\
) before each quote. This ensures the filter includes the quotes as part of the value.
- In the filter above, the inner single quotes inside the value are escaped with a backslash (
Query parameters
Parameter | Type | Default Value | Description | Mandatory | Valid Value |
---|---|---|---|---|---|
filter | String | None (no filter, indicates 'All') | Filter the returned data using one or more conditions. | No | Filter expression as listed in the filter options section |