5.1

Table Of Contents
For queries that examine object metadata, you can filter query results using numeric comparison operations
when a metadata value has type NUMBER or DATETIME. Because object metadata types are dynamic, filter
expressions for metadata queries require additional parameters that define the attribute part of the expression
as metadata, and specify the type of the value part of the expression.
Table 9-5. Metadata Query Filter Expressions
Operator Example Operation
=gt=
metadata:attribute=gt=[NUMBER |
DATETIME]:value
Greater than. The example evaluates to true if value
is of type NUMBER or DATETIME and the value of
the metadata key named attribute is greater than
value.
=lt=
metadata:attribute=lt=[NUMBER |
DATETIME]:value
Less than. The example evaluates to true if value is of
type NUMBER or DATETIME and the value of the
metadata key named attribute is less than value.
=ge=
metadata:attribute=ge=[NUMBER |
DATETIME]:value
Greater than or equal to. The example evaluates to
true if value is of type NUMBER or DATETIME and
the value of the metadata key named attribute is
greater than or equal to value.
=le=
metadata:attribute=le=[NUMBER |
DATETIME]:value
Less than or equal to. The example evaluates to true
if value is of type NUMBER or DATETIME and the
value of the metadata key named attribute is less than
or equal to value.
You can specify up to 8 metadata fields in a single query. You cannot use a metadata value as a sort key when
sorting query output.
The syntax for specifying metadata in a fields parameter is:
fields=metadata[@SYSTEM]:
key-name
For example:
fields=metadata:rank
fields=metadata@SYSTEM:expiry
The syntax for specifying a metadata field in a filter expression is:
metadata[@SYSTEM]:
key-name
operator
type-keyword
:
value
For example:
metadata:rank=ge=NUMBER:1
metadata@SYSTEM:expiry=le=DATETIME:2012-06-18T12:00:00-05:00
Grouping Filter Subexpressions
Group filter subexpressions with parentheses. Separate grouped subexpressions with a semicolon (no spaces).
(
attribute1
==
value1
;
attribute2
!=
value2
);(
attribute3
==
value3
;
attribute4
!=
value4
)...
For example:
https://vcloud.example.com/api/query?
type=providerVdcResourcePoolRelation&format=records&filter=(numberOfVMs!=0;isPrimary==true)
Chapter 9 Using the Query Service
VMware, Inc. 259