{ "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" } ], "parameters": [ { "dataType": "Json", "paramType": "body", "required": "true", "name": "query", "description": "The following attributes can be used inside the JSON object: - query: contains the query string to be executed (mandatory) - count: boolean flag that indicates whether the number of documents found should be returned as \"count\" attribute in the result set (optional). Calculating the \"count\" attribute might have a performance penalty for some queries so this option is turned off by default. - batchSize: maximum number of result documents to be transferred from the server to the client in one roundtrip (optional). If this attribute is not set, a server-controlled default value will be used. - bindVars: key/value list of bind parameters (optional). " } ], "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:

- query: contains the query string to be executed (mandatory)

- count: boolean flag that indicates whether the number of documents found should be returned as \"count\" attribute in the result set (optional). Calculating the \"count\" attribute might have a performance penalty for some queries so this option is turned off by default.

- batchSize: maximum number of result documents to be transferred from the server to the client in one roundtrip (optional). If this attribute is not set, a server-controlled default value will be used.

- bindVars: key/value list of bind parameters (optional).

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 JSON object has the following properties:

- error: boolean flag to indicate that an error occurred (false in this case)

- code: the HTTP status code

- result: an array of result documents (might be empty if query has no results)

- hasMore: a boolean indicator whether there are more results available on the server

- count: the total number of result documents available (only available if the query was executed with the count attribute set.

- id: id of temporary cursor created on the server (optional, see above)

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:

- error: boolean flag to indicate that an error occurred (true in this case)

- code: the HTTP status code

- errorNum: the server error number

- errorMessage: a descriptive error message

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 @ref ArangoErrors here.

", "summary": "creates a cursor", "httpMethod": "POST", "examples": "Executes a query and extract the result in a single go:

unix> curl -X POST --data @- --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/134753500\", \n      \"_rev\" : \"134753500\", \n      \"_key\" : \"134753500\", \n      \"hello1\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/135081180\", \n      \"_rev\" : \"135081180\", \n      \"_key\" : \"135081180\", \n      \"hello2\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

Executes a query and extract part of the result:

unix> curl -X POST --data @- --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/165424348\", \n      \"_rev\" : \"165424348\", \n      \"_key\" : \"165424348\", \n      \"hello4\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/165686492\", \n      \"_rev\" : \"165686492\", \n      \"_key\" : \"165686492\", \n      \"hello5\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"165817564\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

Bad queries: Missing body:

unix> 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\n

Unknown collection:

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

", "nickname": "createsACursor" } ], "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 ommitted or somehow invalid, the server will respond with HTTP 404. ", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "path", "required": "true", "name": "cursor-identifer", "description": "The name of the cursor " } ], "notes": "

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

- id: the cursor-identifier- result: a list of documents for the current batch- hasMore: false if this was the last batch- count: if present the total number of elements

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": "reads next batch from a cursor", "httpMethod": "PUT", "examples": "Valid request for next batch:

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

Missing identifier

unix> 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\n

Unknown identifier

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

", "nickname": "readsNextBatchFromACursor" } ], "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-identifer", "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": "deletes a cursor", "httpMethod": "DELETE", "examples": "

unix> curl -X POST --data @- --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/232074460\", \n      \"_rev\" : \"232074460\", \n      \"_key\" : \"232074460\", \n      \"hello2\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/232336604\", \n      \"_rev\" : \"232336604\", \n      \"_key\" : \"232336604\", \n      \"hello3\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"232991964\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\nunix> curl -X DELETE --dump - http://localhost:8529/_api/cursor/232991964\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"232991964\", \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

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