5.5

Table Of Contents
Typed Queries
Typed queries require you to construct a request URL that specifies an object type and optional parameters.
Use this URL with a GET request to return query results.
Query Syntax
Typed queries have the following syntax:
API-URL/query?type=name[&param][&param ... ][&filter]
n
API-URL is a URL of the form https://vcloud.example.com/api.
n
name is the name of a query type. Type names are case-sensitive.
n
param is an optional query parameter. Zero or more parameters are allowed. See “Query Parameters,”
on page 299.
n
filter is an optional filter expression. At most one filter expression is allowed. See “Filter Expressions,”
on page 300.
Query Types
Each query type returns its result set as an XML document in which objects are represented as elements and
object properties are represented as attributes, pairing the name of the property with its value at the time the
request was made. By default, result sets are returned in the records format, which shows all database
records for each object. Most queries also support the references format, which returns a set of object
references, including name, type, and href attributes. All queries that support the records format also
support the idrecords format. For more information about the format parameter, see “Query Parameters,”
on page 299.
Query Reference
The vCloud API schema reference includes reference material for all queries.
Example: Listing All Queries
You can retrieve a summary list of all typed queries types accessible to the currently authenticated user by
making a request like this one:
GET https://vcloud.example.com/api/query
The response is a QueryList element that contains a Link for every query. The href value of each Link is a
URL you can GET to run the query specifying the default format.
<?xml version="1.0" encoding="UTF-8"?>
<QueryList
type="application/vnd.vmware.vcloud.query.queryList+xml"
href="https://vcloud.example.com/api/query"
... >
<Link
rel="down"
type="application/vnd.vmware.vcloud.query.references+xml"
name="organization"
href="https://vcloud.example.com/api/query?type=organization&amp;format=references" />
<Link
rel="down"
type="application/vnd.vmware.vcloud.query.records+xml"
name="organization"
vCloud API Programming Guide
290 VMware, Inc.