ResultSet Data
Structure in Data Service Queries
The response to a
RequestSpec
is a list of
ResultSet
objects. Each
ResultSet
corresponds to a
QuerySpec
object in the
RequestSpec
, with a one-to-one mapping.
The
queryName
field of a
ResultSet
is used to identify the
QuerySpec
that corresponds to the
ResultSet
. If you assigned a name to a query in the
RequestSpec
, the Response contains a
ResultSet
with a matching value in its
queryName
field. If you submitted a
QuerySpec
without a name, the corresponding
ResultSet
has an empty string in the
queryName
field. A best practice is to assign a unique
name to each
QuerySpec
whenever you submit a request that contains
more than one query.
When you process a
ResultSet
, first check the
error
field. If the
error
is non-empty, the query failed, and the
queryName
field has a valid value but other fields
have indeterminate values. If the
error
is empty, the other fields are meaningful.
The
totalMatchedObjectCount
tells you the number of items
the query can return. If the query did not specify a chunk size in the
maxResultCount
field, then
totalMatchedObjectCount
is the size of the
ResultSet.items
list. If the query did specify a chunk
size, then the
items
list size is the minimum of
QuerySpec.maxResultCount
and
ResultSet.totalMatchedObjectCount - QuerySpec.offset
.
The data payload is
ResultSet.items
, which is a list of
ResourceItem
objects. Each
ResourceItem
object contains a single
resourceObject
field, which holds the identifier of
the resource whose properties are returned in this
ResourceItem
. The
ResultItem.properties
field contains a list of
name-value pairs for properties requested by the
QuerySpec
.