Queries

The query endpoint accepts a query request, containing expressions to be evaluated in the context the data source, and returns a response consisting of relevant rows of data.

The structure and requirements for specific fields listed below will be covered in subsequent chapters.

Request

POST /query

Request

See QueryRequest

Request Fields

NameDescription
collectionThe name of a collection to query
queryThe query syntax tree
argumentsValues to be provided to any top-level collection arguments
collection_relationshipsAny relationships between collections involved in the query request
variablesOne set of named variables for each rowset to fetch. Each variable set should be subtituted in turn, and a fresh set of rows returned.

Response

See QueryResponse

Requirements

  • If the request specifies variables, then the response must contain one RowSet for each collection of variables provided. If not, the data connector should respond as if variables were set to a single empty collection of variables: [{}].
  • If the request specifies fields, then the response must contain rows according to the schema advertised for the requested collection.
  • If the request specifies aggregates then the response must contain aggregates, with one response key per requested aggregate, using the same keys. See aggregates.
  • If the request specifies arguments, then the implementation must validate the provided arguments against the types specified by the collection's schema. See arguments.