{ "basePath": "/", "swaggerVersion": "1.1", "apiVersion": "0.1", "apis": [ { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "201" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "body", "required": true, "name": "query", "description": "Contains the query specification.

" } ], "notes": "

This will find all documents matching a given example, using the specified skiplist index.

The call expects a JSON object as body with the following attributes:

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

", "summary": " Skiplist index", "httpMethod": "PUT", "examples": "", "nickname": "SkiplistIndex" } ], "path": "/_api/simple/by-example-skiplist" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "201" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "body", "required": true, "name": "query", "description": "Contains the query specification.

" } ], "notes": "

This will find all documents matching a given condition, using the specified skiplist index.

The call expects a JSON object as body with the following attributes:

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

", "summary": "Query by-condition using Skiplist index", "httpMethod": "PUT", "examples": "", "nickname": "QueryBy-conditionUsingSkiplistIndex" } ], "path": "/_api/simple/by-condition-skiplist" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "201" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

Returns all documents of a collections. The call expects a JSON object as body with the following attributes:

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

", "summary": " Return all", "httpMethod": "PUT", "examples": "

Limit the amount of documents using limit



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/all <<EOF\n{ \"collection\": \"products\", \"skip\": 2, \"limit\" : 2 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1465263157\", \n      \"_key\" : \"1465263157\", \n      \"_rev\" : \"1465263157\", \n      \"Hello2\" : \"World2\" \n    }, \n    { \n      \"_id\" : \"products/1465590837\", \n      \"_key\" : \"1465590837\", \n      \"_rev\" : \"1465590837\", \n      \"Hello3\" : \"World3\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Using a batchSize value



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/all <<EOF\n{ \"collection\": \"products\", \"batchSize\" : 3 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1468277813\", \n      \"_key\" : \"1468277813\", \n      \"_rev\" : \"1468277813\", \n      \"Hello5\" : \"World5\" \n    }, \n    { \n      \"_id\" : \"products/1467950133\", \n      \"_key\" : \"1467950133\", \n      \"_rev\" : \"1467950133\", \n      \"Hello4\" : \"World4\" \n    }, \n    { \n      \"_id\" : \"products/1466967093\", \n      \"_key\" : \"1466967093\", \n      \"_rev\" : \"1466967093\", \n      \"Hello1\" : \"World1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"1468474421\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "ReturnAll" } ], "path": "/_api/simple/all" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "200" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

Returns a random document from a collection. The call expects a JSON object as body with the following attributes:

Returns a JSON object with the document stored in the attribute document if the collection contains at least one document. If the collection is empty, the document attrbute contains null.

", "summary": " Random document", "httpMethod": "PUT", "examples": "



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/any <<EOF\n{ \"collection\": \"products\" }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"document\" : { \n    \"_id\" : \"products/1469260853\", \n    \"_key\" : \"1469260853\", \n    \"_rev\" : \"1469260853\", \n    \"Hello2\" : \"World2\" \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n



", "nickname": "RandomDocument" } ], "path": "/_api/simple/any" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "201" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

The default will find at most 100 documents near the given coordinate. The returned array is sorted according to the distance, with the nearest document being first in the return array. If there are near documents of equal distance, documents are chosen randomly from this set until the limit is reached.

In order to use the near operator, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more than one geo-spatial index, you can use the geo field to select a particular index.

The call expects a JSON object as body with the following attributes:

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

", "summary": " Near query", "httpMethod": "PUT", "examples": "

Without distance:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near <<EOF\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1472341045\", \n      \"_key\" : \"1472341045\", \n      \"_rev\" : \"1472341045\", \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/1471947829\", \n      \"_key\" : \"1471947829\", \n      \"_rev\" : \"1471947829\", \n      \"name\" : \"Name/-0.002/\", \n      \"loc\" : [ \n        -0.002, \n        0 \n      ] \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



With distance:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near <<EOF\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\" }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1474962485\", \n      \"_key\" : \"1474962485\", \n      \"_rev\" : \"1474962485\", \n      \"name\" : \"Name/-0.002/\", \n      \"loc\" : [ \n        -0.002, \n        0 \n      ], \n      \"distance\" : 222.38985328911744 \n    }, \n    { \n      \"_id\" : \"products/1475355701\", \n      \"_key\" : \"1475355701\", \n      \"_rev\" : \"1475355701\", \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ], \n      \"distance\" : 222.38985328911744 \n    }, \n    { \n      \"_id\" : \"products/1474765877\", \n      \"_key\" : \"1474765877\", \n      \"_rev\" : \"1474765877\", \n      \"name\" : \"Name/-0.004/\", \n      \"loc\" : [ \n        -0.004, \n        0 \n      ], \n      \"distance\" : 444.779706578235 \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 3, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "NearQuery" } ], "path": "/_api/simple/near" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "201" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will find all documents within a given radius around the coordinate (latitude, longitude). The returned list is sorted by distance.

In order to use the within operator, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more than one geo-spatial index, you can use the geo field to select a particular index.

The call expects a JSON object as body with the following attributes:

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

", "summary": " Within query", "httpMethod": "PUT", "examples": "

Without distance:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near <<EOF\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2, \"radius\" : 500 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1478370357\", \n      \"_key\" : \"1478370357\", \n      \"_rev\" : \"1478370357\", \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/1477977141\", \n      \"_key\" : \"1477977141\", \n      \"_rev\" : \"1477977141\", \n      \"name\" : \"Name/-0.002/\", \n      \"loc\" : [ \n        -0.002, \n        0 \n      ] \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



With distance:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near <<EOF\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\", \"radius\" : 300 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1480991797\", \n      \"_key\" : \"1480991797\", \n      \"_rev\" : \"1480991797\", \n      \"name\" : \"Name/-0.002/\", \n      \"loc\" : [ \n        -0.002, \n        0 \n      ], \n      \"distance\" : 222.38985328911744 \n    }, \n    { \n      \"_id\" : \"products/1481385013\", \n      \"_key\" : \"1481385013\", \n      \"_rev\" : \"1481385013\", \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ], \n      \"distance\" : 222.38985328911744 \n    }, \n    { \n      \"_id\" : \"products/1480795189\", \n      \"_key\" : \"1480795189\", \n      \"_rev\" : \"1480795189\", \n      \"name\" : \"Name/-0.004/\", \n      \"loc\" : [ \n        -0.004, \n        0 \n      ], \n      \"distance\" : 444.779706578235 \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 3, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "WithinQuery" } ], "path": "/_api/simple/within" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "201" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will find all documents within the specified rectangle (determined by the given coordinates (latitude1, longitude1, latitude2, longitude2).

In order to use the within-rectangle query, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more than one geo-spatial index, you can use the geo field to select a particular index.

The call expects a JSON object as body with the following attributes:

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

", "summary": " Within rectangle query", "httpMethod": "PUT", "examples": "



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/within-rectangle <<EOF\n{\"collection\":\"products\",\"latitude1\":0,\"longitude1\":0,\"latitude2\":0.2,\"longitude2\":0.2,\"skip\":1,\"limit\":2}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1484989493\", \n      \"_key\" : \"1484989493\", \n      \"_rev\" : \"1484989493\", \n      \"name\" : \"Name/0.008/\", \n      \"loc\" : [ \n        0.008, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/1484792885\", \n      \"_key\" : \"1484792885\", \n      \"_rev\" : \"1484792885\", \n      \"name\" : \"Name/0.006/\", \n      \"loc\" : [ \n        0.006, \n        0 \n      ] \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "WithinRectangleQuery" } ], "path": "/_api/simple/within-rectangle" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "201" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will find all documents from the collection that match the fulltext query specified in query.

In order to use the fulltext operator, a fulltext index must be defined for the collection and the specified attribute.

The call expects a JSON object as body with the following attributes:

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

", "summary": " Fulltext index query", "httpMethod": "PUT", "examples": "



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/fulltext <<EOF\n{ \"collection\": \"products\", \"attribute\" : \"text\", \"query\" : \"word\" }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1486169141\", \n      \"_key\" : \"1486169141\", \n      \"_rev\" : \"1486169141\", \n      \"text\" : \"this text also has a word\" \n    }, \n    { \n      \"_id\" : \"products/1485972533\", \n      \"_key\" : \"1485972533\", \n      \"_rev\" : \"1485972533\", \n      \"text\" : \"this text contains word\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "FulltextIndexQuery" } ], "path": "/_api/simple/fulltext" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "201" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will find all documents matching a given example.

The call expects a JSON object as body with the following attributes:

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

", "summary": " Simple query by-example", "httpMethod": "PUT", "examples": "

Matching an attribute:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example <<EOF\n{ \"collection\": \"products\", \"example\" :  { \"i\" : 1 }  }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1488135221\", \n      \"_key\" : \"1488135221\", \n      \"_rev\" : \"1488135221\", \n      \"i\" : 1 \n    }, \n    { \n      \"_id\" : \"products/1487545397\", \n      \"_key\" : \"1487545397\", \n      \"_rev\" : \"1487545397\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 1, \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/1487873077\", \n      \"_key\" : \"1487873077\", \n      \"_rev\" : \"1487873077\", \n      \"i\" : 1, \n      \"a\" : { \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/1488331829\", \n      \"_key\" : \"1488331829\", \n      \"_rev\" : \"1488331829\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 2, \n        \"j\" : 2 \n      } \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 4, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Matching an attribute which is a sub-document:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a.j\" : 1 } }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1489511477\", \n      \"_key\" : \"1489511477\", \n      \"_rev\" : \"1489511477\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 1, \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/1489839157\", \n      \"_key\" : \"1489839157\", \n      \"_rev\" : \"1489839157\", \n      \"i\" : 1, \n      \"a\" : { \n        \"j\" : 1 \n      } \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Matching an attribute within a sub-document:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1491805237\", \n      \"_key\" : \"1491805237\", \n      \"_rev\" : \"1491805237\", \n      \"i\" : 1, \n      \"a\" : { \n        \"j\" : 1 \n      } \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 1, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "SimpleQueryBy-example" } ], "path": "/_api/simple/by-example" }, { "operations": [ { "errorResponses": [ { "reason": "is returned when the query was successfully executed.

", "code": "200" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "Json", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will return the first document matching a given example.

The call expects a JSON object as body with the following attributes:

Returns a result containing the document or HTTP 404 if no document matched the example.

If more than one document in the collection matches the specified example, only one of these documents will be returned, and it is undefined which of the matching documents is returned.

", "summary": " Document matching an example", "httpMethod": "PUT", "examples": "

If a matching document was found:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first-example <<EOF\n{ \"collection\": \"products\", \"example\" :  { \"i\" : 1 }  }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"document\" : { \n    \"_id\" : \"products/1494230069\", \n    \"_key\" : \"1494230069\", \n    \"_rev\" : \"1494230069\", \n    \"i\" : 1, \n    \"a\" : { \n      \"k\" : 2, \n      \"j\" : 2 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n



If no document was found:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first-example <<EOF\n{ \"collection\": \"products\", \"example\" :  { \"l\" : 1 }  }\nEOF\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 404, \n  \"errorNum\" : 404, \n  \"errorMessage\" : \"no match\" \n}\n



", "nickname": "DocumentMatchingAnExample" } ], "path": "/_api/simple/first-example" }, { "operations": [ { "errorResponses": [ { "reason": "is returned when the query was successfully executed.

", "code": "200" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "Json", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will return the first document(s) from the collection, in the order of insertion/update time. When the count argument is supplied, the result will be an array of documents, with the \"oldest\" document being first in the result array. If the count argument is not supplied, the result is the \"oldest\" document of the collection, or null if the collection is empty.

The request body must be a JSON object with the following attributes: Note: this method is not supported for sharded collections with more than one shard.

", "summary": " First document of a collection", "httpMethod": "PUT", "examples": "

Retrieving the first n documents:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first <<EOF\n{ \"collection\": \"products\", \"count\" : 2 }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1497244725\", \n      \"_key\" : \"1497244725\", \n      \"_rev\" : \"1497244725\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 1, \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/1497572405\", \n      \"_key\" : \"1497572405\", \n      \"_rev\" : \"1497572405\", \n      \"i\" : 1, \n      \"a\" : { \n        \"j\" : 1 \n      } \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n



Retrieving the first document:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first <<EOF\n{ \"collection\": \"products\" }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"_id\" : \"products/1498883125\", \n    \"_key\" : \"1498883125\", \n    \"_rev\" : \"1498883125\", \n    \"i\" : 1, \n    \"a\" : { \n      \"k\" : 1, \n      \"j\" : 1 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n



", "nickname": "FirstDocumentOfACollection" } ], "path": "/_api/simple/first" }, { "operations": [ { "errorResponses": [ { "reason": "is returned when the query was successfully executed.

", "code": "200" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "Json", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will return the last documents from the collection, in the order of insertion/update time. When the count argument is supplied, the result will be an array of documents, with the \"latest\" document being first in the result array.

The request body must be a JSON object with the following attributes: If the count argument is not supplied, the result is the \"latest\" document of the collection, or null if the collection is empty.

Note: this method is not supported for sharded collections with more than one shard.

", "summary": " Last document of a collection", "httpMethod": "PUT", "examples": "

Retrieving the last n documents:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/last <<EOF\n{ \"collection\": \"products\", \"count\" : 2 }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1501307957\", \n      \"_key\" : \"1501307957\", \n      \"_rev\" : \"1501307957\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 2, \n        \"j\" : 2 \n      } \n    }, \n    { \n      \"_id\" : \"products/1501111349\", \n      \"_key\" : \"1501111349\", \n      \"_rev\" : \"1501111349\", \n      \"i\" : 1 \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n



Retrieving the first document:



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/last <<EOF\n{ \"collection\": \"products\" }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"_id\" : \"products/1502946357\", \n    \"_key\" : \"1502946357\", \n    \"_rev\" : \"1502946357\", \n    \"i\" : 1, \n    \"a\" : { \n      \"k\" : 2, \n      \"j\" : 2 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n



", "nickname": "LastDocumentOfACollection" } ], "path": "/_api/simple/last" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "201" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown or no suitable index for the range query is present. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "Json", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will find all documents within a given range. In order to execute a range query, a skip-list index on the queried attribute must be present.

The call expects a JSON object as body with the following attributes:

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

", "summary": " Simple range query", "httpMethod": "PUT", "examples": "



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/range <<EOF\n{ \"collection\": \"products\", \"attribute\" : \"i\", \"left\" : 2, \"right\" : 4 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/1503929397\", \n      \"_key\" : \"1503929397\", \n      \"_rev\" : \"1503929397\", \n      \"i\" : 2 \n    }, \n    { \n      \"_id\" : \"products/1504126005\", \n      \"_key\" : \"1504126005\", \n      \"_rev\" : \"1504126005\", \n      \"i\" : 3 \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "SimpleRangeQuery" } ], "path": "/_api/simple/range" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "200" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "Json", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will find all documents in the collection that match the specified example object.

The call expects a JSON object as body with the following attributes:

Note: the limit attribute is not supported on sharded collections. Using it will result in an error.

Returns the number of documents that were deleted.

", "summary": " Remove documents by example", "httpMethod": "PUT", "examples": "



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"deleted\" : 1, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

Using Parameter: waitForSync and limit

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } },\"waitForSync\": true, \"limit\": 2 }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"deleted\" : 1, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

Using Parameter: waitForSync and limit with new signature

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example <<EOF\n{\"collection\": \"products\",\"example\" : { \"a\" : { \"j\" : 1 } },\"options\": {\"waitForSync\": true, \"limit\": 2} }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"deleted\" : 1, \n  \"error\" : false, \n  \"code\" : 200 \n}\n



", "nickname": "RemoveDocumentsByExample" } ], "path": "/_api/simple/remove-by-example" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the query was executed successfully.

", "code": "200" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "Json", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will find all documents in the collection that match the specified example object, and replace the entire document body with the new value specified. Note that document meta-attributes such as _id, _key, _from, _to etc. cannot be replaced.

The call expects a JSON object as body with the following attributes:

Note: the limit attribute is not supported on sharded collections. Using it will result in an error.

Returns the number of documents that were replaced.

", "summary": " Replace documents by example", "httpMethod": "PUT", "examples": "



shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/replace-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : {\"foo\" : \"bar\"}, \"limit\" : 3 }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"replaced\" : 1, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

Using new Signature for attributes WaitForSync and limit

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/replace-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : {\"foo\" : \"bar\"}, \"options\": {\"limit\" : 3,  \"waitForSync\": true  }}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"replaced\" : 1, \n  \"error\" : false, \n  \"code\" : 200 \n}\n



", "nickname": "ReplaceDocumentsByExample" } ], "path": "/_api/simple/replace-by-example" }, { "operations": [ { "errorResponses": [ { "reason": "is returned if the collection was updated successfully and waitForSync was true.

", "code": "200" }, { "reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.

", "code": "400" }, { "reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.

", "code": "404" } ], "parameters": [ { "dataType": "Json", "paramType": "body", "required": true, "name": "query", "description": "Contains the query.

" } ], "notes": "

This will find all documents in the collection that match the specified example object, and partially update the document body with the new value specified. Note that document meta-attributes such as _id, _key, _from, _to etc. cannot be replaced.

The call expects a JSON object as body with the following attributes:

Note: the limit attribute is not supported on sharded collections. Using it will result in an error.

Returns the number of documents that were updated.



", "summary": " Update documents by example", "httpMethod": "PUT", "examples": "using old syntax for options

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/update-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : { \"a\" : { \"j\" : 22 } }, \"limit\" : 3 }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"updated\" : 1, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

using new signature for options

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/update-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : { \"a\" : { \"j\" : 22 } }, \"options\" :  { \"limit\" : 3, \"waitForSync\": true }  }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"updated\" : 1, \n  \"error\" : false, \n  \"code\" : 200 \n}\n



", "nickname": "UpdateDocumentsByExample" } ], "path": "/_api/simple/update-by-example" } ] }