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

operatorsDescriptionFilter SyntaxExample
EQFilters the returned records to include only fields with a specific value.https://url/api?filter=field EQ valueReturns records where the name equals my-name:
https://url/api?filter=name EQ my-name
CONTAINSFilters the returned records to include fields that contain a specific value or part of it.https://url/api?filter=field CONTAINS valueReturns records where the name contains my, such as my-secret:
https://url/api?filter=name CONTAINS my
NOTCONTAINSFilters the returned records to exclude fields that contain a specific value or part of it.https://url/api?filter=field NOTCONTAINS valueReturns records where the name does not contain my, such as our-secret:
https://url/api?filter=name NOTCONTAINS my

Logical operators

OperatorDescriptionFilter SyntaxExample
ANDCombines 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.
  • 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.

Query parameters

ParameterTypeDefault ValueDescriptionMandatoryValid Value
filterStringNone (no filter, indicates 'All')Filter the returned data using one or more conditions.NoFilter expression as listed in the filter options section