Filter Parameter

The filter query parameter is used to filter items in a resource collection to return a subset of resources in a response. The subset includes only those resources that satisfy parameter value specified in the query.

To filter a resource collection use the filter query parameter in the following format:

GET https://hostname>:<port>/api/<version>/<endpoint>?filter=[{"property":"<property>","operator":"<operator>","ignorecase":"<boolean>","value":"<value>"}]

where:

  • <endpoint> is the resource collection endpoint.
  • <property> is the resource property name.
  • <operator> is a relational or logical operator.
  • <ignorecase> defines whether to ignore letter case in the value parameter.
  • <value> is a resource property value.

The Veeam Backup for Google Cloud REST API supports the following operators:

Operator

Description

equals

Returns resources that match the specified property value.

contains

Returns resources that contain the value specified for a property.

exclusiveOr

Returns resources that match one of the filter expressions.

notEquals

Returns resources that do not match the specified property value.

greaterThan

Returns resources with the property value that is greater than the specified value.

greaterThanOrEqual

Returns resources with the property value that is greater than or equal to the specified value.

lessThan

Returns resources with the property value that is less than the specified value.

lessThanOrEqual

Returns resources with the property value that is less than or equal to the specified value.

in

Returns resources that match at least one of the values specified for a property.

and

Returns resources that match all the specified property values.

andAlso

Returns resources that match all the specified property values.

or

Returns resources that match at least one of the specified property values.

orElse

Returns resources that match at least one of the specified property values.

like

[Applies only to properties with the string data type] Returns resources that match a specified pattern in the property value.

To group multiple filter expressions, you can include them into the <items> parameter in the following format:

GET https://<hostname>:<port>/api/<version>/<endpoint>?filter=[{"items":[{"property":"<property>","operator":"<operator>","ignorecase":<boolean>,"value":"<value>"},{"property":"<property>","operator":"<operator>","ignorecase":<boolean>,"value":"<value>"}],"operator":"<operator>"}]

Examples

To get all VM instances with the vm-gc name pattern, send the following request:

GET https://123.123.123.123:13140/api/v1/vmInstances?filter=[{"property":"name","operator":"like","ignorecase":true,"value":"vm-gc"}]

To get all VM instances with the vm-gc name pattern and e2-medium instance type, send the following request:

GET https://123.123.123.123:13140/api/v1/vmInstances?filter=[{"items":[{"property":"instanceType","operator":"equals","ignorecase":true,"value":"e2-medium"},{"property":"name","operator":"like","ignorecase":true,"value":"vm-gc"}],"operator":"and"}]

To learn more about properties of a specific resource that can be used as filter query parameters, see the REST API Reference.