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.

The filter parameter accepts the array data type. To filter a resource collection use the filter query parameter in the following format:

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

where:

  • <endpoint> is the resource collection endpoint.
  • <property> is the resource property name.

Note

To filter a resource collection based on a property of a resource subschema, use the "<subschema>.<property>" format to specify the resource property name where <subschema> is the  subschema name. For more information on resource schemas, see the REST API Reference.

  • <operator> is a relational or logical operator used in the Orchestrator REST API.
  • <value> is a resource property value.

The Orchestrator REST API supports the following operators:

Operator

Description

== (equal)

Returns resources that match the specified property value.

!= (not equal)

Returns resources that do not match the specified property value.

> (greater than)

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

< (less than)

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

in

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

&& (logical AND)

Returns resources that match all the specified property values.

|| (logical OR)

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.

Examples

  • To get a representation of a plan with the specified name, send the following request:

GET https://uwin2012r2.n.local:9898/api/v7.1/Plans?filter=[{"property":"name","operator":"==","value":"Restore02"}]

  • To return a list of restore and replica plans, send the following request:

GET https://uwin2012r2.n.local:9898/api/v7.1/Plans?filter=[{"property":"planType","operator":"in","value":["Restore","Replica"]}]

-OR-

GET https://uwin2012r2.n.local:9898/api/v7.1/Plans?filter=[{"property":"planType","operator":"!=","value":"Storage"}]

  • To return a list of restore plans with the successfully completed readiness check, send the following request:

GET https://uwin2012r2.n.local:9898/api/v7.1/Plans?filter=[{"operator":"&&", "items":[{"property":"lastCheckResult", "operator":"==","value":"Success"},{"property":"PlanType", "operator":"==", "value":"Restore"}]}]

  • To return a list of plans whose names contain test, send the following request:

GET https://uwin2012r2.n.local:9898/api/v7.1/Plans?filter=[{"property":"name","operator":"like","value":"test"}]