Query

Parse an C8QL query

This endpoint is for query validation only. To query the database, see /api/cursor.

post/_fabric/{fabric}/_api/query

Request

Path parameters

fabricstring string required

The name of the fabric.

Request body

querystring required

To validate a query string without executing it, the query string can be passed to the server via an HTTP POST request.

Example request

{
  "query": "for u in testCollection return u"
}

Response

Successfull fetched collections attributes with an array of collections used in the query and bindVars attribute with names of the bind parameters found in the query (if any).

If the query is parsed successfully, the ast attribute of the returned JSON contain the abstract syntax tree representation of the query. The format of the ast is subject to change in future versions of database, but it can be used to inspect how database interprets a given query. Note that the abstract syntax tree is returned without any optimizations applied to it.

unknown required

Example response

{
  "code": 200,
  "error": false,
  "parsed": true,
  "collections": [
    "testCollection"
  ],
  "bindVars": [],
  "ast": [
    {
      "type": "root",
      "subNodes": [
        {
          "type": "for",
          "subNodes": [
            {
              "type": "variable",
              "name": "u",
              "id": 0
            },
            {
              "type": "collection",
              "name": "testCollection"
            },
            {
              "type": "no-op"
            }
          ]
        },
        {
          "type": "return",
          "subNodes": [
            {
              "type": "reference",
              "name": "u",
              "id": 0
            }
          ]
        }
      ]
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.