1
0
Fork 0
arangodb/js/apps/system/_admin/aardvark/APP/api-docs/query.json

39 lines
5.1 KiB
JSON

{
"basePath": "/",
"swaggerVersion": "1.1",
"apiVersion": "0.1",
"apis": [
{
"operations": [
{
"errorResponses": [
{
"reason": "If the query is valid, the server will respond with <em>HTTP 200</em> and return the names of the bind parameters it found in the query (if any) in the <em>bindVars</em> attribute of the response. It will also return an array of the collections used in the query in the <em>collections</em> attribute. If a query can be parsed successfully, the <em>ast</em> attribute of the returned JSON will contain the abstract syntax tree representation of the query. The format of the <em>ast</em> is subject to change in future versions of ArangoDB, but it can be used to inspect how ArangoDB interprets a given query. Note that the abstract syntax tree will be returned without any optimizations applied to it. <br><br>",
"code": "200"
},
{
"reason": "The server will respond with <em>HTTP 400</em> in case of a malformed request, or if the query contains a parse error. The body of the response will contain the error details embedded in a JSON object. <br><br>",
"code": "400"
}
],
"parameters": [
{
"dataType": "Json",
"paramType": "body",
"required": true,
"name": "query",
"description": "To validate a query string without executing it, the query string can be passed to the server via an HTTP POST request. <br><br> The query string needs to be passed in the attribute <em>query</em> of a JSON object as the body of the POST request. <br><br>"
}
],
"notes": "",
"summary": " Parse an AQL query",
"httpMethod": "POST",
"examples": "<br><br> Valid query: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/query\n{ \"query\" : \"FOR p IN products FILTER p.name == @name LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"bindVars\" : [ \n \"name\" \n ], \n \"collections\" : [ \n \"products\" \n ], \n \"ast\" : [ \n { \n \"type\" : \"root\", \n \"subNodes\" : [ \n { \n \"type\" : \"for\", \n \"subNodes\" : [ \n { \n \"type\" : \"variable\", \n \"name\" : \"p\", \n \"id\" : 0 \n }, \n { \n \"type\" : \"collection\", \n \"name\" : \"products\" \n } \n ] \n }, \n { \n \"type\" : \"filter\", \n \"subNodes\" : [ \n { \n \"type\" : \"compare ==\", \n \"subNodes\" : [ \n { \n \"type\" : \"attribute access\", \n \"name\" : \"name\", \n \"subNodes\" : [ \n { \n \"type\" : \"reference\", \n \"name\" : \"p\", \n \"id\" : 0 \n } \n ] \n }, \n { \n \"type\" : \"parameter\", \n \"name\" : \"name\" \n } \n ] \n } \n ] \n }, \n { \n \"type\" : \"limit\", \n \"subNodes\" : [ \n { \n \"type\" : \"value\", \n \"value\" : 0 \n }, \n { \n \"type\" : \"value\", \n \"value\" : 2 \n } \n ] \n }, \n { \n \"type\" : \"return\", \n \"subNodes\" : [ \n { \n \"type\" : \"attribute access\", \n \"name\" : \"n\", \n \"subNodes\" : [ \n { \n \"type\" : \"reference\", \n \"name\" : \"p\", \n \"id\" : 0 \n } \n ] \n } \n ] \n } \n ] \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Invalid query: <br><br><br><br><pre><code class=\"json\">shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/query\n{ \"query\" : \"FOR p IN products FILTER p.name = @name LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 1501, \n \"errorMessage\" : \"syntax error, unexpected assignment near '= @name LIMIT 2 RETURN p.n' at position 1:33\" \n}\n</code></pre><br><br><br>",
"nickname": "ParseAnAqlQuery"
}
],
"path": "/_api/query"
}
]
}