Query parameters specify result set properties such as pagination, sort order, and filter criteria.
Typed queries must include a type parameter, which specifies the type of query to run. Packaged queries cannot specify a type parameter. All other parameters are optional. If a parameter is omitted, a default value is assumed.
Comma-separated list of attribute names or metadata key names to return. For example, fields=name,isEnabled or fields=metadata:rank. See Specifying Metadata in a Query or a Filter Expression. |
Returns all static attribute names. Returns metadata only if the object has a non-empty Metadata element. |
|||||||
Filter expression. See Query Filter Expressions |
||||||||
Specify whether the filter expression is encoded as described in RFC3986 (pct-encoded). See Encoding Filter Expressions |
||||||||
|
||||||||
Boolean value specifying whether to include Link elements in the result set for certain object types. |
||||||||
Integer value specifying the first record to return. Record numbers < offset are not returned. |
||||||||
Sort results by attribute-name in ascending order. attribute-name cannot include metadata. For information about the attributes that can be used with sortAsc, see Attribute Names and Values. |
||||||||
Sort results by attribute-name in descending order. attribute-name cannot include metadata. For information about the attributes that can be used with sortDesc, see Attribute Names and Values. |
||||||||
The type of the query. Type names are case-sensitive. See Query Types. |
None. This parameter is required for all typed queries, and is not allowed for any packaged query. |
For queries that do not examine object metadata, you can filter results using string matching or numeric comparison operations. A filter comprises one or more subexpressions drawn from the following set of operators.
Not all attributes can be used in a filter expression. For details, see the reference pages for query result types in the vCloud API Schema Reference.
Because metadata values are dynamic and metadata names have an optional domain qualifier queries that filter metadata must specify a qualified name, a value, and the type of the value.
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.
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
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
metadata:rank=ge=NUMBER:1
metadata@SYSTEM:expiry=le=DATETIME:2012-06-18T12:00:00-05:00
When you are comparing a key with a literal value that includes characters that might be subject to interpretation when used in a URL (often termed unsafe characters), the value must be encoded as described in RFC3986 (pct-encoded). For example, to create a filter expression to match a hostName property whose value is 12&345, encode the value as shown here:
filter=hostName==12%26345
When a filter expression includes metadata, you must encode both the key and the value this way. In addition, if you specify filterEncoded=true as part of a query that includes metadata, you must encode the % symbol as %25. For example, this query, which includes metadata would require this sort of additional encoding if you specified filterEncoded=true.
https://vcloud.example.com/api/query? type=organization&format=records &fields=metadata:rank,metadata@SYSTEM:expiry &filter=metadata%40SYSTEM%3Aexpiry%3Dlt%3DDATETIME%3ADATETIME%253A2012-05-01T00%253A00%253A00.000-04%253A00DATETIME%253A2012-05-01T00%253A00%253A00.000-04%253A00&filterEncoded=true
If you did not specify filterEncoded=true, you would not need the additional encoding.
https://vcloud.example.com/api/query? type=organization&format=records &fields=metadata:rank,metadata@SYSTEM:expiry &filter=metadata@SYSTEM:expiry=lt=DATETIME:DATETIME%3A2012-05-01T00%3A00%3A00.000-04%3A00
Group filter subexpressions with parentheses. Separate grouped subexpressions with a semicolon (no spaces).
(attribute1==value1;attribute2!=value2);(attribute3==value3;attribute4!=value4)...
https://vcloud.example.com/api/query?type=providerVdcResourcePoolRelation&format=records&filter=(numberOfVMs!=0;isPrimary==true)
Several parameters and all filter expressions require you to specify an attribute name. To understand the attribute names included in a particular result set, you can use the vCloud API Schema Reference available at https://code.vmware.com.