{ "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 hash index.

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

Returns a cursor containing the result, see the manual for details.

", "summary": "executes query by-example using a hash index", "httpMethod": "PUT", "examples": "", "nickname": "executesQueryBy-exampleUsingAHashIndex" } ], "path": "/_api/simple/by-example-hash" }, { "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 the manual for details.

", "summary": "executes query by-example using a skiplist index", "httpMethod": "PUT", "examples": "", "nickname": "executesQueryBy-exampleUsingASkiplistIndex" } ], "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 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 the manual for details.

", "summary": "executes query by-example using a bitarray index", "httpMethod": "PUT", "examples": "", "nickname": "executesQueryBy-exampleUsingABitarrayIndex" } ], "path": "/_api/simple/by-example-bitarray" }, { "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 the manual for details.

", "summary": "executes query by-condition using a skiplist index", "httpMethod": "PUT", "examples": "", "nickname": "executesQueryBy-conditionUsingASkiplistIndex" } ], "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. 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 the manual for details.

", "summary": "executes query by-condition using a bitarray index", "httpMethod": "PUT", "examples": "", "nickname": "executesQueryBy-conditionUsingABitarrayIndex" } ], "path": "/_api/simple/by-condition-bitarray" }, { "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 the manual for details.

", "summary": "executes simple query ALL", "httpMethod": "PUT", "examples": "

Limit the amount of documents using limit



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



Using a batchSize value



unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/all\n{ \"collection\": \"products\", \"batchSize\" : 3 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/190595495\", \n      \"_rev\" : \"190595495\", \n      \"_key\" : \"190595495\", \n      \"Hello2\" : \"World2\" \n    }, \n    { \n      \"_id\" : \"products/191578535\", \n      \"_rev\" : \"191578535\", \n      \"_key\" : \"191578535\", \n      \"Hello5\" : \"World5\" \n    }, \n    { \n      \"_id\" : \"products/190267815\", \n      \"_rev\" : \"190267815\", \n      \"_key\" : \"190267815\", \n      \"Hello1\" : \"World1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"191775143\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "executesSimpleQueryAll" } ], "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": "returns a random document from a collection", "httpMethod": "PUT", "examples": "



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

", "nickname": "returnsARandomDocumentFromACollection" } ], "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 list is sorted according to the distance, with the nearest document being first in the list. 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 then 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 the manual for details.

", "summary": "executes a near query", "httpMethod": "PUT", "examples": "

Without distance:



unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/195445159\", \n      \"_rev\" : \"195445159\", \n      \"_key\" : \"195445159\", \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/195051943\", \n      \"_rev\" : \"195051943\", \n      \"_key\" : \"195051943\", \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\n



With distance:



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

", "nickname": "executesANearQuery" } ], "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 then 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 the manual for details.

", "summary": "executes a within query", "httpMethod": "PUT", "examples": "

Without distance:



unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2, \"radius\" : 500 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/201212327\", \n      \"_rev\" : \"201212327\", \n      \"_key\" : \"201212327\", \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/200819111\", \n      \"_rev\" : \"200819111\", \n      \"_key\" : \"200819111\", \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\n



With distance:



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

", "nickname": "executesAWithinQuery" } ], "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 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 the manual for details.

", "summary": "executes a fulltext index query", "httpMethod": "PUT", "examples": "



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

", "nickname": "executesAFulltextIndexQuery" } ], "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 the manual for details.

", "summary": "executes simple query by-example", "httpMethod": "PUT", "examples": "

Matching an attribute:



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



Matching an attribute which is a sub-document:



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



Matching an attribute within a sub-document:



unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/211239335\", \n      \"_rev\" : \"211239335\", \n      \"_key\" : \"211239335\", \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\n

", "nickname": "executesSimpleQueryBy-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": "returns a document matching an example", "httpMethod": "PUT", "examples": "

If a matching document was found:



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



If no document was found:



unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first-example\n{ \"collection\": \"products\", \"example\" :  { \"l\" : 1 }  }\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\n

", "nickname": "returnsADocumentMatchingAnExample" } ], "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 a list of documents, with the \"oldest\" document being first in the result list. 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": "returns the first document(s) of a collection", "httpMethod": "PUT", "examples": "

Retrieving the first n documents:



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



Retrieving the first document:



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

", "nickname": "returnsTheFirstDocument(s)OfACollection" } ], "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 a list of documents, with the \"latest\" document being first in the result list.

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": "returns the last document(s) of a collection", "httpMethod": "PUT", "examples": "

Retrieving the last n documents:



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



Retrieving the first document:



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

", "nickname": "returnsTheLastDocument(s)OfACollection" } ], "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. 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 the manual for details.

", "summary": "executes simple range query", "httpMethod": "PUT", "examples": "



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

", "nickname": "executesSimpleRangeQuery" } ], "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. The options attributes waitForSync and limit can given yet without an ecapsulation into a json object. but this may be deprecated in future versions of arango

Returns the number of documents that were deleted.

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



unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\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\n

Using Parameter: waitForSync and limit

unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } },\"waitForSync\": true, \"limit\": 2 }\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\n

Using Parameter: waitForSync and limit with new signature

unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example\n{\"collection\": \"products\",\"example\" : { \"a\" : { \"j\" : 1 } },\"options\": {\"waitForSync\": true, \"limit\": 2} }\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\n

", "nickname": "removesDocumentsByExample" } ], "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. The options attributes waitForSync and limit can given yet without an ecapsulation into a json object. but this may be deprecated in future versions of arango

Returns the number of documents that were replaced.

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



unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/replace-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : {\"foo\" : \"bar\"}, \"options\": {\"limit\" : 3,  \"waitForSync\": true  }}\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\n

Using new Signature for attributes WaitForSync and limit

unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/replace-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : {\"foo\" : \"bar\"}, \"options\": {\"limit\" : 3,  \"waitForSync\": true  }}\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\n

", "nickname": "replacesDocumentsByExample" } ], "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": "updates documents by example", "httpMethod": "PUT", "examples": "using old syntax for options

unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/update-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : { \"a\" : { \"j\" : 22 } }, \"limit\" : 3 }\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\n

using new signature for options

unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/update-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : { \"a\" : { \"j\" : 22 } }, \"options\" :  { \"limit\" : 3, \"waitForSync\": true }  }\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\n

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