{ "basePath": "/", "swaggerVersion": "1.1", "apiVersion": "0.1", "apis": [ { "operations": [ { "errorResponses": [ { "reason": "is returned if the result set can be created by the server.

", "code": "201" }, { "reason": "is returned if the JSON representation is malformed or the query specification is missing from the request.

", "code": "400" }, { "reason": "The server will respond with HTTP 404 in case a non-existing collection is accessed in the query.

", "code": "404" }, { "reason": "The server will respond with HTTP 405 if an unsupported HTTP method is used.

", "code": "405" } ], "parameters": [ { "dataType": "Json", "paramType": "body", "required": "true", "name": "query", "description": "A JSON object describing the query and query parameters.

" } ], "notes": "The query details include the query string plus optional query options and bind parameters. These values need to be passed in a JSON representation in the body of the POST request.

The following attributes can be used inside the JSON object:

The following options are supported at the moment:

If the result set can be created by the server, the server will respond with HTTP 201. The body of the response will contain a JSON object with the result set.

The returned JSON object has the following properties:

If the JSON representation is malformed or the query specification is missing from the request, the server will respond with HTTP 400.

The body of the response will contain a JSON object with additional error details. The object has the following attributes:

If the query specification is complete, the server will process the query. If an error occurs during query processing, the server will respond with HTTP 400. Again, the body of the response will contain details about the error.

A list of query errors can be found (../ArangoErrors/README.md) here.

", "summary": " Create cursor", "httpMethod": "POST", "examples": "

Executes a query and extract the result in a single go:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 2 RETURN p\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/917896360\", \n      \"_key\" : \"917896360\", \n      \"_rev\" : \"917896360\", \n      \"hello2\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/917568680\", \n      \"_key\" : \"917568680\", \n      \"_rev\" : \"917568680\", \n      \"hello1\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Executes a query and extracts part of the result:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 5 RETURN p\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/919796904\", \n      \"_key\" : \"919796904\", \n      \"_rev\" : \"919796904\", \n      \"hello5\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/919141544\", \n      \"_key\" : \"919141544\", \n      \"_rev\" : \"919141544\", \n      \"hello3\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"919993512\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Using a query option:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR i IN 1..1000 FILTER i > 500 LIMIT 10 RETURN i\",\"count\":true,\"options\":{\"fullCount\":true}}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    501, \n    502, \n    503, \n    504, \n    505, \n    506, \n    507, \n    508, \n    509, \n    510 \n  ], \n  \"hasMore\" : false, \n  \"count\" : 10, \n  \"extra\" : { \n    \"fullCount\" : 500 \n  }, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Executes a data-modification query and retrieves the number of modified documents:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products REMOVE p IN products\"}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ ], \n  \"hasMore\" : false, \n  \"extra\" : { \n    \"operations\" : { \n      \"executed\" : 2, \n      \"ignored\" : 0 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Executes a data-modification query with option ignoreErrors:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"REMOVE 'bar' IN products OPTIONS { ignoreErrors: true }\"}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ ], \n  \"hasMore\" : false, \n  \"extra\" : { \n    \"operations\" : { \n      \"executed\" : 0, \n      \"ignored\" : 1 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Bad queries:

Missing body:



shell> curl -X POST --dump - http://localhost:8529/_api/cursor\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 400, \n  \"errorNum\" : 1502, \n  \"errorMessage\" : \"query is empty\" \n}\n



Unknown collection:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR u IN unknowncoll LIMIT 2 RETURN u\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 404, \n  \"errorNum\" : 1203, \n  \"errorMessage\" : \"cannot execute query: collection not found: 'unknowncoll'\" \n}\n



Executes a data-modification query that attempts to remove a non-existing document:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"REMOVE 'foo' IN products\"}\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 404, \n  \"errorNum\" : 1202, \n  \"errorMessage\" : \"document not found\" \n}\n





", "nickname": "CreateCursor" } ], "path": "/_api/cursor" }, { "operations": [ { "errorResponses": [ { "reason": "The server will respond with HTTP 200 in case of success.

", "code": "200" }, { "reason": "If the cursor identifier is omitted, the server will respond with HTTP 404.

", "code": "400" }, { "reason": "If no cursor with the specified identifier can be found, the server will respond with HTTP 404.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "path", "required": "true", "name": "cursor-identifier", "description": "The name of the cursor

" } ], "notes": "

If the cursor is still alive, returns an object with the following attributes.

Note that even if hasMore returns true, the next call might still return no documents. If, however, hasMore is false, then the cursor is exhausted. Once the hasMore attribute has a value of false, the client can stop.

", "summary": " Read next batch from cursor", "httpMethod": "PUT", "examples": "

Valid request for next batch:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 5 RETURN p\",\"count\":true,\"batchSize\":2}\n\nshell> curl -X PUT --dump - http://localhost:8529/_api/cursor/924777640\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/923597992\", \n      \"_key\" : \"923597992\", \n      \"_rev\" : \"923597992\", \n      \"hello2\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/924253352\", \n      \"_key\" : \"924253352\", \n      \"_rev\" : \"924253352\", \n      \"hello4\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"924777640\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 200 \n}\n



Missing identifier



shell> curl -X PUT --dump - http://localhost:8529/_api/cursor\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 400, \n  \"errorNum\" : 400, \n  \"errorMessage\" : \"bad parameter\" \n}\n



Unknown identifier



shell> curl -X PUT --dump - http://localhost:8529/_api/cursor/123123\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 404, \n  \"errorNum\" : 1600, \n  \"errorMessage\" : \"cursor not found\" \n}\n



", "nickname": "ReadNextBatchFromCursor" } ], "path": "/_api/cursor/{cursor-identifier}" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the server is aware of the cursor.

", "code": "202" }, { "reason": "is returned if the server is not aware of the cursor. It is also returned if a cursor is used after it has been destroyed.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "path", "required": "true", "name": "cursor-identifier", "description": "The name of the cursor

" } ], "notes": "Deletes the cursor and frees the resources associated with it.

The cursor will automatically be destroyed on the server when the client has retrieved all documents from it. The client can also explicitly destroy the cursor at any earlier time using an HTTP DELETE request. The cursor id must be included as part of the URL.

Note: the server will also destroy abandoned cursors automatically after a certain server-controlled timeout to avoid resource leakage.

", "summary": " Delete cursor", "httpMethod": "DELETE", "examples": "



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 5 RETURN p\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/925564072\", \n      \"_key\" : \"925564072\", \n      \"_rev\" : \"925564072\", \n      \"hello2\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/926219432\", \n      \"_key\" : \"926219432\", \n      \"_rev\" : \"926219432\", \n      \"hello4\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"926743720\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 201 \n}\nshell> curl -X DELETE --data-binary @- --dump - http://localhost:8529/_api/cursor/926743720\n\n



", "nickname": "DeleteCursor" } ], "path": "/_api/cursor/{cursor-identifier}" } ] }