API Explorer
API Explorer
Getting Started
Recovery and Reuse Management
Authentication and Authorization
Application Data Management
Asset Management
Compliance
Asset Metadata
Secrets Manager
Cloud Disaster Recovery
Copy Management
Appliance Management
Telemetry Setting
Credentials Management
Storage Management
Discovery
Monitoring
File Level Restore
User Security Management
Inventory Source Management
Licenses Management
Location Management
Log Management
Virtual Machine Data Management
Protection Policies
Remote Service
Search Clusters
Server Disaster Recovery
Upgrade
Whitelist Management

Filter the results

In this tutorial, you can learn how to tailor responses according to your filtering requirements.

Filtering in PowerProtect Data Manager REST API is accomplished by using the filter query parameter. This parameter supports a compound logic expression that is based on fields:

?filter=<logic-expression> [and|or <logic-expression>] ...

Logic expression is defined as:

logic-expression:=[not] <field-name> <operator> <value>|(<value1>, <value2> ...)

Each field that can be filtered within a response is marked as x-ppdm-filter:true in the API specification document. For example, for activities, you can filter a response that is based on top-level attributes such as state and createdTime. You can also filter a response that is based on nested object fields, which can be connected with a dot (for example, result.state).

Available logical operators are:

and
or
not // logic not
eq // equal
ne // not equal
le // less equal
lt // less than
ge // greater equal
gt // greater than
in // in (array of values)
lk // like, string comparison, for example: contains, starts with, ends with

For example, if you want to filter Virtual Machines with names that contain qi, use this filter:

?filter=type eq "VMWARE_VIRTUAL_MACHINE" and name lk "%qi%"

If you want to filter Virtual Machines with names that start with qi, use this filter:

?filter=type eq "VMWARE_VIRTUAL_MACHINE" and name lk "qi%"

The null filter is also supported. If you want to filter all the Virtual Machines that are unprotected by a protection policy, use this filter:

?filter=type eq "VMWARE_VIRTUAL_MACHINE" and protectionPolicyId eq null

If you want to filter activities according to state (QUEUED or RUNNING), use this query:

?filter=state in ("RUNNING","QUEUED")

Full sample code with URL encoded query:

curl --request GET \
  --url 'https://<your-ppdm-server>:8443/api/v2/activities?filter=state%20in%20(%22RUNNING%22%2C%22QUEUED%22)' \
  --header 'authorization: Bearer <access-token>'

If you have more than one field to filter, you can use the and/or operator to connect the expressions:

?filter=state in ("RUNNING","QUEUED") and createdTime gt "2019-08-01T17:11:21.266Z"

Full sample code with URL encoded query:

curl --request GET \
  --url 'https://<your-ppdm-server>:8443/api/v2/activities?filter=state%20in%20(%22RUNNING%22%2C%22QUEUED%22)%20and%20createdTime%20gt%20%222019-08-01T17%3A11%3A21.266Z%22' \
  --header 'authorization: Bearer <access-token>'