diff --git a/CHANGELOG b/CHANGELOG index 353323482c..640d9cab2d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,34 @@ v1.4 ---- +* added collection detail dialog (web interface) + + Shows collection properties, figures (datafiles, journals, attributes, etc.) + and indexes. + +* added documents filter (web interface) + + Allows searching for documents based on attribute values. One or many filter + conditions can be defined, using comparison operators such as '==', '<=', etc. + +* improved AQL editor (web interface) + + Editor supports keyboard shortcuts (Submit, Undo, Redo, Select). + Editor allows saving and reusing of user-defined queries. + Added example queries to AQL editor. + Added comment button. + +* added document import (web interface) + + Allows upload of JSON-data from files. Files must have an extension of .json. + +* added dashboard (web interface) + + Shows the status of replication and multiple system charts, e.g. + Virtual Memory Size, Request Time, HTTP Connections etc. + +* added API method `/_api/graph` to query all graphs with all properties. + * added example queries in web interface AQL editor * added arango.reconnect() method for arangosh to dynamically switch server or diff --git a/Documentation/ImplementorManual/HttpImport.md b/Documentation/ImplementorManual/HttpImport.md index 770e1e7524..105b5da712 100644 --- a/Documentation/ImplementorManual/HttpImport.md +++ b/Documentation/ImplementorManual/HttpImport.md @@ -64,6 +64,9 @@ line-wise processing. To use this method, the `type` URL parameter should be set to `array`. +Setting the `type` URL parameter to `auto` will make the server auto-detect whether +the data are line-wise JSON documents (type = documents) or a JSON list (type = array). + @EXAMPLES @verbinclude api-import-documents diff --git a/Documentation/RefManual/JSModuleGraph.md b/Documentation/RefManual/JSModuleGraph.md index 9b25f3d88d..4f56d2f67e 100644 --- a/Documentation/RefManual/JSModuleGraph.md +++ b/Documentation/RefManual/JSModuleGraph.md @@ -66,6 +66,10 @@ examples assume @anchor JSModuleGraphGraphDrop @copydetails JSF_Graph_prototype_drop +@CLEARPAGE +@anchor JSModuleGraphGraphGetAll +@copydetails JSF_graph_getAll + @CLEARPAGE @anchor JSModuleGraphGraphGeodesics @copydetails JSF_Graph_prototype_geodesics diff --git a/Documentation/RefManual/JSModuleGraphTOC.md b/Documentation/RefManual/JSModuleGraphTOC.md index 4456fb87cc..20be4b48f2 100644 --- a/Documentation/RefManual/JSModuleGraphTOC.md +++ b/Documentation/RefManual/JSModuleGraphTOC.md @@ -13,6 +13,7 @@ TOC {#JSModuleGraphTOC} - @ref JSModuleGraphGraphRemoveEdge "Graph.removeEdge" - @ref JSModuleGraphGraphRemoveVertex "Graph.removeVertex" - @ref JSModuleGraphGraphDrop "Graph.drop" + - @ref JSModuleGraphGraphGetAll "Graph.getAll" - @ref JSModuleGraphGraphGeodesics "Graph.geodesics" - @ref JSModuleGraphGraphMeasurement "Graph.measurement" - @ref JSModuleGraphGraphNormalizedMeasurement "Graph.normalizedMeasurement" diff --git a/UnitTests/HttpInterface/api-graph-spec.rb b/UnitTests/HttpInterface/api-graph-spec.rb index bb0c94d005..e4700a080f 100644 --- a/UnitTests/HttpInterface/api-graph-spec.rb +++ b/UnitTests/HttpInterface/api-graph-spec.rb @@ -78,7 +78,6 @@ describe ArangoDB do return doc end - ################################################################################ ## checking graph responses ################################################################################ @@ -159,6 +158,20 @@ describe ArangoDB do doc2.code.should eq(400) doc2.parsed_response['error'].should eq(true) end + + it "checks get all graphs" do + doc1 = create_graph( prefix, graph_name, vertex_collection, edge_collection ) + doc1.code.should eq(201) + etag = doc1.headers['etag'] + + cmd = "/_api/graph" + doc2 = ArangoDB.log_get("#{prefix}", cmd) + + doc2.code.should eq(200) + doc2.parsed_response['graphs'].length.should eq(1) + doc2.parsed_response['graphs'][0]['_rev'].should eq(etag) + doc2.parsed_response['graphs'][0]['_key'].should eq(graph_name) + end it "checks create and get graph" do doc1 = create_graph( prefix, graph_name, vertex_collection, edge_collection ) diff --git a/UnitTests/HttpInterface/api-import-spec.rb b/UnitTests/HttpInterface/api-import-spec.rb index 9e2535d4cd..3885b79620 100644 --- a/UnitTests/HttpInterface/api-import-spec.rb +++ b/UnitTests/HttpInterface/api-import-spec.rb @@ -77,6 +77,23 @@ describe ArangoDB do doc.parsed_response['empty'].should eq(0) end + it "using different documents, type=auto" do + cmd = api + "?collection=#{@cn}&createCollection=true&type=auto" + body = "[ \n" + body += "{ \"name\" : \"John\", \"age\" : 29, \"gender\" : \"male\", \"likes\" : [ \"socket\", \"bind\", \"accept\" ] },\n" + body += "{ \"firstName\" : \"Jane\", \"lastName\" : \"Doe\", \"age\" : 35, \"gender\" : \"female\", \"livesIn\" : \"Manila\" },\n" + body += "{ \"sample\" : \"garbage\" },\n" + body += "{ }\n" + body += "]\n" + doc = ArangoDB.log_post("#{prefix}-array-different", cmd, :body => body) + + doc.code.should eq(201) + doc.parsed_response['error'].should eq(false) + doc.parsed_response['created'].should eq(4) + doc.parsed_response['errors'].should eq(0) + doc.parsed_response['empty'].should eq(0) + end + it "using whitespace" do cmd = api + "?collection=#{@cn}&createCollection=true&type=array" body = " [\n\n { \"name\" : \"John\", \"age\" : 29 }, \n \n \n \r\n \n { \"rubbish\" : \"data goes in here\" }\n\n ]" @@ -176,6 +193,21 @@ describe ArangoDB do doc.parsed_response['empty'].should eq(0) end + it "using different documents, type=auto" do + cmd = api + "?collection=#{@cn}&createCollection=true&type=auto" + body = "{ \"name\" : \"John\", \"age\" : 29, \"gender\" : \"male\", \"likes\" : [ \"socket\", \"bind\", \"accept\" ] }\n" + body += "{ \"firstName\" : \"Jane\", \"lastName\" : \"Doe\", \"age\" : 35, \"gender\" : \"female\", \"livesIn\" : \"Manila\" }\n" + body += "{ \"sample\" : \"garbage\" }\n" + body += "{ }" + doc = ArangoDB.log_post("#{prefix}-self-contained-different", cmd, :body => body) + + doc.code.should eq(201) + doc.parsed_response['error'].should eq(false) + doc.parsed_response['created'].should eq(4) + doc.parsed_response['errors'].should eq(0) + doc.parsed_response['empty'].should eq(0) + end + it "using whitespace" do cmd = api + "?collection=#{@cn}&createCollection=true&type=documents" body = "\n\n { \"name\" : \"John\", \"age\" : 29 } \n \n \n \r\n \n { \"rubbish\" : \"data goes in here\" }\n\n" diff --git a/UnitTests/HttpInterface/api-replication-spec.rb b/UnitTests/HttpInterface/api-replication-spec.rb index c25fd30909..43b8c46205 100644 --- a/UnitTests/HttpInterface/api-replication-spec.rb +++ b/UnitTests/HttpInterface/api-replication-spec.rb @@ -599,12 +599,12 @@ describe ArangoDB do cmd = api + "/dump?collection=UnitTestsReplication" doc = ArangoDB.log_get("#{prefix}-dump-empty", cmd, :body => "") - doc.code.should eq(200) + doc.code.should eq(204) doc.headers["x-arango-replication-checkmore"].should eq("false") doc.headers["x-arango-replication-lastincluded"].should eq("0") doc.headers["content-type"].should eq("application/x-arango-dump; charset=utf-8") - doc.response.body.should eq("") + doc.response.body.should eq(nil) end it "checks the dump for a non-empty collection" do diff --git a/arangod/RestHandler/RestImportHandler.cpp b/arangod/RestHandler/RestImportHandler.cpp index daf7c57a72..088d1010af 100644 --- a/arangod/RestHandler/RestImportHandler.cpp +++ b/arangod/RestHandler/RestImportHandler.cpp @@ -32,7 +32,6 @@ #include "BasicsC/string-buffer.h" #include "BasicsC/tri-strings.h" #include "Rest/HttpRequest.h" -#include "Utilities/ResourceHolder.h" #include "VocBase/document-collection.h" #include "VocBase/edge-collection.h" #include "VocBase/vocbase.h" @@ -121,24 +120,24 @@ HttpHandler::status_e RestImportHandler::execute () { switch (type) { case HttpRequest::HTTP_REQUEST_POST: { - // extract the import type - bool found; - string documentType = _request->value("type", found); + // extract the import type + bool found; + string documentType = _request->value("type", found); - if (found && documentType == "documents") { - // lines with individual JSON documents - res = createByDocumentsLines(); - } - else if (found && documentType == "array") { - // one JSON array - res = createByDocumentsList(); - } - else { - // CSV - res = createByKeyValueList(); - } + if (found && + (documentType == "documents" || + documentType == "array" || + documentType == "list" || + documentType == "auto")) { + res = createFromJson(documentType); + } + else { + // CSV + res = createFromKeyValueList(); } break; + } + default: res = false; generateNotImplemented("ILLEGAL " + DOCUMENT_IMPORT_PATH); @@ -168,11 +167,12 @@ HttpHandler::status_e RestImportHandler::execute () { /// @brief log an error document //////////////////////////////////////////////////////////////////////////////// -void RestImportHandler::logDocument (const TRI_json_t* const json) const { +void RestImportHandler::logDocument (TRI_json_t const* json) const { TRI_string_buffer_t buffer; TRI_InitStringBuffer(&buffer, TRI_UNKNOWN_MEM_ZONE); int res = TRI_StringifyJson(&buffer, json); + if (res == TRI_ERROR_NO_ERROR) { LOGGER_WARNING("offending document: " << buffer._buffer); } @@ -180,372 +180,90 @@ void RestImportHandler::logDocument (const TRI_json_t* const json) const { } //////////////////////////////////////////////////////////////////////////////// -/// @brief creates documents -/// -/// @REST{POST /_api/import?type=documents&collection=`collection-name`} -/// -/// Creates documents in the collection identified by `collection-name`. -/// The JSON representations of the documents must be passed as the body of the -/// POST request. -/// -/// If the documents were created successfully, then a `HTTP 201` is returned. +/// @brief process a single JSON document //////////////////////////////////////////////////////////////////////////////// -bool RestImportHandler::createByDocumentsLines () { - size_t numCreated = 0; - size_t numError = 0; - size_t numEmpty = 0; +bool RestImportHandler::handleSingleDocument (ImportTransactionType& trx, + TRI_json_t const* json, + const bool isEdgeCollection, + const bool waitForSync, + const size_t i) { + if (json == 0 || json->_type != TRI_JSON_ARRAY) { + LOGGER_WARNING("invalid JSON type (expecting array) at position " << i); - vector const& suffix = _request->suffix(); - - if (suffix.size() != 0) { - generateError(HttpResponse::BAD, - TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES, - "superfluous suffix, expecting " + DOCUMENT_IMPORT_PATH + "?type=documents&collection="); return false; } - const bool waitForSync = extractWaitForSync(); + // document ok, now import it + TRI_doc_mptr_t document; + int res = TRI_ERROR_NO_ERROR; - // extract the collection name - bool found; - const string& collection = _request->value("collection", found); + if (isEdgeCollection) { + const char* from = extractJsonStringValue(json, TRI_VOC_ATTRIBUTE_FROM); + const char* to = extractJsonStringValue(json, TRI_VOC_ATTRIBUTE_TO); - if (! found || collection.empty()) { - generateError(HttpResponse::BAD, - TRI_ERROR_ARANGO_COLLECTION_PARAMETER_MISSING, - "'collection' is missing, expecting " + DOCUMENT_IMPORT_PATH + "?collection="); - return false; - } + if (from == 0 || to == 0) { + LOGGER_WARNING("missing '_from' or '_to' attribute at position " << i); - if (! checkCreateCollection(collection, TRI_COL_TYPE_DOCUMENT)) { - return false; - } + return false; + } - // find and load collection given by name or identifier - SingleCollectionWriteTransaction, UINT64_MAX> trx(_vocbase, _resolver, collection); + TRI_document_edge_t edge; - // ............................................................................. - // inside write transaction - // ............................................................................. + edge._fromCid = 0; + edge._toCid = 0; + edge._fromKey = 0; + edge._toKey = 0; - int res = trx.begin(); - if (res != TRI_ERROR_NO_ERROR) { - generateTransactionError(collection, res); - return false; - } + int res1 = parseDocumentId(from, edge._fromCid, edge._fromKey); + int res2 = parseDocumentId(to, edge._toCid, edge._toKey); - TRI_primary_collection_t* primary = trx.primaryCollection(); - const TRI_voc_cid_t cid = trx.cid(); - const bool isEdgeCollection = (primary->base._info._type == TRI_COL_TYPE_EDGE); - - trx.lockWrite(); - - const char* ptr = _request->body(); - const char* end = ptr + _request->bodySize(); - string line; - size_t i = 0; - - while (ptr < end) { - i++; - const char* pos = strchr(ptr, '\n'); - - if (pos == 0) { - line.assign(ptr, (size_t) (end - ptr)); - ptr = end; + if (res1 == TRI_ERROR_NO_ERROR && res2 == TRI_ERROR_NO_ERROR) { + res = trx.createEdge(&document, json, waitForSync, &edge); } else { - line.assign(ptr, (size_t) (pos - ptr)); - ptr = pos + 1; + res = (res1 != TRI_ERROR_NO_ERROR ? res1 : res2); } - StringUtils::trimInPlace(line, "\r\n\t "); - if (line.length() == 0) { - ++numEmpty; - continue; + if (edge._fromKey != 0) { + TRI_Free(TRI_CORE_MEM_ZONE, edge._fromKey); } - - TRI_json_t* values = parseJsonLine(line); - - if (values == 0 || values->_type != TRI_JSON_ARRAY) { - LOGGER_WARNING("invalid JSON type (expecting array) at position " << i); - ++numError; + if (edge._toKey != 0) { + TRI_Free(TRI_CORE_MEM_ZONE, edge._toKey); } - else { - // now save the document - TRI_doc_mptr_t document; - - if (isEdgeCollection) { - const char* from = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_FROM); - - if (from == 0) { - LOGGER_WARNING("missing '_from' attribute at position " << i); - TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values); - ++numError; - continue; - } - - const char* to = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_TO); - if (to == 0) { - LOGGER_WARNING("missing '_to' attribute at position " << i); - TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values); - ++numError; - continue; - } - - TRI_document_edge_t edge; - - edge._fromCid = cid; - edge._toCid = cid; - edge._fromKey = 0; - edge._toKey = 0; - - int res1 = parseDocumentId(from, edge._fromCid, edge._fromKey); - int res2 = parseDocumentId(to, edge._toCid, edge._toKey); - - if (res1 == TRI_ERROR_NO_ERROR && res2 == TRI_ERROR_NO_ERROR) { - res = trx.createEdge(&document, values, waitForSync, &edge); - } - else { - res = (res1 != TRI_ERROR_NO_ERROR ? res1 : res2); - } - - if (edge._fromKey != 0) { - TRI_Free(TRI_CORE_MEM_ZONE, edge._fromKey); - } - if (edge._toKey != 0) { - TRI_Free(TRI_CORE_MEM_ZONE, edge._toKey); - } - } - else { - // do not acquire an extra lock - res = trx.createDocument(&document, values, waitForSync); - } - - - if (res == TRI_ERROR_NO_ERROR) { - ++numCreated; - } - else { - LOGGER_WARNING("creating document failed with error: " << TRI_errno_string(res)); - logDocument(values); - ++numError; - } - - TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values); - } - } - - // this will commit, even if previous errors occurred - res = trx.commit(); - - // ............................................................................. - // outside write transaction - // ............................................................................. - - if (res != TRI_ERROR_NO_ERROR) { - generateTransactionError(collection, res); } else { - // generate result - generateDocumentsCreated(numCreated, numError, numEmpty); + // do not acquire an extra lock + res = trx.createDocument(&document, json, waitForSync); } - return true; + if (res == TRI_ERROR_NO_ERROR) { + return true; + } + + LOGGER_WARNING("creating document failed with error: " << TRI_errno_string(res)); + logDocument(json); + + return false; } //////////////////////////////////////////////////////////////////////////////// -/// @brief creates documents +/// @brief creates documents from JSON /// -/// @REST{POST /_api/import?type=array&collection=`collection-name`} +/// @REST{POST /_api/import?type=auto&collection=`collection-name`} /// /// Creates documents in the collection identified by `collection-name`. /// The JSON representations of the documents must be passed as the body of the -/// POST request. +/// POST request. The request body can either consist of multiple lines, with +/// each line being a single stand-alone JSON document, or a JSON list. /// /// If the documents were created successfully, then a `HTTP 201` is returned. //////////////////////////////////////////////////////////////////////////////// -bool RestImportHandler::createByDocumentsList () { +bool RestImportHandler::createFromJson (const string& type) { size_t numCreated = 0; - size_t numError = 0; - - vector const& suffix = _request->suffix(); - - if (suffix.size() != 0) { - generateError(HttpResponse::BAD, - TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES, - "superfluous suffix, expecting " + DOCUMENT_IMPORT_PATH + "?type=array&collection="); - return false; - } - - const bool waitForSync = extractWaitForSync(); - - // extract the collection name - bool found; - const string& collection = _request->value("collection", found); - - if (! found || collection.empty()) { - generateError(HttpResponse::BAD, - TRI_ERROR_ARANGO_COLLECTION_PARAMETER_MISSING, - "'collection' is missing, expecting " + DOCUMENT_IMPORT_PATH + "?collection="); - return false; - } - - ResourceHolder holder; - - char* errmsg = 0; - TRI_json_t* documents = TRI_Json2String(TRI_UNKNOWN_MEM_ZONE, _request->body(), &errmsg); - - if (! holder.registerJson(TRI_UNKNOWN_MEM_ZONE, documents)) { - if (errmsg == 0) { - generateError(HttpResponse::BAD, - TRI_ERROR_HTTP_CORRUPTED_JSON, - "cannot parse json object"); - } - else { - generateError(HttpResponse::BAD, - TRI_ERROR_HTTP_CORRUPTED_JSON, - errmsg); - - TRI_FreeString(TRI_CORE_MEM_ZONE, errmsg); - } - return false; - } - - if (documents->_type != TRI_JSON_LIST) { - generateError(HttpResponse::BAD, - TRI_ERROR_HTTP_BAD_PARAMETER, - "expecting a JSON list in the request"); - return false; - } - - if (! checkCreateCollection(collection, TRI_COL_TYPE_DOCUMENT)) { - return false; - } - - // find and load collection given by name or identifier - SingleCollectionWriteTransaction, UINT64_MAX> trx(_vocbase, _resolver, collection); - - // ............................................................................. - // inside write transaction - // ............................................................................. - - int res = trx.begin(); - if (res != TRI_ERROR_NO_ERROR) { - generateTransactionError(collection, res); - return false; - } - - TRI_primary_collection_t* primary = trx.primaryCollection(); - const TRI_voc_cid_t cid = trx.cid(); - const bool isEdgeCollection = (primary->base._info._type == TRI_COL_TYPE_EDGE); - - trx.lockWrite(); - - for (size_t i = 0; i < documents->_value._objects._length; ++i) { - TRI_json_t* values = (TRI_json_t*) TRI_AtVector(&documents->_value._objects, i); - - if (values == 0 || values->_type != TRI_JSON_ARRAY) { - LOGGER_WARNING("invalid JSON type (expecting array) at position " << (i + 1)); - ++numError; - } - else { - // now save the document - TRI_doc_mptr_t document; - - if (isEdgeCollection) { - const char* from = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_FROM); - - if (from == 0) { - LOGGER_WARNING("missing '_from' attribute at position " << (i + 1)); - ++numError; - continue; - } - - const char* to = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_TO); - if (to == 0) { - LOGGER_WARNING("missing '_to' attribute at position " << (i + 1)); - ++numError; - continue; - } - - TRI_document_edge_t edge; - - edge._fromCid = cid; - edge._toCid = cid; - edge._fromKey = 0; - edge._toKey = 0; - - int res1 = parseDocumentId(from, edge._fromCid, edge._fromKey); - int res2 = parseDocumentId(to, edge._toCid, edge._toKey); - - if (res1 == TRI_ERROR_NO_ERROR && res2 == TRI_ERROR_NO_ERROR) { - res = trx.createEdge(&document, values, waitForSync, &edge); - } - else { - res = (res1 != TRI_ERROR_NO_ERROR ? res1 : res2); - } - - if (edge._fromKey != 0) { - TRI_Free(TRI_CORE_MEM_ZONE, edge._fromKey); - } - if (edge._toKey != 0) { - TRI_Free(TRI_CORE_MEM_ZONE, edge._toKey); - } - } - else { - // do not acquire an extra lock - res = trx.createDocument(&document, values, waitForSync); - } - - - if (res == TRI_ERROR_NO_ERROR) { - ++numCreated; - } - else { - LOGGER_WARNING("creating document failed with error: " << TRI_errno_string(res)); - logDocument(values); - ++numError; - } - } - } - - // this will commit, even if previous errors occurred - res = trx.commit(); - - // ............................................................................. - // outside write transaction - // ............................................................................. - - if (res != TRI_ERROR_NO_ERROR) { - generateTransactionError(collection, res); - } - else { - // generate result - size_t numEmpty = 0; - generateDocumentsCreated(numCreated, numError, numEmpty); - } - - return true; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief creates documents -/// -/// @REST{POST /_api/import?collection=`collection-name`} -/// -/// Creates documents in the collection identified by `collection-name`. -/// The JSON representations of the documents must be passed as the body of the -/// POST request. -/// -/// If the documents were created successfully, then a `HTTP 201` is returned. -//////////////////////////////////////////////////////////////////////////////// - -bool RestImportHandler::createByKeyValueList () { - size_t numCreated = 0; - size_t numError = 0; - size_t numEmpty = 0; + size_t numError = 0; + size_t numEmpty = 0; vector const& suffix = _request->suffix(); @@ -569,14 +287,227 @@ bool RestImportHandler::createByKeyValueList () { return false; } + if (! checkCreateCollection(collection, TRI_COL_TYPE_DOCUMENT)) { + return false; + } + + bool linewise; + + if (type == "documents") { + // linewise import + linewise = true; + } + else if (type == "array" || type == "list") { + // non-linewise import + linewise = false; + } + else if (type == "auto") { + linewise = true; + + // auto detect import type by peeking at first character + const char* ptr = _request->body(); + const char* end = ptr + _request->bodySize(); + + while (ptr < end) { + const char c = *ptr; + if (c == '\r' || c == '\n' || c == '\t' || c == ' ') { + ptr++; + continue; + } + else if (c == '[') { + linewise = false; + } + + break; + } + } + else { + generateError(HttpResponse::BAD, + TRI_ERROR_BAD_PARAMETER, + "invalid value for 'type'"); + return false; + } + + + // find and load collection given by name or identifier + ImportTransactionType trx(_vocbase, _resolver, collection); + + // ............................................................................. + // inside write transaction + // ............................................................................. + + int res = trx.begin(); + + if (res != TRI_ERROR_NO_ERROR) { + generateTransactionError(collection, res); + return false; + } + + TRI_primary_collection_t* primary = trx.primaryCollection(); + const bool isEdgeCollection = (primary->base._info._type == TRI_COL_TYPE_EDGE); + + trx.lockWrite(); + + if (linewise) { + // each line is a separate JSON document + const char* ptr = _request->body(); + const char* end = ptr + _request->bodySize(); + string line; + size_t i = 0; + + while (ptr < end) { + // read line until done + i++; + const char* pos = strchr(ptr, '\n'); + + if (pos == 0) { + line.assign(ptr, (size_t) (end - ptr)); + ptr = end; + } + else { + line.assign(ptr, (size_t) (pos - ptr)); + ptr = pos + 1; + } + + StringUtils::trimInPlace(line, "\r\n\t "); + if (line.length() == 0) { + ++numEmpty; + continue; + } + + TRI_json_t* json = parseJsonLine(line); + + bool success = handleSingleDocument(trx, json, isEdgeCollection, waitForSync, i); + + if (success) { + ++numCreated; + } + else { + ++numError; + } + + if (json != 0) { + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); + } + } + } + + else { + // the entire request body is one JSON document + char* errmsg = 0; + TRI_json_t* documents = TRI_Json2String(TRI_UNKNOWN_MEM_ZONE, _request->body(), &errmsg); + + if (documents == 0) { + if (errmsg == 0) { + generateError(HttpResponse::BAD, TRI_ERROR_HTTP_CORRUPTED_JSON); + } + else { + generateError(HttpResponse::BAD, + TRI_ERROR_HTTP_CORRUPTED_JSON, + errmsg); + + TRI_FreeString(TRI_CORE_MEM_ZONE, errmsg); + } + + return false; + } + + if (documents->_type != TRI_JSON_LIST) { + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, documents); + + generateError(HttpResponse::BAD, + TRI_ERROR_HTTP_BAD_PARAMETER, + "expecting a JSON list in the request"); + return false; + } + + const size_t n = documents->_value._objects._length; + + for (size_t i = 0; i < n; ++i) { + TRI_json_t const* json = (TRI_json_t const*) TRI_AtVector(&documents->_value._objects, i); + + bool success = handleSingleDocument(trx, json, isEdgeCollection, waitForSync, i + 1); + + if (success) { + ++numCreated; + } + else { + ++numError; + } + } + + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, documents); + } + + + // this will commit, even if previous errors occurred + res = trx.commit(); + + // ............................................................................. + // outside write transaction + // ............................................................................. + + if (res != TRI_ERROR_NO_ERROR) { + generateTransactionError(collection, res); + } + else { + // generate result + generateDocumentsCreated(numCreated, numError, numEmpty); + } + + return true; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief creates documents +/// +/// @REST{POST /_api/import?collection=`collection-name`} +/// +/// Creates documents in the collection identified by `collection-name`. +/// The JSON representations of the documents must be passed as the body of the +/// POST request. +/// +/// If the documents were created successfully, then a `HTTP 201` is returned. +//////////////////////////////////////////////////////////////////////////////// + +bool RestImportHandler::createFromKeyValueList () { + size_t numCreated = 0; + size_t numError = 0; + size_t numEmpty = 0; + + vector const& suffix = _request->suffix(); + + if (suffix.size() != 0) { + generateError(HttpResponse::BAD, + TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES, + "superfluous suffix, expecting " + DOCUMENT_IMPORT_PATH + "?collection="); + return false; + } + + const bool waitForSync = extractWaitForSync(); + + // extract the collection name + bool found; + const string& collection = _request->value("collection", found); + + if (! found || collection.empty()) { + generateError(HttpResponse::BAD, + TRI_ERROR_ARANGO_COLLECTION_PARAMETER_MISSING, + "'collection' is missing, expecting " + DOCUMENT_IMPORT_PATH + "?collection="); + return false; + } + + if (! checkCreateCollection(collection, TRI_COL_TYPE_DOCUMENT)) { + return false; + } + // read line number (optional) - const string& lineNumValue = _request->value("line", found); int64_t lineNumber = 0; + const string& lineNumValue = _request->value("line", found); if (found) { lineNumber = StringUtils::int64(lineNumValue); } - size_t start = 0; string body(_request->body(), _request->bodySize()); size_t next = body.find('\n', start); @@ -588,69 +519,57 @@ bool RestImportHandler::createByKeyValueList () { return false; } - ResourceHolder holder; - TRI_json_t* keys = 0; - string line = body.substr(start, next); StringUtils::trimInPlace(line, "\r\n\t "); // get first line + TRI_json_t* keys = 0; + if (line != "") { keys = parseJsonLine(line); - if (! holder.registerJson(TRI_UNKNOWN_MEM_ZONE, keys)) { - LOGGER_WARNING("no JSON data in first line"); - generateError(HttpResponse::BAD, - TRI_ERROR_HTTP_BAD_PARAMETER, - "no JSON string list in first line found"); - return false; + } + + if (keys == 0 || keys->_type != TRI_JSON_LIST) { + if (keys != 0) { + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, keys); } - if (keys->_type == TRI_JSON_LIST) { - if (! checkKeys(keys)) { - LOGGER_WARNING("no JSON string list in first line found"); - generateError(HttpResponse::BAD, - TRI_ERROR_HTTP_BAD_PARAMETER, - "no JSON string list in first line found"); - return false; - } - start = next + 1; - } - else { - LOGGER_WARNING("no JSON string list in first line found"); - generateError(HttpResponse::BAD, - TRI_ERROR_HTTP_BAD_PARAMETER, - "no JSON string list in first line found"); - return false; - } + LOGGER_WARNING("no JSON string list found first line"); + generateError(HttpResponse::BAD, + TRI_ERROR_HTTP_BAD_PARAMETER, + "no JSON string list found in first line"); + return false; } - else { + + if (! checkKeys(keys)) { LOGGER_WARNING("no JSON string list in first line found"); generateError(HttpResponse::BAD, TRI_ERROR_HTTP_BAD_PARAMETER, "no JSON string list in first line found"); - return false; - } - if (! checkCreateCollection(collection, TRI_COL_TYPE_DOCUMENT)) { + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, keys); return false; } + + start = next + 1; // find and load collection given by name or identifier - SingleCollectionWriteTransaction, UINT64_MAX> trx(_vocbase, _resolver, collection); + ImportTransactionType trx(_vocbase, _resolver, collection); // ............................................................................. // inside write transaction // ............................................................................. int res = trx.begin(); + if (res != TRI_ERROR_NO_ERROR) { + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, keys); generateTransactionError(collection, res); return false; } TRI_primary_collection_t* primary = trx.primaryCollection(); - const TRI_voc_cid_t cid = trx.cid(); const bool isEdgeCollection = (primary->base._info._type == TRI_COL_TYPE_EDGE); trx.lockWrite(); @@ -659,8 +578,10 @@ bool RestImportHandler::createByKeyValueList () { // inside write transaction // ............................................................................. + size_t i = (size_t) lineNumber; + while (next != string::npos && start < body.length()) { - lineNumber++; + i++; next = body.find('\n', start); @@ -679,91 +600,35 @@ bool RestImportHandler::createByKeyValueList () { } TRI_json_t* values = parseJsonLine(line); - - if (values) { - // got a json document or list - TRI_json_t* json; - + + if (values != 0) { // build the json object from the list - json = createJsonObject(keys, values, line); + TRI_json_t* json = createJsonObject(keys, values, line); TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values); - - if (json == 0) { - ++numError; - continue; + + bool success = handleSingleDocument(trx, json, isEdgeCollection, waitForSync, i); + + if (json != 0) { + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); } - - // now save the document - TRI_doc_mptr_t document; - - if (isEdgeCollection) { - const char* from = extractJsonStringValue(json, TRI_VOC_ATTRIBUTE_FROM); - - if (from == 0) { - LOGGER_WARNING("missing '_from' attribute at line " << lineNumber); - TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); - ++numError; - continue; - } - - const char* to = extractJsonStringValue(json, TRI_VOC_ATTRIBUTE_TO); - if (to == 0) { - LOGGER_WARNING("missing '_to' attribute at line " << lineNumber); - TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); - ++numError; - continue; - } - - TRI_document_edge_t edge; - - edge._fromCid = cid; - edge._toCid = cid; - edge._fromKey = 0; - edge._toKey = 0; - - int res1 = parseDocumentId(from, edge._fromCid, edge._fromKey); - int res2 = parseDocumentId(to, edge._toCid, edge._toKey); - - if (res1 == TRI_ERROR_NO_ERROR && res2 == TRI_ERROR_NO_ERROR) { - res = trx.createEdge(&document, json, waitForSync, &edge); - } - else { - res = (res1 != TRI_ERROR_NO_ERROR ? res1 : res2); - } - - if (edge._fromKey != 0) { - TRI_Free(TRI_CORE_MEM_ZONE, edge._fromKey); - } - if (edge._toKey != 0) { - TRI_Free(TRI_CORE_MEM_ZONE, edge._toKey); - } - } - else { - // do not acquire an extra lock - res = trx.createDocument(&document, json, waitForSync); - } - - - if (res == TRI_ERROR_NO_ERROR) { + + if (success) { ++numCreated; } else { - LOGGER_WARNING("creating document failed with error: " << TRI_errno_string(res)); - logDocument(json); ++numError; } - - TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); } else { LOGGER_WARNING("no valid JSON data in line: " << line); ++numError; } - } // we'll always commit, even if previous errors occurred res = trx.commit(); + + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, keys); // ............................................................................. // outside write transaction diff --git a/arangod/RestHandler/RestImportHandler.h b/arangod/RestHandler/RestImportHandler.h index dbece94f34..29968ace19 100644 --- a/arangod/RestHandler/RestImportHandler.h +++ b/arangod/RestHandler/RestImportHandler.h @@ -30,6 +30,25 @@ #include "RestHandler/RestVocbaseBaseHandler.h" +// ----------------------------------------------------------------------------- +// --SECTION-- private defines +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup ArangoDB +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief import transaction shortcut +//////////////////////////////////////////////////////////////////////////////// + +#define ImportTransactionType SingleCollectionWriteTransaction, UINT64_MAX> + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + // ----------------------------------------------------------------------------- // --SECTION-- RestImportHandler // ----------------------------------------------------------------------------- @@ -121,14 +140,24 @@ namespace triagens { /// @brief log an error document //////////////////////////////////////////////////////////////////////////////// - void logDocument (const TRI_json_t* const) const; + void logDocument (TRI_json_t const*) const; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief process a single JSON document +//////////////////////////////////////////////////////////////////////////////// + + bool handleSingleDocument (ImportTransactionType&, + TRI_json_t const*, + const bool, + const bool, + const size_t); //////////////////////////////////////////////////////////////////////////////// /// @brief creates documents by JSON objects /// each line of the input stream contains an individual JSON object //////////////////////////////////////////////////////////////////////////////// - bool createByDocumentsLines (); + bool createFromJson (const string&); //////////////////////////////////////////////////////////////////////////////// /// @brief creates documents by JSON objects @@ -138,10 +167,10 @@ namespace triagens { bool createByDocumentsList (); //////////////////////////////////////////////////////////////////////////////// -/// @brief creates a documents by JSON arrays +/// @brief creates a documents from key/value lists //////////////////////////////////////////////////////////////////////////////// - bool createByKeyValueList (); + bool createFromKeyValueList (); //////////////////////////////////////////////////////////////////////////////// /// @brief creates the result diff --git a/arangod/RestHandler/RestReplicationHandler.cpp b/arangod/RestHandler/RestReplicationHandler.cpp index 7361625d5a..6a2e0311a5 100644 --- a/arangod/RestHandler/RestReplicationHandler.cpp +++ b/arangod/RestHandler/RestReplicationHandler.cpp @@ -1037,6 +1037,9 @@ void RestReplicationHandler::handleCommandInventory () { /// @RESTRETURNCODE{404} /// is returned when the collection could not be found. /// +/// @RESTRETURNCODE{405} +/// is returned when an invalid HTTP method is used. +/// /// @RESTRETURNCODE{500} /// is returned if an error occurred while assembling the response. /// @@ -1187,7 +1190,52 @@ void RestReplicationHandler::handleCommandDump () { } //////////////////////////////////////////////////////////////////////////////// -/// @brief return the configuration of the replication applier +/// @brief get the configuration of the replication applier +/// +/// @RESTHEADER{GET /_api/replication/applier-config,returns the configuration of the replication applier} +/// +/// @RESTDESCRIPTION +/// Returns the configuration of the replication applier. +/// +/// The body of the response is a JSON hash with the configuration. The +/// following attributes may be present in the configuration: +/// +/// - `endpoint`: the logger server to connect to (e.g. "tcp://192.168.173.13:8529"). +/// +/// - `username`: an optional ArangoDB username to use when connecting to the endpoint. +/// +/// - `password`: the password to use when connecting to the endpoint. +/// +/// - `connectTimeout`: the timeout (in seconds) when connecting to the endpoint. +/// +/// - `requestTimeout`: the timeout (in seconds) for individual requests to the endpoint. +/// +/// - `autoStart`: whether or not to auto-start the replication applier on +/// (next and following) server starts +/// +/// - `adaptivePolling`: whether or not the replication applier will use +/// adaptive polling. +/// +/// @RESTRETURNCODES +/// +/// @RESTRETURNCODE{200} +/// is returned if the request was executed successfully. +/// +/// @RESTRETURNCODE{405} +/// is returned when an invalid HTTP method is used. +/// +/// @RESTRETURNCODE{500} +/// is returned if an error occurred while assembling the response. +/// +/// @EXAMPLES +/// +/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierGetConfig} +/// var url = "/_api/replication/applier-config"; +/// var response = logCurlRequest('GET', url); +/// +/// assert(response.code === 200); +/// logJsonResponse(response); +/// @END_EXAMPLE_ARANGOSH_RUN //////////////////////////////////////////////////////////////////////////////// void RestReplicationHandler::handleCommandApplierGetConfig () { @@ -1213,7 +1261,87 @@ void RestReplicationHandler::handleCommandApplierGetConfig () { } //////////////////////////////////////////////////////////////////////////////// -/// @brief configure the replication applier +/// @brief set the configuration of the replication applier +/// +/// @RESTHEADER{PUT /_api/replication/applier-config,adjusts the configuration of the replication applier} +/// +/// @RESTBODYPARAM{configuration,json,required} +/// A JSON representation of the configuration. +/// +/// @RESTDESCRIPTION +/// Sets the configuration of the replication applier. The configuration can +/// only be changed while the applier is not running. The updated configuration +/// will be saved immediately but only become active with the next start of the +/// applier. +/// +/// The body of the request must be JSON hash with the configuration. The +/// following attributes are allowed for the configuration: +/// +/// - `endpoint`: the logger server to connect to (e.g. "tcp://192.168.173.13:8529"). +/// The endpoint must be specified. +/// +/// - `username`: an optional ArangoDB username to use when connecting to the endpoint. +/// +/// - `password`: the password to use when connecting to the endpoint. +/// +/// - `connectTimeout`: the timeout (in seconds) when connecting to the endpoint. +/// +/// - `requestTimeout`: the timeout (in seconds) for individual requests to the endpoint. +/// +/// - `autoStart`: whether or not to auto-start the replication applier on +/// (next and following) server starts +/// +/// - `adaptivePolling`: if set to `true`, the replication applier will fall +/// to sleep for an increasingly long period in case the logger server at the +/// endpoint does not have any more replication events to apply. Using +/// adaptive polling is thus useful to reduce the amount of work for both the +/// applier and the logger server for cases when there are only infrequent +/// changes. The downside is that when using adaptive polling, it might take +/// longer for the replication applier to detect that there are new replication +/// events on the logger server. +/// +/// Setting `adaptivePolling` to false will make the replication applier +/// contact the logger server in a constant interval, regardless of whether +/// the logger server provides updates frequently or seldomly. +/// +/// In case of success, the body of the response is a JSON hash with the updated +/// configuration. +/// +/// @RESTRETURNCODES +/// +/// @RESTRETURNCODE{200} +/// is returned if the request was executed successfully. +/// +/// @RESTRETURNCODE{400} +/// is returned if the configuration is incomplete or malformed, or if the +/// replication applier is currently running. +/// +/// @RESTRETURNCODE{405} +/// is returned when an invalid HTTP method is used. +/// +/// @RESTRETURNCODE{500} +/// is returned if an error occurred while assembling the response. +/// +/// @EXAMPLES +/// +/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierSetConfig} +/// var re = require("org/arangodb/replication"); +/// re.applier.stop(); +/// +/// var url = "/_api/replication/applier-config"; +/// var body = { +/// endpoint: "tcp://127.0.0.1:8529", +/// username: "replicationApplier", +/// password: "applier1234@foxx", +/// autoStart: false, +/// adaptivePolling: true +/// }; +/// +/// var response = logCurlRequest('PUT', url, JSON.stringify(body)); +/// +/// assert(response.code === 200); +/// logJsonResponse(response); +/// @END_EXAMPLE_ARANGOSH_RUN //////////////////////////////////////////////////////////////////////////////// void RestReplicationHandler::handleCommandApplierSetConfig () { @@ -1229,9 +1357,21 @@ void RestReplicationHandler::handleCommandApplierSetConfig () { return; } + TRI_json_t const* value; const string endpoint = JsonHelper::getStringValue(json, "endpoint", ""); - config._endpoint = TRI_DuplicateString2Z(TRI_CORE_MEM_ZONE, endpoint.c_str(), endpoint.size()); + config._endpoint = TRI_DuplicateString2Z(TRI_CORE_MEM_ZONE, endpoint.c_str(), endpoint.size()); + + value = JsonHelper::getArrayElement(json, "username"); + if (JsonHelper::isString(value)) { + config._username = TRI_DuplicateString2Z(TRI_CORE_MEM_ZONE, value->_value._string.data, value->_value._string.length - 1); + } + + value = JsonHelper::getArrayElement(json, "password"); + if (JsonHelper::isString(value)) { + config._password = TRI_DuplicateString2Z(TRI_CORE_MEM_ZONE, value->_value._string.data, value->_value._string.length - 1); + } + config._requestTimeout = JsonHelper::getDoubleValue(json, "requestTimeout", config._requestTimeout); config._connectTimeout = JsonHelper::getDoubleValue(json, "connectTimeout", config._connectTimeout); config._ignoreErrors = JsonHelper::getUInt64Value(json, "ignoreErrors", config._ignoreErrors); @@ -1246,15 +1386,72 @@ void RestReplicationHandler::handleCommandApplierSetConfig () { TRI_DestroyConfigurationReplicationApplier(&config); if (res != TRI_ERROR_NO_ERROR) { - generateError(HttpResponse::SERVER_ERROR, res); + if (res == TRI_ERROR_REPLICATION_INVALID_CONFIGURATION || + res == TRI_ERROR_REPLICATION_RUNNING) { + generateError(HttpResponse::BAD, res); + } + else { + generateError(HttpResponse::SERVER_ERROR, res); + } return; } - - handleCommandApplierGetState(); + + handleCommandApplierGetConfig(); } //////////////////////////////////////////////////////////////////////////////// /// @brief start the replication applier +/// +/// @RESTHEADER{PUT /_api/replication/applier-start,starts the replication applier} +/// +/// @RESTDESCRIPTION +/// Starts the replication applier. This will return immediately if the +/// replication applier is already running. +/// +/// If the replication applier is not already running, the applier configuration +/// will be checked, and if it is complete, the applier will be started in a +/// background thread. This means that even if the applier will encounter any +/// errors while running, they will not be reported in the response to this +/// method. +/// +/// To detect replication applier errors after the applier was started, use the +/// `/_api/replication/applier-state` API instead. +/// +/// @RESTRETURNCODES +/// +/// @RESTRETURNCODE{200} +/// is returned if the request was executed successfully. +/// +/// @RESTRETURNCODE{400} +/// is returned if the replication applier is not fully configured or the +/// configuration is invalid. +/// +/// @RESTRETURNCODE{405} +/// is returned when an invalid HTTP method is used. +/// +/// @RESTRETURNCODE{500} +/// is returned if an error occurred while assembling the response. +/// +/// @EXAMPLES +/// +/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierStart} +/// var re = require("org/arangodb/replication"); +/// re.applier.stop(); +/// re.applier.properties({ +/// endpoint: "tcp://127.0.0.1:8529", +/// username: "replicationApplier", +/// password: "applier1234@foxx", +/// autoStart: false, +/// adaptivePolling: true +/// }); +/// +/// var url = "/_api/replication/applier-start"; +/// var response = logCurlRequest('PUT', url, ""); +/// re.applier.stop(); +/// +/// assert(response.code === 200); +/// logJsonResponse(response); +/// @END_EXAMPLE_ARANGOSH_RUN //////////////////////////////////////////////////////////////////////////////// void RestReplicationHandler::handleCommandApplierStart () { @@ -1274,7 +1471,13 @@ void RestReplicationHandler::handleCommandApplierStart () { int res = TRI_StartReplicationApplier(_vocbase->_replicationApplier, fullSync); if (res != TRI_ERROR_NO_ERROR) { - generateError(HttpResponse::SERVER_ERROR, res); + if (res == TRI_ERROR_REPLICATION_INVALID_CONFIGURATION || + res == TRI_ERROR_REPLICATION_RUNNING) { + generateError(HttpResponse::BAD, res); + } + else { + generateError(HttpResponse::SERVER_ERROR, res); + } return; } @@ -1282,7 +1485,46 @@ void RestReplicationHandler::handleCommandApplierStart () { } //////////////////////////////////////////////////////////////////////////////// -/// @brief stop the replication applier +/// @brief stops the replication applier +/// +/// @RESTHEADER{PUT /_api/replication/applier-stop,stops the replication applier} +/// +/// @RESTDESCRIPTION +/// Stops the replication applier. This will return immediately if the +/// replication applier is not running. +/// +/// @RESTRETURNCODES +/// +/// @RESTRETURNCODE{200} +/// is returned if the request was executed successfully. +/// +/// @RESTRETURNCODE{405} +/// is returned when an invalid HTTP method is used. +/// +/// @RESTRETURNCODE{500} +/// is returned if an error occurred while assembling the response. +/// +/// @EXAMPLES +/// +/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierStop} +/// var re = require("org/arangodb/replication"); +/// re.applier.stop(); +/// re.applier.properties({ +/// endpoint: "tcp://127.0.0.1:8529", +/// username: "replicationApplier", +/// password: "applier1234@foxx", +/// autoStart: false, +/// adaptivePolling: true +/// }); +/// +/// re.applier.start(); +/// var url = "/_api/replication/applier-stop"; +/// var response = logCurlRequest('PUT', url, ""); +/// re.applier.stop(); +/// +/// assert(response.code === 200); +/// logJsonResponse(response); +/// @END_EXAMPLE_ARANGOSH_RUN //////////////////////////////////////////////////////////////////////////////// void RestReplicationHandler::handleCommandApplierStop () { @@ -1299,7 +1541,105 @@ void RestReplicationHandler::handleCommandApplierStop () { } //////////////////////////////////////////////////////////////////////////////// -/// @brief return the state of the replication applier +/// @brief returns the state of the replication applier +/// +/// @RESTHEADER{GET /_api/replication/applier-state,returns the state of the replication applier} +/// +/// @RESTDESCRIPTION +/// Returns the state of the replication applier, regardless of whether the +/// applier is currently running or not. +/// +/// The response is a JSON hash with the following attributes: +/// +/// - `state`: a JSON hash with the following sub-attributes: +/// +/// - `running`: whether or not the applier is active and running +/// +/// - `lastAppliedContinuousTick`: the last tick value from the continuous +/// replication log the applier has applied. +/// +/// - `lastProcessedContinuousTick`: the last tick value from the continuous +/// replication log the applier has processed. +/// +/// Regularly, the last applied and last processed tick values should be +/// identical. For transactional operations, the replication applier will first +/// process incoming log events before applying them, so the processed tick +/// value might be higher than the applied tick value. This will be the case +/// until the applier encounters the `transaction commit` log event for the +/// transaction. +/// +/// - `lastAvailableContinuousTick`: the last tick value the logger server can +/// provide. +/// +/// - `time`: the time on the applier server. +/// +/// - `progress`: a JSON hash with details about the replication applier progress. +/// It contains the following sub-attributes if there is progress to report: +/// +/// - `message`: a textual description of the progress +/// +/// - `time`: the date and time the progress was logged +/// +/// - `lastError`: a JSON hash with details about the last error that happened on +/// the applier. It contains the following sub-attributes if there was an error: +/// +/// - `errorNum`: a numerical error code +/// +/// - `errorMessage`: a textual error description +/// +/// - `time`: the date and time the error occurred +/// +/// In case no error has occurred, `lastError` will be empty. +/// +/// - `server`: a JSON hash with the following sub-attributes: +/// +/// - `version`: the applier server's version +/// +/// - `serverId`: the applier server's id +/// +/// - `endpoint`: the endpoint the applier is connected to (if applier is +/// active) or will connect to (if applier is currently inactive) +/// +/// @RESTRETURNCODES +/// +/// @RESTRETURNCODE{200} +/// is returned if the request was executed successfully. +/// +/// @RESTRETURNCODE{405} +/// is returned when an invalid HTTP method is used. +/// +/// @RESTRETURNCODE{500} +/// is returned if an error occurred while assembling the response. +/// +/// @EXAMPLES +/// +/// Fetching the state of an inactive applier: +/// +/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierStateNotRunning} +/// var re = require("org/arangodb/replication"); +/// re.applier.stop(); +/// +/// var url = "/_api/replication/applier-state"; +/// var response = logCurlRequest('GET', url); +/// +/// assert(response.code === 200); +/// logJsonResponse(response); +/// @END_EXAMPLE_ARANGOSH_RUN +/// +/// Fetching the state of an active applier: +/// +/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierStateRunning} +/// var re = require("org/arangodb/replication"); +/// re.applier.stop(); +/// re.applier.start(); +/// +/// var url = "/_api/replication/applier-state"; +/// var response = logCurlRequest('GET', url); +/// re.applier.stop(); +/// +/// assert(response.code === 200); +/// logJsonResponse(response); +/// @END_EXAMPLE_ARANGOSH_RUN //////////////////////////////////////////////////////////////////////////////// void RestReplicationHandler::handleCommandApplierGetState () { diff --git a/html/admin/api-docs/collection.json b/html/admin/api-docs/collection.json index 398c06006c..ed9ecade92 100644 --- a/html/admin/api-docs/collection.json +++ b/html/admin/api-docs/collection.json @@ -19,7 +19,7 @@ "notes": "Creates an new collection with a given name. The request must contain an object with the following attributes.

- name: The name of the collection.

- waitForSync (optional, default: false): If true then the data is synchronised to disk before returning from a create or update of a document.

- doCompact (optional, default is true): whether or not the collection will be compacted.

- journalSize (optional, default is a @ref CommandLineArangod \"configuration parameter\"): The maximal size of a journal or datafile. Note that this also limits the maximal size of a single object. Must be at least 1MB.

- isSystem (optional, default is false): If true, create a system collection. In this case collection-name should start with an underscore. End users should normally create non-system collections only. API implementors may be required to create system collections in very special occasions, but normally a regular collection will do.

- isVolatile (optional, default is false): If true then the collection data is kept in-memory only and not made persistent. Unloading the collection will cause the collection data to be discarded. Stopping or re-starting the server will also cause full loss of data in the collection. Setting this option will make the resulting collection be slightly faster than regular collections because ArangoDB does not enforce any synchronisation to disk and does not calculate any CRC checksums for datafiles (as there are no datafiles).

This option should threrefore be used for cache-type collections only, and not for data that cannot be re-created otherwise.

- keyOptions (optional) additional options for key generation. If specified, then keyOptions should be a JSON array containing the following attributes (note: some of them are optional): - type: specifies the type of the key generator. The currently available generators are traditional and autoincrement. - allowUserKeys: if set to true, then it is allowed to supply own key values in the _key attribute of a document. If set to false, then the key generator will solely be responsible for generating keys and supplying own key values in the _key attribute of documents is considered an error. - increment: increment value for autoincrement key generator. Not used for other key generator types. - offset: initial offset value for autoincrement key generator. Not used for other key generator types.

- type (optional, default is 2): the type of the collection to create. The following values for type are valid: - 2: document collection - 3: edges collection

", "summary": "creates a collection", "httpMethod": "POST", - "examples": "

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionBasics\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionBasics\n\n{ \n  \"id\" : \"23563747\", \n  \"name\" : \"testCollectionBasics\", \n  \"waitForSync\" : false, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\nunix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionEdges\",\"type\":3}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionEdges\n\n{ \n  \"id\" : \"24546787\", \n  \"name\" : \"testCollectionEdges\", \n  \"waitForSync\" : false, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"status\" : 3, \n  \"type\" : 3, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n



unix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionUsers\",\"keyOptions\":{\"type\":\"autoincrement\",\"increment\":5,\"allowUserKeys\":true}}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionUsers\n\n{ \n  \"id\" : \"25464291\", \n  \"name\" : \"testCollectionUsers\", \n  \"waitForSync\" : false, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionBasics\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionBasics\n\n{ \n  \"id\" : \"17552594\", \n  \"name\" : \"testCollectionBasics\", \n  \"waitForSync\" : false, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\nunix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionEdges\",\"type\":3}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionEdges\n\n{ \n  \"id\" : \"18535634\", \n  \"name\" : \"testCollectionEdges\", \n  \"waitForSync\" : false, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"status\" : 3, \n  \"type\" : 3, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n



unix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionUsers\",\"keyOptions\":{\"type\":\"autoincrement\",\"increment\":5,\"allowUserKeys\":true}}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionUsers\n\n{ \n  \"id\" : \"19453138\", \n  \"name\" : \"testCollectionUsers\", \n  \"waitForSync\" : false, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "createsACollection" } ], @@ -41,7 +41,7 @@ "notes": "Returns an object with an attribute collections containing a list of all collection descriptions. The same information is also available in the names as hash map with the collection names as keys.

By providing the optional URL parameter excludeSystem with a value of true, all system collections will be excluded from the response.

", "summary": "reads all collections", "httpMethod": "GET", - "examples": "Return information about all collections:

unix> curl --dump - http://localhost:8529/_api/collection\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"collections\" : [ \n    { \n      \"id\" : \"19303907\", \n      \"name\" : \"demo\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"8097251\", \n      \"name\" : \"_trx\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"8818147\", \n      \"name\" : \"_replication\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"20811235\", \n      \"name\" : \"animals\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"4689379\", \n      \"name\" : \"_structures\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"5475811\", \n      \"name\" : \"_aal\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"6393315\", \n      \"name\" : \"_aqlfunctions\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"1478115\", \n      \"name\" : \"_graphs\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"7114211\", \n      \"name\" : \"_fishbowl\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"2919907\", \n      \"name\" : \"_routing\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"101859\", \n      \"name\" : \"_users\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"2264547\", \n      \"name\" : \"_modules\", \n      \"status\" : 3, \n      \"type\" : 2 \n    } \n  ], \n  \"names\" : { \n    \"demo\" : { \n      \"id\" : \"19303907\", \n      \"name\" : \"demo\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_trx\" : { \n      \"id\" : \"8097251\", \n      \"name\" : \"_trx\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_replication\" : { \n      \"id\" : \"8818147\", \n      \"name\" : \"_replication\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"animals\" : { \n      \"id\" : \"20811235\", \n      \"name\" : \"animals\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_structures\" : { \n      \"id\" : \"4689379\", \n      \"name\" : \"_structures\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_aal\" : { \n      \"id\" : \"5475811\", \n      \"name\" : \"_aal\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_aqlfunctions\" : { \n      \"id\" : \"6393315\", \n      \"name\" : \"_aqlfunctions\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_graphs\" : { \n      \"id\" : \"1478115\", \n      \"name\" : \"_graphs\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_fishbowl\" : { \n      \"id\" : \"7114211\", \n      \"name\" : \"_fishbowl\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_routing\" : { \n      \"id\" : \"2919907\", \n      \"name\" : \"_routing\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_users\" : { \n      \"id\" : \"101859\", \n      \"name\" : \"_users\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_modules\" : { \n      \"id\" : \"2264547\", \n      \"name\" : \"_modules\", \n      \"status\" : 3, \n      \"type\" : 2 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "Return information about all collections:

unix> curl --dump - http://localhost:8529/_api/collection\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"collections\" : [ \n    { \n      \"id\" : \"1496274\", \n      \"name\" : \"_graphs\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"120018\", \n      \"name\" : \"_users\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"2938066\", \n      \"name\" : \"_routing\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"2282706\", \n      \"name\" : \"_modules\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"8049874\", \n      \"name\" : \"_trx\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"8836306\", \n      \"name\" : \"_replication\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"4707538\", \n      \"name\" : \"_structures\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"5493970\", \n      \"name\" : \"_aal\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"13292754\", \n      \"name\" : \"demo\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"7001298\", \n      \"name\" : \"_fishbowl\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"6345938\", \n      \"name\" : \"_aqlfunctions\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"14800082\", \n      \"name\" : \"animals\", \n      \"status\" : 3, \n      \"type\" : 2 \n    } \n  ], \n  \"names\" : { \n    \"_graphs\" : { \n      \"id\" : \"1496274\", \n      \"name\" : \"_graphs\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_users\" : { \n      \"id\" : \"120018\", \n      \"name\" : \"_users\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_routing\" : { \n      \"id\" : \"2938066\", \n      \"name\" : \"_routing\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_modules\" : { \n      \"id\" : \"2282706\", \n      \"name\" : \"_modules\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_trx\" : { \n      \"id\" : \"8049874\", \n      \"name\" : \"_trx\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_replication\" : { \n      \"id\" : \"8836306\", \n      \"name\" : \"_replication\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_structures\" : { \n      \"id\" : \"4707538\", \n      \"name\" : \"_structures\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_aal\" : { \n      \"id\" : \"5493970\", \n      \"name\" : \"_aal\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"demo\" : { \n      \"id\" : \"13292754\", \n      \"name\" : \"demo\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_fishbowl\" : { \n      \"id\" : \"7001298\", \n      \"name\" : \"_fishbowl\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_aqlfunctions\" : { \n      \"id\" : \"6345938\", \n      \"name\" : \"_aqlfunctions\", \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"animals\" : { \n      \"id\" : \"14800082\", \n      \"name\" : \"animals\", \n      \"status\" : 3, \n      \"type\" : 2 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "readsAllCollections" } ], @@ -99,7 +99,7 @@ "notes": "In addition to the above, the result will always contain the waitForSync, doCompact, journalSize, and isVolatile properties. This is achieved by forcing a load of the underlying collection.

- waitForSync: If true then creating or changing a document will wait until the data has been synchronised to disk.

- doCompact: Whether or not the collection will be compacted.

- journalSize: The maximal size setting for journals / datafiles.

- isVolatile: If true then the collection data will be kept in memory only and ArangoDB will not write or sync the data to disk.

", "summary": "reads the properties of a collection", "httpMethod": "GET", - "examples": "Using an identifier:

unix> curl --dump - http://localhost:8529/_api/collection/26119651/properties\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/properties\n\n{ \n  \"id\" : \"26119651\", \n  \"name\" : \"products\", \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : true, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Using a name:

unix> curl --dump - http://localhost:8529/_api/collection/products/properties\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/properties\n\n{ \n  \"id\" : \"26775011\", \n  \"name\" : \"products\", \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : true, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "Using an identifier:

unix> curl --dump - http://localhost:8529/_api/collection/20174034/properties\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/properties\n\n{ \n  \"id\" : \"20174034\", \n  \"name\" : \"products\", \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : true, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Using a name:

unix> curl --dump - http://localhost:8529/_api/collection/products/properties\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/properties\n\n{ \n  \"id\" : \"20829394\", \n  \"name\" : \"products\", \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : true, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "readsThePropertiesOfACollection" } ], @@ -130,7 +130,7 @@ "notes": "In addition to the above, the result also contains the number of documents. Note that this will always load the collection into memory.

- count: The number of documents inside the collection.

", "summary": "returns the number of documents in a collection", "httpMethod": "GET", - "examples": "Using an identifier and requesting the number of documents:

unix> curl --dump - http://localhost:8529/_api/collection/27430371/count\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/count\n\n{ \n  \"id\" : \"27430371\", \n  \"name\" : \"products\", \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : true, \n  \"count\" : 100, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "Using an identifier and requesting the number of documents:

unix> curl --dump - http://localhost:8529/_api/collection/21484754/count\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/count\n\n{ \n  \"id\" : \"21484754\", \n  \"name\" : \"products\", \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : true, \n  \"count\" : 100, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "returnsTheNumberOfDocumentsInACollection" } ], @@ -161,7 +161,7 @@ "notes": "In addition to the above, the result also contains the number of documents and additional statistical information about the collection. Note that this will always load the collection into memory.

- count: The number of documents inside the collection.

- figures.alive.count: The number of living documents.

- figures.alive.size: The total size in bytes used by all living documents.

- figures.dead.count: The number of dead documents.

- figures.dead.size: The total size in bytes used by all dead documents.

- figures.dead.deletion: The total number of deletion markers.

- figures.datafiles.count: The number of active datafiles.- figures.datafiles.fileSize: The total filesize of datafiles.

- figures.journals.count: The number of journal files.- figures.journals.fileSize: The total filesize of journal files.

- figures.shapes.count: The total number of shapes used in the collection (this includes shapes that are not in use anymore)

- figures.attributes.count: The total number of attributes used in the collection (this includes attributes that are not in use anymore)

- journalSize: The maximal size of the journal in bytes.

Note: the filesizes of shapes and compactor files are not reported.

", "summary": "returns the stats for a collection", "httpMethod": "GET", - "examples": "Using an identifier and requesting the figures of the collection:

unix> curl --dump - http://localhost:8529/_api/collection/48008675/figures\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/figures\n\n{ \n  \"id\" : \"48008675\", \n  \"name\" : \"products\", \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : true, \n  \"count\" : 0, \n  \"figures\" : { \n    \"alive\" : { \n      \"count\" : 0, \n      \"size\" : 0 \n    }, \n    \"dead\" : { \n      \"count\" : 0, \n      \"size\" : 0, \n      \"deletion\" : 0 \n    }, \n    \"datafiles\" : { \n      \"count\" : 0, \n      \"fileSize\" : 0 \n    }, \n    \"journals\" : { \n      \"count\" : 0, \n      \"fileSize\" : 0 \n    }, \n    \"shapes\" : { \n      \"count\" : 6 \n    }, \n    \"attributes\" : { \n      \"count\" : 0 \n    } \n  }, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "Using an identifier and requesting the figures of the collection:

unix> curl --dump - http://localhost:8529/_api/collection/42063058/figures\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/figures\n\n{ \n  \"id\" : \"42063058\", \n  \"name\" : \"products\", \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : true, \n  \"count\" : 0, \n  \"figures\" : { \n    \"alive\" : { \n      \"count\" : 0, \n      \"size\" : 0 \n    }, \n    \"dead\" : { \n      \"count\" : 0, \n      \"size\" : 0, \n      \"deletion\" : 0 \n    }, \n    \"datafiles\" : { \n      \"count\" : 0, \n      \"fileSize\" : 0 \n    }, \n    \"journals\" : { \n      \"count\" : 0, \n      \"fileSize\" : 0 \n    }, \n    \"shapes\" : { \n      \"count\" : 6 \n    }, \n    \"attributes\" : { \n      \"count\" : 0 \n    } \n  }, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "returnsTheStatsForACollection" } ], @@ -192,7 +192,7 @@ "notes": "In addition to the above, the result will also contain the collection's revision id. The revision id is a server-generated string that clients can use to check whether data in a collection has changed since the last revision check.

- revision: The collection revision id as a string.

", "summary": "return a collection revision id", "httpMethod": "GET", - "examples": "Retrieving the revision of a collection

unix> curl --dump - http://localhost:8529/_api/collection/48795107/revision\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"48795107\", \n  \"name\" : \"products\", \n  \"status\" : 3, \n  \"type\" : 2, \n  \"revision\" : \"0\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "Retrieving the revision of a collection

unix> curl --dump - http://localhost:8529/_api/collection/42915026/revision\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"42915026\", \n  \"name\" : \"products\", \n  \"status\" : 3, \n  \"type\" : 2, \n  \"revision\" : \"0\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "returnACollectionRevisionId" } ], @@ -230,7 +230,7 @@ "notes": "Will calculate checksum of the meta-data (keys and revision ids) and optionally document data in the collection.

The checksum can be used to compare if two collections on different ArangoDB instances contain the same contents. The current revision of the collection is returned too so one can make sure the checksums are calculated for the same state of data.

By default, the checksum will only be calculated on the _key and _rev system attributes of the documents contained in the collection. For edge collections, the system attributes _from and _to will also be included in the calculation.

By providing the optional URL parameter withData with a value of true, the user-defined document attributes will be included in the calculation too. Note that including user-defined attributes will make the checksumming slower.

- checksum: The calculated checksum as a number.

- revision: The collection revision id as a string.

", "summary": "returns a checksum for the collection", "httpMethod": "GET", - "examples": "Retrieving the checksum of a collection:

unix> curl --dump - http://localhost:8529/_api/collection/49581539/checksum\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"49581539\", \n  \"name\" : \"products\", \n  \"status\" : 3, \n  \"type\" : 2, \n  \"checksum\" : 6064344, \n  \"revision\" : \"50564579\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "Retrieving the checksum of a collection:

unix> curl --dump - http://localhost:8529/_api/collection/43635922/checksum\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"43635922\", \n  \"name\" : \"products\", \n  \"status\" : 3, \n  \"type\" : 2, \n  \"checksum\" : 4087899028, \n  \"revision\" : \"44618962\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "returnsAChecksumForTheCollection" } ], @@ -261,7 +261,7 @@ "notes": "Loads a collection into memory. Returns the collection on success.

The request might optionally contain the following attribute:

- count: If set, this controls whether the return value should include the number of documents in the collection. Setting count to false may speed up loading a collection. The default value for count is true.

On success an object with the following attributes is returned:

- id: The identifier of the collection.

- name: The name of the collection.

- count: The number of documents inside the collection. This is only returned if the count input parameters is set to true or has not been specified.

- status: The status of the collection as number.

- type: The collection type. Valid types are: - 2: document collection - 3: edges collection

", "summary": "loads a collection", "httpMethod": "PUT", - "examples": "

unix> curl -X PUT --dump - http://localhost:8529/_api/collection/50695651/load\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"50695651\", \n  \"name\" : \"products\", \n  \"count\" : 0, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl -X PUT --dump - http://localhost:8529/_api/collection/44750034/load\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"44750034\", \n  \"name\" : \"products\", \n  \"count\" : 0, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "loadsACollection" } ], @@ -292,7 +292,7 @@ "notes": "Removes a collection from memory. This call does not delete any documents. You can use the collection afterwards; in which case it will be loaded into memory, again. On success an object with the following attributes is returned:

- id: The identifier of the collection.

- name: The name of the collection.

- status: The status of the collection as number.

- type: The collection type. Valid types are: - 2: document collection - 3: edges collection

", "summary": "unloads a collection", "httpMethod": "PUT", - "examples": "

unix> curl -X PUT --dump - http://localhost:8529/_api/collection/51416547/unload\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"51416547\", \n  \"name\" : \"products\", \n  \"status\" : 2, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl -X PUT --dump - http://localhost:8529/_api/collection/45536466/unload\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"45536466\", \n  \"name\" : \"products\", \n  \"status\" : 2, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "unloadsACollection" } ], @@ -314,7 +314,7 @@ "notes": "Removes all documents from the collection, but leaves the indexes intact.

", "summary": "truncates a collection", "httpMethod": "PUT", - "examples": "

unix> curl -X PUT --dump - http://localhost:8529/_api/collection/52137443/truncate\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"52137443\", \n  \"name\" : \"products\", \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl -X PUT --dump - http://localhost:8529/_api/collection/46191826/truncate\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"46191826\", \n  \"name\" : \"products\", \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "truncatesACollection" } ], @@ -336,7 +336,7 @@ "notes": "Changes the properties of a collection. Expects an object with the attribute(s)

- waitForSync: If true then creating or changing a document will wait until the data has been synchronised to disk.

- journalSize: Size (in bytes) for new journal files that are created for the collection.

If returns an object with the attributes

- id: The identifier of the collection.

- name: The name of the collection.

- waitForSync: The new value.

- journalSize: The new value.

- status: The status of the collection as number.

- type: The collection type. Valid types are: - 2: document collection - 3: edges collection

Note: some other collection properties, such as type or isVolatile cannot be changed once the collection is created.

", "summary": "changes the properties of a collection", "httpMethod": "PUT", - "examples": "

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/collection/52858339/properties\n{\"waitForSync\":true}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"52858339\", \n  \"name\" : \"products\", \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : true, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/collection/46978258/properties\n{\"waitForSync\":true}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"46978258\", \n  \"name\" : \"products\", \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"isSystem\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : true, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "changesThePropertiesOfACollection" } ], @@ -358,7 +358,7 @@ "notes": "Renames a collection. Expects an object with the attribute(s)

- name: The new name.

If returns an object with the attributes

- id: The identifier of the collection.

- name: The new name of the collection.

- status: The status of the collection as number.

- type: The collection type. Valid types are: - 2: document collection - 3: edges collection

", "summary": "renames a collection", "httpMethod": "PUT", - "examples": "

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/collection/53579235/rename\n{\"name\":\"newname\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"53579235\", \n  \"name\" : \"newname\", \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/collection/47633618/rename\n{\"name\":\"newname\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"47633618\", \n  \"name\" : \"newname\", \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "renamesACollection" } ], @@ -389,7 +389,7 @@ "notes": "Deletes a collection identified by collection-name.

If the collection was successfully deleted then, an object is returned with the following attributes:

- error: false

- id: The identifier of the deleted collection.

", "summary": "deletes a collection", "httpMethod": "DELETE", - "examples": "Using an identifier:

unix> curl -X DELETE --dump - http://localhost:8529/_api/collection/54234595\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"54234595\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Using a name:

unix> curl -X DELETE --dump - http://localhost:8529/_api/collection/products1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"54889955\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "Using an identifier:

unix> curl -X DELETE --dump - http://localhost:8529/_api/collection/48354514\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"48354514\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Using a name:

unix> curl -X DELETE --dump - http://localhost:8529/_api/collection/products1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"49075410\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "deletesACollection" } ], diff --git a/html/admin/api-docs/cursor.json b/html/admin/api-docs/cursor.json index b2c9b4b129..a07bea10fa 100644 --- a/html/admin/api-docs/cursor.json +++ b/html/admin/api-docs/cursor.json @@ -32,7 +32,7 @@ "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 in the result set should be returned in the \"count\" attribute of the result (optional). Calculating the \"count\" attribute might in the future have a performance impact for some queries so this option is turned off by default, and \"count\" is only returned when requested.

- 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 the manual 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/56462819\", \n      \"_rev\" : \"56462819\", \n      \"_key\" : \"56462819\", \n      \"hello1\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/56856035\", \n      \"_rev\" : \"56856035\", \n      \"_key\" : \"56856035\", \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/58953187\", \n      \"_rev\" : \"58953187\", \n      \"_key\" : \"58953187\", \n      \"hello4\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/57904611\", \n      \"_rev\" : \"57904611\", \n      \"_key\" : \"57904611\", \n      \"hello1\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"59477475\", \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 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\n

", + "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/50648274\", \n      \"_rev\" : \"50648274\", \n      \"_key\" : \"50648274\", \n      \"hello1\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/50975954\", \n      \"_rev\" : \"50975954\", \n      \"_key\" : \"50975954\", \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/52745426\", \n      \"_rev\" : \"52745426\", \n      \"_key\" : \"52745426\", \n      \"hello3\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/53073106\", \n      \"_rev\" : \"53073106\", \n      \"_key\" : \"53073106\", \n      \"hello4\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"53597394\", \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 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\n

", "nickname": "createsACursor" } ], @@ -63,7 +63,7 @@ "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/61967843\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/60460515\", \n      \"_rev\" : \"60460515\", \n      \"_key\" : \"60460515\", \n      \"hello1\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/61771235\", \n      \"_rev\" : \"61771235\", \n      \"_key\" : \"61771235\", \n      \"hello5\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"61967843\", \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

", + "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/56087762\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/55563474\", \n      \"_rev\" : \"55563474\", \n      \"_key\" : \"55563474\", \n      \"hello4\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/54580434\", \n      \"_rev\" : \"54580434\", \n      \"_key\" : \"54580434\", \n      \"hello1\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"56087762\", \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" } ], @@ -94,7 +94,7 @@ "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/62950883\", \n      \"_rev\" : \"62950883\", \n      \"_key\" : \"62950883\", \n      \"hello1\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/63933923\", \n      \"_rev\" : \"63933923\", \n      \"_key\" : \"63933923\", \n      \"hello4\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"64458211\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\nunix> curl -X DELETE --dump - http://localhost:8529/_api/cursor/64458211\n\n

", + "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/58053842\", \n      \"_rev\" : \"58053842\", \n      \"_key\" : \"58053842\", \n      \"hello4\" : \"world1\" \n    }, \n    { \n      \"_id\" : \"products/57398482\", \n      \"_rev\" : \"57398482\", \n      \"_key\" : \"57398482\", \n      \"hello2\" : \"world1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"58578130\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\nunix> curl -X DELETE --dump - http://localhost:8529/_api/cursor/58578130\n\n

", "nickname": "deletesACursor" } ], diff --git a/html/admin/api-docs/document.json b/html/admin/api-docs/document.json index eb727fb4ad..6db73afe7d 100644 --- a/html/admin/api-docs/document.json +++ b/html/admin/api-docs/document.json @@ -55,7 +55,7 @@ "notes": "Creates a new document in the collection named collection. A JSON representation of the document must be passed as the body of the POST request.

If the document was created successfully, then the \"Location\" header contains the path to the newly created document. The \"ETag\" header field contains the revision of the document.

The body of the response contains a JSON object with the following attributes:

- _id contains the document handle of the newly created document- _key contains the document key- _rev contains the document revision

If the collection parameter waitForSync is false, then the call returns as soon as the document has been accepted. It will not wait until the document has been synced to disk.

Optionally, the URL parameter waitForSync can be used to force synchronisation of the document creation operation to disk even in case that the waitForSync flag had been disabled for the entire collection. Thus, the waitForSync URL parameter can be used to force synchronisation of just this specific operations. To use this, set the waitForSync parameter to true. If the waitForSync parameter is not specified or set to false, then the collection's default waitForSync behavior is applied. The waitForSync URL parameter cannot be used to disable synchronisation for collections that have a default waitForSync value of true.

", "summary": "creates a document", "httpMethod": "POST", - "examples": "Create a document given a collection named products. Note that the revision identifier might or might not by equal to the auto-generated key.

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: \"292523491\"\nlocation: /_api/document/products/292523491\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/292523491\", \n  \"_rev\" : \"292523491\", \n  \"_key\" : \"292523491\" \n}\n\n

Create a document in a collection named products with a collection-level waitForSync value of false.

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"293506531\"\nlocation: /_api/document/products/293506531\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/293506531\", \n  \"_rev\" : \"293506531\", \n  \"_key\" : \"293506531\" \n}\n\n

Create a document in a collection with a collection-level waitForSync value of false, but using the waitForSync URL parameter.

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products&waitForSync=true\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: \"294555107\"\nlocation: /_api/document/products/294555107\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/294555107\", \n  \"_rev\" : \"294555107\", \n  \"_key\" : \"294555107\" \n}\n\n

Create a document in a new, named collection

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products&createCollection=true\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"295603683\"\nlocation: /_api/document/products/295603683\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/295603683\", \n  \"_rev\" : \"295603683\", \n  \"_key\" : \"295603683\" \n}\n\n

Unknown collection name:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"collection /_api/collection/products not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1203 \n}\n\n

Illegal document:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ 1: \"World\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"expecting attribute name\", \n  \"code\" : 400, \n  \"errorNum\" : 600 \n}\n\n

", + "examples": "Create a document given a collection named products. Note that the revision identifier might or might not by equal to the auto-generated key.

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: \"291296466\"\nlocation: /_api/document/products/291296466\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/291296466\", \n  \"_rev\" : \"291296466\", \n  \"_key\" : \"291296466\" \n}\n\n

Create a document in a collection named products with a collection-level waitForSync value of false.

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"292345042\"\nlocation: /_api/document/products/292345042\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/292345042\", \n  \"_rev\" : \"292345042\", \n  \"_key\" : \"292345042\" \n}\n\n

Create a document in a collection with a collection-level waitForSync value of false, but using the waitForSync URL parameter.

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products&waitForSync=true\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: \"293393618\"\nlocation: /_api/document/products/293393618\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/293393618\", \n  \"_rev\" : \"293393618\", \n  \"_key\" : \"293393618\" \n}\n\n

Create a document in a new, named collection

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products&createCollection=true\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"294442194\"\nlocation: /_api/document/products/294442194\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/294442194\", \n  \"_rev\" : \"294442194\", \n  \"_key\" : \"294442194\" \n}\n\n

Unknown collection name:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"collection /_api/collection/products not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1203 \n}\n\n

Illegal document:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ 1: \"World\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"expecting attribute name\", \n  \"code\" : 400, \n  \"errorNum\" : 600 \n}\n\n

", "nickname": "createsADocument" } ], @@ -106,7 +106,7 @@ "notes": "Returns the document identified by document-handle. The returned document contains two special attributes: _id containing the document handle and _rev containing the revision.

", "summary": "reads a document", "httpMethod": "GET", - "examples": "Use a document handle:

unix> curl --dump - http://localhost:8529/_api/document/products/296652259\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"296652259\"\n\n{ \n  \"hello\" : \"world\", \n  \"_id\" : \"products/296652259\", \n  \"_rev\" : \"296652259\", \n  \"_key\" : \"296652259\" \n}\n\n

Use a document handle and an etag:

unix> curl --header 'If-None-Match:\"297766371\"' --dump - http://localhost:8529/_api/document/products/297766371\n\n

Unknown document handle:

unix> curl --dump - http://localhost:8529/_api/document/products/unknownhandle\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"document /_api/document/products/unknownhandle not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1202 \n}\n\n

", + "examples": "Use a document handle:

unix> curl --dump - http://localhost:8529/_api/document/products/295490770\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"295490770\"\n\n{ \n  \"hello\" : \"world\", \n  \"_id\" : \"products/295490770\", \n  \"_rev\" : \"295490770\", \n  \"_key\" : \"295490770\" \n}\n\n

Use a document handle and an etag:

unix> curl --header 'If-None-Match:\"296604882\"' --dump - http://localhost:8529/_api/document/products/296604882\n\n

Unknown document handle:

unix> curl --dump - http://localhost:8529/_api/document/products/unknownhandle\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"document /_api/document/products/unknownhandle not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1202 \n}\n\n

", "nickname": "readsADocument" } ], @@ -137,7 +137,7 @@ "notes": "Returns a list of all URI for all documents from the collection identified by collection.

", "summary": "reads all documents from collection", "httpMethod": "GET", - "examples": "Returns a collection.

unix> curl --dump - http://localhost:8529/_api/document/?collection=products\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"documents\" : [ \n    \"/_api/document/products/299339235\", \n    \"/_api/document/products/299666915\", \n    \"/_api/document/products/298946019\" \n  ] \n}\n\n

Collection does not exist.

unix> curl --dump - http://localhost:8529/_api/document/?collection=doesnotexist\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"collection /_api/collection/doesnotexist not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1203 \n}\n\n

", + "examples": "Returns a collection.

unix> curl --dump - http://localhost:8529/_api/document/?collection=products\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"documents\" : [ \n    \"/_api/document/products/298177746\", \n    \"/_api/document/products/297784530\", \n    \"/_api/document/products/298505426\" \n  ] \n}\n\n

Collection does not exist.

unix> curl --dump - http://localhost:8529/_api/document/?collection=doesnotexist\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"collection /_api/collection/doesnotexist not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1203 \n}\n\n

", "nickname": "readsAllDocumentsFromCollection" } ], @@ -194,7 +194,7 @@ "notes": "Like GET, but only returns the header fields and not the body. You can use this call to get the current revision of a document or check if the document was deleted.

", "summary": "reads a document header", "httpMethod": "HEAD", - "examples": "

unix> curl -X HEAD --dump - http://localhost:8529/_api/document/products/300715491\n\n

", + "examples": "

unix> curl -X HEAD --dump - http://localhost:8529/_api/document/products/299554002\n\n

", "nickname": "readsADocumentHeader" } ], @@ -261,7 +261,7 @@ "notes": "Completely updates (i.e. replaces) the document identified by document-handle. If the document exists and can be updated, then a HTTP 201 is returned and the \"ETag\" header field contains the new revision of the document.

If the new document passed in the body of the request contains the document-handle in the attribute _id and the revision in _rev, these attributes will be ignored. Only the URI and the \"ETag\" header are relevant in order to avoid confusion when using proxies.

Optionally, the URL parameter waitForSync can be used to force synchronisation of the document replacement operation to disk even in case that the waitForSync flag had been disabled for the entire collection. Thus, the waitForSync URL parameter can be used to force synchronisation of just specific operations. To use this, set the waitForSync parameter to true. If the waitForSync parameter is not specified or set to false, then the collection's default waitForSync behavior is applied. The waitForSync URL parameter cannot be used to disable synchronisation for collections that have a default waitForSync value of true.

The body of the response contains a JSON object with the information about the handle and the revision. The attribute _id contains the known document-handle of the updated document, the attribute _rev contains the new document revision.

If the document does not exist, then a HTTP 404 is returned and the body of the response contains an error document.

There are two ways for specifying the targeted document revision id for conditional replacements (i.e. replacements that will only be executed if the revision id found in the database matches the document revision id specified in the request): - specifying the target revision in the rev URL query parameter- specifying the target revision in the if-match HTTP header

Specifying a target revision is optional, however, if done, only one of the described mechanisms must be used (either the rev URL parameter or the if-match HTTP header). Regardless which mechanism is used, the parameter needs to contain the target document revision id as returned in the _rev attribute of a document or by an HTTP etag header.

For example, to conditionally replace a document based on a specific revision id, you the following request:

- PUT /_api/document/document-handle?rev=etag

If a target revision id is provided in the request (e.g. via the etag value in the rev URL query parameter above), ArangoDB will check that the revision id of the document found in the database is equal to the target revision id provided in the request. If there is a mismatch between the revision id, then by default a HTTP 412 conflict is returned and no replacement is performed.

The conditional update behavior can be overriden with the policy URL query parameter:

- PUT /_api/document/document-handle?policy=policy

If policy is set to error, then the behavior is as before: replacements will fail if the revision id found in the database does not match the target revision id specified in the request.

If policy is set to last, then the replacement will succeed, even if the revision id found in the database does not match the target revision id specified in the request. You can use the last `policy` to force replacements.

", "summary": "replaces a document", "httpMethod": "PUT", - "examples": "Using document handle:

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/301829603\n{\"Hello\": \"you\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"302222819\"\nlocation: /_api/document/products/301829603\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/301829603\", \n  \"_rev\" : \"302222819\", \n  \"_key\" : \"301829603\" \n}\n\n

Unknown document handle:

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/303205859\n{}\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"document /_api/document/products/303205859 not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1202 \n}\n\n

Produce a revision conflict:

unix> curl -X PUT --header 'If-Match:\"304975331\"' --data @- --dump - http://localhost:8529/_api/document/products/304582115\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 412, \n  \"errorNum\" : 1200, \n  \"errorMessage\" : \"precondition failed\", \n  \"_id\" : \"products/304582115\", \n  \"_rev\" : \"304582115\", \n  \"_key\" : \"304582115\" \n}\n\n

Last write wins:

unix> curl -X PUT --header 'If-Match:\"306548195\"' --data @- --dump - http://localhost:8529/_api/document/products/306154979?policy=last\n{}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"306810339\"\nlocation: /_api/document/products/306154979\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/306154979\", \n  \"_rev\" : \"306810339\", \n  \"_key\" : \"306154979\" \n}\n\n

Alternative to header field:

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/307793379?rev=308186595\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 412, \n  \"errorNum\" : 1200, \n  \"errorMessage\" : \"precondition failed\", \n  \"_id\" : \"products/307793379\", \n  \"_rev\" : \"307793379\", \n  \"_key\" : \"307793379\" \n}\n\n

", + "examples": "Using document handle:

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/300668114\n{\"Hello\": \"you\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"301061330\"\nlocation: /_api/document/products/300668114\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/300668114\", \n  \"_rev\" : \"301061330\", \n  \"_key\" : \"300668114\" \n}\n\n

Unknown document handle:

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/302044370\n{}\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"document /_api/document/products/302044370 not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1202 \n}\n\n

Produce a revision conflict:

unix> curl -X PUT --header 'If-Match:\"303813842\"' --data @- --dump - http://localhost:8529/_api/document/products/303420626\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 412, \n  \"errorNum\" : 1200, \n  \"errorMessage\" : \"precondition failed\", \n  \"_id\" : \"products/303420626\", \n  \"_rev\" : \"303420626\", \n  \"_key\" : \"303420626\" \n}\n\n

Last write wins:

unix> curl -X PUT --header 'If-Match:\"305386706\"' --data @- --dump - http://localhost:8529/_api/document/products/304993490?policy=last\n{}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"305648850\"\nlocation: /_api/document/products/304993490\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/304993490\", \n  \"_rev\" : \"305648850\", \n  \"_key\" : \"304993490\" \n}\n\n

Alternative to header field:

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/306631890?rev=307025106\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 412, \n  \"errorNum\" : 1200, \n  \"errorMessage\" : \"precondition failed\", \n  \"_id\" : \"products/306631890\", \n  \"_rev\" : \"306631890\", \n  \"_key\" : \"306631890\" \n}\n\n

", "nickname": "replacesADocument" } ], @@ -334,7 +334,7 @@ "notes": "Partially updates the document identified by document-handle. The body of the request must contain a JSON document with the attributes to patch (the patch document). All attributes from the patch document will be added to the existing document if they do not yet exist, and overwritten in the existing document if they do exist there.

Setting an attribute value to null in the patch document will cause a value of null be saved for the attribute by default.

Optionally, the URL parameter waitForSync can be used to force synchronisation of the document update operation to disk even in case that the waitForSync flag had been disabled for the entire collection. Thus, the waitForSync URL parameter can be used to force synchronisation of just specific operations. To use this, set the waitForSync parameter to true. If the waitForSync parameter is not specified or set to false, then the collection's default waitForSync behavior is applied. The waitForSync URL parameter cannot be used to disable synchronisation for collections that have a default waitForSync value of true.

The body of the response contains a JSON object with the information about the handle and the revision. The attribute _id contains the known document-handle of the updated document, the attribute _rev contains the new document revision.

If the document does not exist, then a HTTP 404 is returned and the body of the response contains an error document.

You can conditionally update a document based on a target revision id by using either the rev URL parameter or the if-match HTTP header. To control the update behavior in case there is a revision mismatch, you can use the policy parameter. This is the same as when replacing documents (see replacing documents for details).

", "summary": "patches a document", "httpMethod": "PATCH", - "examples": "patches an existing document with new content.

unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/309366243\n{\"hello\":\"world\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"309759459\"\nlocation: /_api/document/products/309366243\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/309366243\", \n  \"_rev\" : \"309759459\", \n  \"_key\" : \"309366243\" \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/309366243\n{\"numbers\":{\"one\":1,\"two\":2,\"three\":3,\"empty\":null}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"310349283\"\nlocation: /_api/document/products/309366243\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/309366243\", \n  \"_rev\" : \"310349283\", \n  \"_key\" : \"309366243\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/309366243\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"310349283\"\n\n{ \n  \"one\" : \"world\", \n  \"hello\" : \"world\", \n  \"numbers\" : { \n    \"empty\" : null, \n    \"one\" : 1, \n    \"two\" : 2, \n    \"three\" : 3 \n  }, \n  \"_id\" : \"products/309366243\", \n  \"_rev\" : \"310349283\", \n  \"_key\" : \"309366243\" \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/309366243?keepNull=false\n{\"hello\":null,\"numbers\":{\"four\":4}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"310808035\"\nlocation: /_api/document/products/309366243\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/309366243\", \n  \"_rev\" : \"310808035\", \n  \"_key\" : \"309366243\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/309366243\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"310808035\"\n\n{ \n  \"one\" : \"world\", \n  \"numbers\" : { \n    \"empty\" : null, \n    \"one\" : 1, \n    \"two\" : 2, \n    \"three\" : 3, \n    \"four\" : 4 \n  }, \n  \"_id\" : \"products/309366243\", \n  \"_rev\" : \"310808035\", \n  \"_key\" : \"309366243\" \n}\n\n

", + "examples": "patches an existing document with new content.

unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/308204754\n{\"hello\":\"world\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"308597970\"\nlocation: /_api/document/products/308204754\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/308204754\", \n  \"_rev\" : \"308597970\", \n  \"_key\" : \"308204754\" \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/308204754\n{\"numbers\":{\"one\":1,\"two\":2,\"three\":3,\"empty\":null}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"309187794\"\nlocation: /_api/document/products/308204754\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/308204754\", \n  \"_rev\" : \"309187794\", \n  \"_key\" : \"308204754\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/308204754\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"309187794\"\n\n{ \n  \"one\" : \"world\", \n  \"hello\" : \"world\", \n  \"numbers\" : { \n    \"empty\" : null, \n    \"one\" : 1, \n    \"two\" : 2, \n    \"three\" : 3 \n  }, \n  \"_id\" : \"products/308204754\", \n  \"_rev\" : \"309187794\", \n  \"_key\" : \"308204754\" \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/308204754?keepNull=false\n{\"hello\":null,\"numbers\":{\"four\":4}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"309646546\"\nlocation: /_api/document/products/308204754\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/308204754\", \n  \"_rev\" : \"309646546\", \n  \"_key\" : \"308204754\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/308204754\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"309646546\"\n\n{ \n  \"one\" : \"world\", \n  \"numbers\" : { \n    \"empty\" : null, \n    \"one\" : 1, \n    \"two\" : 2, \n    \"three\" : 3, \n    \"four\" : 4 \n  }, \n  \"_id\" : \"products/308204754\", \n  \"_rev\" : \"309646546\", \n  \"_key\" : \"308204754\" \n}\n\n

", "nickname": "patchesADocument" } ], @@ -397,7 +397,7 @@ "notes": "The body of the response contains a JSON object with the information about the handle and the revision. The attribute _id contains the known document-handle of the updated document, the attribute _rev contains the known document revision.

If the waitForSync parameter is not specified or set to false, then the collection's default waitForSync behavior is applied. The waitForSync URL parameter cannot be used to disable synchronisation for collections that have a default waitForSync value of true.

", "summary": "deletes a document", "httpMethod": "DELETE", - "examples": "Using document handle:

unix> curl -X DELETE --dump - http://localhost:8529/_api/document/products/311922147\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/311922147\", \n  \"_rev\" : \"311922147\", \n  \"_key\" : \"311922147\" \n}\n\n

Unknown document handle:

unix> curl -X DELETE --dump - http://localhost:8529/_api/document/products/313167331\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"document /_api/document/products/313167331 not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1202 \n}\n\n

Revision conflict:

unix> curl -X DELETE --header 'If-Match:\"314871267\"' --dump - http://localhost:8529/_api/document/products/314478051\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 412, \n  \"errorNum\" : 1200, \n  \"errorMessage\" : \"precondition failed\", \n  \"_id\" : \"products/314478051\", \n  \"_rev\" : \"314478051\", \n  \"_key\" : \"314478051\" \n}\n\n

", + "examples": "Using document handle:

unix> curl -X DELETE --dump - http://localhost:8529/_api/document/products/310760658\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/310760658\", \n  \"_rev\" : \"310760658\", \n  \"_key\" : \"310760658\" \n}\n\n

Unknown document handle:

unix> curl -X DELETE --dump - http://localhost:8529/_api/document/products/312005842\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"document /_api/document/products/312005842 not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1202 \n}\n\n

Revision conflict:

unix> curl -X DELETE --header 'If-Match:\"313709778\"' --dump - http://localhost:8529/_api/document/products/313316562\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 412, \n  \"errorNum\" : 1200, \n  \"errorMessage\" : \"precondition failed\", \n  \"_id\" : \"products/313316562\", \n  \"_rev\" : \"313316562\", \n  \"_key\" : \"313316562\" \n}\n\n

", "nickname": "deletesADocument" } ], diff --git a/html/admin/api-docs/edge.json b/html/admin/api-docs/edge.json index 086fcb440d..78e35229fe 100644 --- a/html/admin/api-docs/edge.json +++ b/html/admin/api-docs/edge.json @@ -49,7 +49,7 @@ "notes": "from handle and to handle are immutable once the edge has been created.

In all other respects the method works like POST /document, see the manual for details.

", "summary": "creates an edge", "httpMethod": "POST", - "examples": "Create an edge and reads it back:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/edge/?collection=edges&from=vertices/1&to=vertices/2\n{\"name\":\"Emil\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"318016995\"\nlocation: /_api/document/edges/318016995\n\n{ \n  \"error\" : false, \n  \"_id\" : \"edges/318016995\", \n  \"_rev\" : \"318016995\", \n  \"_key\" : \"318016995\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/edge/edges/318016995\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"318016995\"\n\n{ \n  \"name\" : \"Emil\", \n  \"_id\" : \"edges/318016995\", \n  \"_rev\" : \"318016995\", \n  \"_key\" : \"318016995\", \n  \"_from\" : \"vertices/1\", \n  \"_to\" : \"vertices/2\" \n}\n\n

", + "examples": "Create an edge and reads it back:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/edge/?collection=edges&from=vertices/1&to=vertices/2\n{\"name\":\"Emil\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"316855506\"\nlocation: /_api/document/edges/316855506\n\n{ \n  \"error\" : false, \n  \"_id\" : \"edges/316855506\", \n  \"_rev\" : \"316855506\", \n  \"_key\" : \"316855506\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/edge/edges/316855506\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"316855506\"\n\n{ \n  \"name\" : \"Emil\", \n  \"_id\" : \"edges/316855506\", \n  \"_rev\" : \"316855506\", \n  \"_key\" : \"316855506\", \n  \"_from\" : \"vertices/1\", \n  \"_to\" : \"vertices/2\" \n}\n\n

", "nickname": "createsAnEdge" } ], diff --git a/html/admin/api-docs/edges.json b/html/admin/api-docs/edges.json index 0ee1af6df0..ba0c77a813 100644 --- a/html/admin/api-docs/edges.json +++ b/html/admin/api-docs/edges.json @@ -32,7 +32,7 @@ "notes": "Returns the list of edges starting or ending in the vertex identified by vertex-handle.

", "summary": "reads in- or outbound edges", "httpMethod": "GET", - "examples": "Any direction

unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"edges\" : [ \n    { \n      \"_id\" : \"edges/6\", \n      \"_rev\" : \"69176803\", \n      \"_key\" : \"6\", \n      \"_from\" : \"vertices/2\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v2 -> v1\" \n    }, \n    { \n      \"_id\" : \"edges/7\", \n      \"_rev\" : \"69766627\", \n      \"_key\" : \"7\", \n      \"_from\" : \"vertices/4\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v4 -> v1\" \n    }, \n    { \n      \"_id\" : \"edges/5\", \n      \"_rev\" : \"68586979\", \n      \"_key\" : \"5\", \n      \"_from\" : \"vertices/1\", \n      \"_to\" : \"vertices/3\", \n      \"$label\" : \"v1 -> v3\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

In edges

unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=in\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"edges\" : [ \n    { \n      \"_id\" : \"edges/6\", \n      \"_rev\" : \"74681827\", \n      \"_key\" : \"6\", \n      \"_from\" : \"vertices/2\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v2 -> v1\" \n    }, \n    { \n      \"_id\" : \"edges/7\", \n      \"_rev\" : \"75271651\", \n      \"_key\" : \"7\", \n      \"_from\" : \"vertices/4\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v4 -> v1\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Out edges

unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=out\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"edges\" : [ \n    { \n      \"_id\" : \"edges/5\", \n      \"_rev\" : \"79597027\", \n      \"_key\" : \"5\", \n      \"_from\" : \"vertices/1\", \n      \"_to\" : \"vertices/3\", \n      \"$label\" : \"v1 -> v3\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "Any direction

unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"edges\" : [ \n    { \n      \"_id\" : \"edges/6\", \n      \"_rev\" : \"63296722\", \n      \"_key\" : \"6\", \n      \"_from\" : \"vertices/2\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v2 -> v1\" \n    }, \n    { \n      \"_id\" : \"edges/7\", \n      \"_rev\" : \"63886546\", \n      \"_key\" : \"7\", \n      \"_from\" : \"vertices/4\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v4 -> v1\" \n    }, \n    { \n      \"_id\" : \"edges/5\", \n      \"_rev\" : \"62706898\", \n      \"_key\" : \"5\", \n      \"_from\" : \"vertices/1\", \n      \"_to\" : \"vertices/3\", \n      \"$label\" : \"v1 -> v3\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

In edges

unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=in\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"edges\" : [ \n    { \n      \"_id\" : \"edges/6\", \n      \"_rev\" : \"68801746\", \n      \"_key\" : \"6\", \n      \"_from\" : \"vertices/2\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v2 -> v1\" \n    }, \n    { \n      \"_id\" : \"edges/7\", \n      \"_rev\" : \"69391570\", \n      \"_key\" : \"7\", \n      \"_from\" : \"vertices/4\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v4 -> v1\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Out edges

unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=out\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"edges\" : [ \n    { \n      \"_id\" : \"edges/5\", \n      \"_rev\" : \"73716946\", \n      \"_key\" : \"5\", \n      \"_from\" : \"vertices/1\", \n      \"_to\" : \"vertices/3\", \n      \"$label\" : \"v1 -> v3\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "readsIn-OrOutboundEdges" } ], diff --git a/html/admin/api-docs/graph.json b/html/admin/api-docs/graph.json index 60fd25ed4c..937fd7cd8f 100644 --- a/html/admin/api-docs/graph.json +++ b/html/admin/api-docs/graph.json @@ -38,7 +38,7 @@ "notes": "Creates a new graph.

Returns an object with an attribute graph containing a list of all graph properties.

", "summary": "create graph", "httpMethod": "POST", - "examples": "

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/\n{\"_key\":\"graph\",\"vertices\":\"vertices\",\"edges\":\"edges\"}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: 85167587\n\n{ \n  \"graph\" : { \n    \"_id\" : \"_graphs/graph\", \n    \"_rev\" : \"85167587\", \n    \"_key\" : \"graph\", \n    \"edges\" : \"edges\", \n    \"vertices\" : \"vertices\" \n  }, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/\n{\"_key\":\"graph\",\"vertices\":\"vertices\",\"edges\":\"edges\"}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: 79287506\n\n{ \n  \"graph\" : { \n    \"_id\" : \"_graphs/graph\", \n    \"_rev\" : \"79287506\", \n    \"_key\" : \"graph\", \n    \"edges\" : \"edges\", \n    \"vertices\" : \"vertices\" \n  }, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "createGraph" } ], @@ -49,19 +49,19 @@ { "errorResponses": [ { - "reason": "is returned if the graph was found ", + "reason": "is returned if the graph was found (in case graph-name was specified) or the list of graphs was assembled successfully (in case graph-name was not specified). ", "code": "200" }, { - "reason": "is returned if the graph was not found. The response body contains an error document in this case. ", + "reason": "is returned if the graph was not found. This response code may only be returned if graph-name is specified in the request. The response body contains an error document in this case. ", "code": "404" }, { - "reason": "\"If-None-Match\" header is given and the current graph has not a different version ", + "reason": "\"If-None-Match\" header is given and the current graph has not a different version. This response code may only be returned if graph-name is specified in the request. ", "code": "304" }, { - "reason": "\"If-Match\" header or rev is given and the current graph has a different version ", + "reason": "\"If-Match\" header or rev is given and the current graph has a different version. This response code may only be returned if graph-name is specified in the request. ", "code": "412" } ], @@ -69,28 +69,28 @@ { "dataType": "String", "paramType": "path", - "required": "true", + "required": "false", "name": "graph-name", - "description": "The name of the graph " + "description": "The name of the graph. " }, { "dataType": "String", "paramType": "header", "name": "If-None-Match", - "description": "If the \"If-None-Match\" header is given, then it must contain exactly one etag. The document is returned, if it has a different revision than the given etag. Otherwise a HTTP 304 is returned. " + "description": "If graph-name is specified, then this header can be used to check whether a specific graph has changed or not. " }, { "dataType": "String", "paramType": "header", "name": "If-Match", - "description": "If the \"If-Match\" header is given, then it must contain exactly one etag. The document is returned, if it has the same revision ad the given etag. Otherwise a HTTP 412 is returned. As an alternative you can supply the etag in an attribute rev in the URL. " + "description": "If graph-name is specified, then this header can be used to check whether a specific graph has changed or not. " } ], - "notes": "

Returns an object with an attribute graph containing a list of all graph properties.

", - "summary": "get graph properties", + "notes": "

If graph-name is specified, returns an object with an attribute graph containing a JSON hash with all properties of the specified graph.

If graph-name is not specified, returns a list of graph objects.

", + "summary": "get the properties of a specific or all graphs", "httpMethod": "GET", - "examples": "get graph by name

unix> curl --dump - http://localhost:8529/_api/graph/graph\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 87264739\n\n{ \n  \"graph\" : { \n    \"_id\" : \"_graphs/graph\", \n    \"_rev\" : \"87264739\", \n    \"_key\" : \"graph\", \n    \"edges\" : \"edges\", \n    \"vertices\" : \"vertices\" \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", - "nickname": "getGraphProperties" + "examples": "get graph by name

unix> curl --dump - http://localhost:8529/_api/graph/graph\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 81384658\n\n{ \n  \"graph\" : { \n    \"_id\" : \"_graphs/graph\", \n    \"_rev\" : \"81384658\", \n    \"_key\" : \"graph\", \n    \"edges\" : \"edges\", \n    \"vertices\" : \"vertices\" \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

get all graphs

unix> curl --dump - http://localhost:8529/_api/graph\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"graphs\" : [ \n    { \n      \"_id\" : \"_graphs/graph2\", \n      \"_rev\" : \"85513426\", \n      \"_key\" : \"graph2\", \n      \"edges\" : \"edges2\", \n      \"vertices\" : \"vertices2\" \n    }, \n    { \n      \"_id\" : \"_graphs/graph1\", \n      \"_rev\" : \"83612882\", \n      \"_key\" : \"graph1\", \n      \"edges\" : \"edges1\", \n      \"vertices\" : \"vertices1\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "nickname": "getThePropertiesOfASpecificOrAllGraphs" } ], "path": "/_api/graph/{graph-name}" @@ -178,7 +178,7 @@ "notes": "Creates a vertex in a graph.

Returns an object with an attribute vertex containing a list of all vertex properties.

", "summary": "create vertex", "httpMethod": "POST", - "examples": "

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertex\n{\"_key\":\"v1\",\"optional1\":\"val1\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 92245475\n\n{ \n  \"vertex\" : { \n    \"_id\" : \"vertices/v1\", \n    \"_rev\" : \"92245475\", \n    \"_key\" : \"v1\", \n    \"optional1\" : \"val1\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", + "examples": "

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertex\n{\"_key\":\"v1\",\"optional1\":\"val1\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 90887378\n\n{ \n  \"vertex\" : { \n    \"_id\" : \"vertices/v1\", \n    \"_rev\" : \"90887378\", \n    \"_key\" : \"v1\", \n    \"optional1\" : \"val1\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", "nickname": "createVertex" } ], @@ -235,7 +235,7 @@ "notes": "Returns an object with an attribute vertex containing a list of all vertex properties.

", "summary": "get vertex", "httpMethod": "GET", - "examples": "get vertex properties by name

unix> curl --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 94801379\n\n{ \n  \"vertex\" : { \n    \"_id\" : \"vertices/v1\", \n    \"_rev\" : \"94801379\", \n    \"_key\" : \"v1\", \n    \"optional1\" : \"val1\" \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "get vertex properties by name

unix> curl --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 93508818\n\n{ \n  \"vertex\" : { \n    \"_id\" : \"vertices/v1\", \n    \"_rev\" : \"93508818\", \n    \"_key\" : \"v1\", \n    \"optional1\" : \"val1\" \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "getVertex" } ], @@ -356,7 +356,7 @@ "notes": "Replaces the vertex properties.

Returns an object with an attribute vertex containing a list of all vertex properties.

", "summary": "update vertex", "httpMethod": "PUT", - "examples": "

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":\"val2\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 101223907\n\n{ \n  \"vertex\" : { \n    \"_id\" : \"vertices/v1\", \n    \"_rev\" : \"101223907\", \n    \"_key\" : \"v1\", \n    \"optional1\" : \"val2\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", + "examples": "

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":\"val2\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 99865810\n\n{ \n  \"vertex\" : { \n    \"_id\" : \"vertices/v1\", \n    \"_rev\" : \"99865810\", \n    \"_key\" : \"v1\", \n    \"optional1\" : \"val2\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", "nickname": "updateVertex" } ], @@ -426,7 +426,7 @@ "notes": "Partially updates the vertex properties.

Setting an attribute value to null in the patch document will cause a value of null be saved for the attribute by default. If the intention is to delete existing attributes with the patch command, the URL parameter keepNull can be used with a value of false. This will modify the behavior of the patch command to remove any attributes from the existing document that are contained in the patch document with an attribute value of null. Returns an object with an attribute vertex containing a list of all vertex properties.

", "summary": "update vertex", "httpMethod": "PATCH", - "examples": "

unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":\"vertexPatch\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 104369635\n\n{ \n  \"vertex\" : { \n    \"_id\" : \"vertices/v1\", \n    \"_rev\" : \"104369635\", \n    \"_key\" : \"v1\", \n    \"optional1\" : \"vertexPatch\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":null}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 104893923\n\n{ \n  \"vertex\" : { \n    \"_id\" : \"vertices/v1\", \n    \"_rev\" : \"104893923\", \n    \"_key\" : \"v1\", \n    \"optional1\" : null \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", + "examples": "

unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":\"vertexPatch\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 103011538\n\n{ \n  \"vertex\" : { \n    \"_id\" : \"vertices/v1\", \n    \"_rev\" : \"103011538\", \n    \"_key\" : \"v1\", \n    \"optional1\" : \"vertexPatch\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":null}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 103535826\n\n{ \n  \"vertex\" : { \n    \"_id\" : \"vertices/v1\", \n    \"_rev\" : \"103535826\", \n    \"_key\" : \"v1\", \n    \"optional1\" : null \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", "nickname": "updateVertex" } ], @@ -460,7 +460,7 @@ "notes": "Returns a cursor.

The call expects a JSON hash array as body to filter the result:

- batchSize: the batch size of the returned cursor- limit: limit the result size- count: return the total number of results (default \"false\")- filter: a optional filter

The attributes of filter - properties: filter by an array of vertex properties

The attributes of a property filter - key: filter the result vertices by a key value pair- value: the value of the key- compare: a compare operator

", "summary": "get vertices", "httpMethod": "POST", - "examples": "Select all vertices

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices\n{\"batchSize\":100}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"vertices/v5\", \n      \"_rev\" : \"108826083\", \n      \"_key\" : \"v5\", \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"vertices/v4\", \n      \"_rev\" : \"108498403\", \n      \"_key\" : \"v4\", \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"vertices/v1\", \n      \"_rev\" : \"107449827\", \n      \"_key\" : \"v1\", \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"vertices/v3\", \n      \"_rev\" : \"108170723\", \n      \"_key\" : \"v3\", \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"vertices/v2\", \n      \"_rev\" : \"107843043\", \n      \"_key\" : \"v2\", \n      \"optional1\" : \"val1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Select all vertices

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices\n{\"batchSize\":100}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"vertices/v5\", \n      \"_rev\" : \"107467986\", \n      \"_key\" : \"v5\", \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"vertices/v4\", \n      \"_rev\" : \"107140306\", \n      \"_key\" : \"v4\", \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"vertices/v1\", \n      \"_rev\" : \"106157266\", \n      \"_key\" : \"v1\", \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"vertices/v3\", \n      \"_rev\" : \"106812626\", \n      \"_key\" : \"v3\", \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"vertices/v2\", \n      \"_rev\" : \"106484946\", \n      \"_key\" : \"v2\", \n      \"optional1\" : \"val1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "getVertices" } ], @@ -494,7 +494,7 @@ "notes": "Returns a cursor.

The call expects a JSON hash array as body to filter the result:

- batchSize: the batch size of the returned cursor- limit: limit the result size- count: return the total number of results (default \"false\")- filter: a optional filter

The attributes of filter - direction: Filter for inbound (value \"in\") or outbound (value \"out\") neighbors. Default value is \"any\". - labels: filter by an array of edge labels (empty array means no restriction)- properties: filter neighbors by an array of edge properties

The attributes of a property filter - key: filter the result vertices by a key value pair- value: the value of the key- compare: a compare operator

", "summary": "get vertices", "httpMethod": "POST", - "examples": "Select all vertices

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices/v2\n{\"batchSize\" : 100, \"filter\" : {\"direction\" : \"any\", \"properties\":[] }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"vertices/v1\", \n      \"_rev\" : \"111513059\", \n      \"_key\" : \"v1\", \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"vertices/v4\", \n      \"_rev\" : \"112561635\", \n      \"_key\" : \"v4\", \n      \"optional1\" : \"val1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

Select vertices by direction and property filter

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices/v2\n{\"batchSize\" : 100, \"filter\" : {\"direction\" : \"out\", \"properties\":[ { \"key\": \"optional1\", \"value\": \"val2\", \"compare\" : \"==\" }, ] }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"vertices/v4\", \n      \"_rev\" : \"119442915\", \n      \"_key\" : \"v4\", \n      \"optional1\" : \"val2\" \n    }, \n    { \n      \"_id\" : \"vertices/v1\", \n      \"_rev\" : \"118459875\", \n      \"_key\" : \"v1\", \n      \"optional1\" : \"val1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Select all vertices

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices/v2\n{\"batchSize\" : 100, \"filter\" : {\"direction\" : \"any\", \"properties\":[] }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"vertices/v1\", \n      \"_rev\" : \"110154962\", \n      \"_key\" : \"v1\", \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"vertices/v4\", \n      \"_rev\" : \"111203538\", \n      \"_key\" : \"v4\", \n      \"optional1\" : \"val1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

Select vertices by direction and property filter

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices/v2\n{\"batchSize\" : 100, \"filter\" : {\"direction\" : \"out\", \"properties\":[ { \"key\": \"optional1\", \"value\": \"val2\", \"compare\" : \"==\" }, ] }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"vertices/v4\", \n      \"_rev\" : \"118084818\", \n      \"_key\" : \"v4\", \n      \"optional1\" : \"val2\" \n    }, \n    { \n      \"_id\" : \"vertices/v1\", \n      \"_rev\" : \"117101778\", \n      \"_key\" : \"v1\", \n      \"optional1\" : \"val1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "getVertices" } ], @@ -538,7 +538,7 @@ "notes": "Creates an edge in a graph.

The call expects a JSON hash array as body with the edge properties:

- _key: The name of the edge.- _from: The name of the from vertex.- _to: The name of the to vertex.- $label: A label for the edge (optional).- further optional attributes.

Returns an object with an attribute edge containing the list of all edge properties.

", "summary": "create edge", "httpMethod": "POST", - "examples": "

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edge\n{\"_key\":\"edge1\",\"_from\":\"vert2\",\"_to\":\"vert1\",\"optional1\":\"val1\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 126389731\n\n{ \n  \"edge\" : { \n    \"_id\" : \"edges/edge1\", \n    \"_rev\" : \"126389731\", \n    \"_key\" : \"edge1\", \n    \"_from\" : \"vertices/vert2\", \n    \"_to\" : \"vertices/vert1\", \n    \"$label\" : null, \n    \"optional1\" : \"val1\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", + "examples": "

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edge\n{\"_key\":\"edge1\",\"_from\":\"vert2\",\"_to\":\"vert1\",\"optional1\":\"val1\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 125031634\n\n{ \n  \"edge\" : { \n    \"_id\" : \"edges/edge1\", \n    \"_rev\" : \"125031634\", \n    \"_key\" : \"edge1\", \n    \"_from\" : \"vertices/vert2\", \n    \"_to\" : \"vertices/vert1\", \n    \"$label\" : null, \n    \"optional1\" : \"val1\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", "nickname": "createEdge" } ], @@ -595,7 +595,7 @@ "notes": "Returns an object with an attribute edge containing a list of all edge properties.

", "summary": "get edge", "httpMethod": "GET", - "examples": "

unix> curl --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 130059747\n\n{ \n  \"edge\" : { \n    \"_id\" : \"edges/edge1\", \n    \"_rev\" : \"130059747\", \n    \"_key\" : \"edge1\", \n    \"_from\" : \"vertices/vert1\", \n    \"_to\" : \"vertices/vert2\", \n    \"$label\" : null, \n    \"optional1\" : \"val1\" \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 128701650\n\n{ \n  \"edge\" : { \n    \"_id\" : \"edges/edge1\", \n    \"_rev\" : \"128701650\", \n    \"_key\" : \"edge1\", \n    \"_from\" : \"vertices/vert1\", \n    \"_to\" : \"vertices/vert2\", \n    \"$label\" : null, \n    \"optional1\" : \"val1\" \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "getEdge" } ], @@ -716,7 +716,7 @@ "notes": "Replaces the optional edge properties.

The call expects a JSON hash array as body with the new edge properties.

Returns an object with an attribute edge containing a list of all edge properties.

", "summary": "update edge", "httpMethod": "PUT", - "examples": "

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n{\"optional1\":\"val2\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 138448355\n\n{ \n  \"edge\" : { \n    \"_id\" : \"edges/edge1\", \n    \"_rev\" : \"138448355\", \n    \"_key\" : \"edge1\", \n    \"_from\" : \"vertices/vert1\", \n    \"_to\" : \"vertices/vert2\", \n    \"$label\" : null, \n    \"optional1\" : \"val2\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", + "examples": "

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n{\"optional1\":\"val2\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 137090258\n\n{ \n  \"edge\" : { \n    \"_id\" : \"edges/edge1\", \n    \"_rev\" : \"137090258\", \n    \"_key\" : \"edge1\", \n    \"_from\" : \"vertices/vert1\", \n    \"_to\" : \"vertices/vert2\", \n    \"$label\" : null, \n    \"optional1\" : \"val2\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", "nickname": "updateEdge" } ], @@ -786,7 +786,7 @@ "notes": "Partially updates the edge properties.

Setting an attribute value to null in the patch document will cause a value of null be saved for the attribute by default. If the intention is to delete existing attributes with the patch command, the URL parameter keepNull can be used with a value of false. This will modify the behavior of the patch command to remove any attributes from the existing document that are contained in the patch document with an attribute value of null.

Returns an object with an attribute edge containing a list of all edge properties.

", "summary": "update edge", "httpMethod": "PATCH", - "examples": "

unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n{\"optional3\":\"val3\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 142708195\n\n{ \n  \"edge\" : { \n    \"_id\" : \"edges/edge1\", \n    \"_rev\" : \"142708195\", \n    \"_key\" : \"edge1\", \n    \"_from\" : \"vertices/vert1\", \n    \"_to\" : \"vertices/vert2\", \n    \"$label\" : null, \n    \"optional1\" : \"val1\", \n    \"optional3\" : \"val3\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", + "examples": "

unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n{\"optional3\":\"val3\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 141350098\n\n{ \n  \"edge\" : { \n    \"_id\" : \"edges/edge1\", \n    \"_rev\" : \"141350098\", \n    \"_key\" : \"edge1\", \n    \"_from\" : \"vertices/vert1\", \n    \"_to\" : \"vertices/vert2\", \n    \"$label\" : null, \n    \"optional1\" : \"val1\", \n    \"optional3\" : \"val3\" \n  }, \n  \"error\" : false, \n  \"code\" : 202 \n}\n\n

", "nickname": "updateEdge" } ], @@ -820,7 +820,7 @@ "notes": "Returns a cursor.

The call expects a JSON hash array as body to filter the result:

- batchSize: the batch size of the returned cursor- limit: limit the result size- count: return the total number of results (default \"false\")- filter: a optional filter

The attributes of filter - labels: filter by an array of edge labels- properties: filter by an array of edge properties

The attributes of a property filter - key: filter the result edges by a key value pair- value: the value of the key- compare: a compare operator

", "summary": "get edges", "httpMethod": "POST", - "examples": "Select all edges

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edges\n{\"batchSize\":100}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"edges/edge4\", \n      \"_rev\" : \"149196259\", \n      \"_key\" : \"edge4\", \n      \"_from\" : \"vertices/v1\", \n      \"_to\" : \"vertices/v5\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"edges/edge1\", \n      \"_rev\" : \"147426787\", \n      \"_key\" : \"edge1\", \n      \"_from\" : \"vertices/v1\", \n      \"_to\" : \"vertices/v2\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"edges/edge2\", \n      \"_rev\" : \"148016611\", \n      \"_key\" : \"edge2\", \n      \"_from\" : \"vertices/v1\", \n      \"_to\" : \"vertices/v3\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"edges/edge3\", \n      \"_rev\" : \"148606435\", \n      \"_key\" : \"edge3\", \n      \"_from\" : \"vertices/v2\", \n      \"_to\" : \"vertices/v4\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Select all edges

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edges\n{\"batchSize\":100}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"edges/edge4\", \n      \"_rev\" : \"147838162\", \n      \"_key\" : \"edge4\", \n      \"_from\" : \"vertices/v1\", \n      \"_to\" : \"vertices/v5\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"edges/edge1\", \n      \"_rev\" : \"146068690\", \n      \"_key\" : \"edge1\", \n      \"_from\" : \"vertices/v1\", \n      \"_to\" : \"vertices/v2\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"edges/edge2\", \n      \"_rev\" : \"146658514\", \n      \"_key\" : \"edge2\", \n      \"_from\" : \"vertices/v1\", \n      \"_to\" : \"vertices/v3\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"edges/edge3\", \n      \"_rev\" : \"147248338\", \n      \"_key\" : \"edge3\", \n      \"_from\" : \"vertices/v2\", \n      \"_to\" : \"vertices/v4\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "getEdges" } ], @@ -861,7 +861,7 @@ "notes": "

Returns a cursor.

The call expects a JSON hash array as body to filter the result:

- batchSize: the batch size of the returned cursor- limit: limit the result size- count: return the total number of results (default \"false\")- filter: a optional filter

The attributes of filter - direction: Filter for inbound (value \"in\") or outbound (value \"out\") neighbors. Default value is \"any\". - labels: filter by an array of edge labels- properties: filter neighbors by an array of properties

The attributes of a property filter - key: filter the result vertices by a key value pair- value: the value of the key- compare: a compare operator

", "summary": "get edges", "httpMethod": "POST", - "examples": "Select all edges

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edges/v2\n{\"batchSize\" : 100, \"filter\" : { \"direction\" : \"any\" }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"edges/edge1\", \n      \"_rev\" : \"154045923\", \n      \"_key\" : \"edge1\", \n      \"_from\" : \"vertices/v1\", \n      \"_to\" : \"vertices/v2\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"edges/edge3\", \n      \"_rev\" : \"155225571\", \n      \"_key\" : \"edge3\", \n      \"_from\" : \"vertices/v2\", \n      \"_to\" : \"vertices/v4\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Select all edges

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edges/v2\n{\"batchSize\" : 100, \"filter\" : { \"direction\" : \"any\" }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"edges/edge1\", \n      \"_rev\" : \"152687826\", \n      \"_key\" : \"edge1\", \n      \"_from\" : \"vertices/v1\", \n      \"_to\" : \"vertices/v2\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    }, \n    { \n      \"_id\" : \"edges/edge3\", \n      \"_rev\" : \"153867474\", \n      \"_key\" : \"edge3\", \n      \"_from\" : \"vertices/v2\", \n      \"_to\" : \"vertices/v4\", \n      \"$label\" : null, \n      \"optional1\" : \"val1\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "getEdges" } ], diff --git a/html/admin/api-docs/index.json b/html/admin/api-docs/index.json index 2e152f6236..bddfc50630 100644 --- a/html/admin/api-docs/index.json +++ b/html/admin/api-docs/index.json @@ -92,7 +92,7 @@ "notes": "

Creates a cap constraint (the manual) for the collection collection-name, if it does not already exist. Expects an object containing the index details.

- type: must be equal to \"cap\".

- size: The maximal number of documents for the collection.

- byteSize: The maximal size of the active document data in the collection.

Note that the cap constraint does not index particular attributes of the documents in a collection, but limits the number of documents in the collection to a maximum value. The cap constraint thus does not support attribute names specified in the fields attribute nor uniqueness of any kind via the unique attribute.

It is allowed to specify either size or byteSize, or both at the same time. If both are specified, then the automatic document removal will be triggered by the first non-met constraint.

", "summary": "creates a cap constraint", "httpMethod": "POST", - "examples": "Creating a cap constraint

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{\"type\":\"cap\",\"size\":10}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/158698979\", \n  \"type\" : \"cap\", \n  \"unique\" : false, \n  \"size\" : 10, \n  \"byteSize\" : 0, \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Creating a cap constraint

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{\"type\":\"cap\",\"size\":10}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/157340882\", \n  \"type\" : \"cap\", \n  \"unique\" : false, \n  \"size\" : 10, \n  \"byteSize\" : 0, \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "createsACapConstraint" } ], @@ -134,7 +134,7 @@ "notes": "

Creates a geo-spatial index in the collection collection-name, if it does not already exist. Expects an object containing the index details.

- type: must be equal to \"geo\".

- fields: A list with one or two attribute paths.

If it is a list with one attribute path location, then a geo-spatial index on all documents is created using location as path to the coordinates. The value of the attribute must be a list with at least two double values. The list must contain the latitude (first value) and the longitude (second value). All documents, which do not have the attribute path or with value that are not suitable, are ignored.

If it is a list with two attribute paths latitude and longitude, then a geo-spatial index on all documents is created using latitude and longitude as paths the latitude and the longitude. The value of the attribute latitude and of the attribute longitude must a double. All documents, which do not have the attribute paths or which values are not suitable, are ignored.

- geoJson: If a geo-spatial index on a location is constructed and geoJson is true, then the order within the list is longitude followed by latitude. This corresponds to the format described in http://geojson.org/geojson-spec.html#positions

- constraint: If constraint is true, then a geo-spatial constraint is created. The constraint is a non-unique variant of the index. Note that it is also possible to set the unique attribute instead of the constraint attribute.

- ignoreNull: If a geo-spatial constraint is created and ignoreNull is true, then documents with a null in location or at least one null in latitude or longitude are ignored.

", "summary": "creates a geo-spatial index", "httpMethod": "POST", - "examples": "Creating a geo index with a location attribute:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"geo\", \"fields\" : [ \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/159550947\", \n  \"type\" : \"geo1\", \n  \"unique\" : false, \n  \"geoJson\" : false, \n  \"constraint\" : false, \n  \"fields\" : [ \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

Creating a geo index with latitude and longitude attributes:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"geo\", \"fields\" : [ \"e\", \"f\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/160402915\", \n  \"type\" : \"geo2\", \n  \"unique\" : false, \n  \"constraint\" : false, \n  \"fields\" : [ \n    \"e\", \n    \"f\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Creating a geo index with a location attribute:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"geo\", \"fields\" : [ \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/158127314\", \n  \"type\" : \"geo1\", \n  \"unique\" : false, \n  \"geoJson\" : false, \n  \"constraint\" : false, \n  \"fields\" : [ \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

Creating a geo index with latitude and longitude attributes:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"geo\", \"fields\" : [ \"e\", \"f\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/159044818\", \n  \"type\" : \"geo2\", \n  \"unique\" : false, \n  \"constraint\" : false, \n  \"fields\" : [ \n    \"e\", \n    \"f\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "createsAGeo-spatialIndex" } ], @@ -180,7 +180,7 @@ "notes": "

Creates a hash index for the collection collection-name, if it does not already exist. The call expects an object containing the index details.

- type: must be equal to \"hash\".

- fields: A list of attribute paths.

- unique: If true, then create a unique index.

", "summary": "creates a hash index", "httpMethod": "POST", - "examples": "Creating an unique constraint:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"hash\", \"unique\" : true, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/161320419\", \n  \"type\" : \"hash\", \n  \"unique\" : true, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

Creating a hash index:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"hash\", \"unique\" : false, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/162172387\", \n  \"type\" : \"hash\", \n  \"unique\" : false, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Creating an unique constraint:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"hash\", \"unique\" : true, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/159896786\", \n  \"type\" : \"hash\", \n  \"unique\" : true, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

Creating a hash index:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"hash\", \"unique\" : false, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/160814290\", \n  \"type\" : \"hash\", \n  \"unique\" : false, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "createsAHashIndex" } ], @@ -226,7 +226,7 @@ "notes": "

Creates a skip-list index for the collection collection-name, if it does not already exist. The call expects an object containing the index details.

- type: must be equal to \"skiplist\".

- fields: A list of attribute paths.

- unique: If true, then create a unique index.

", "summary": "creates a skip list", "httpMethod": "POST", - "examples": "Creating a skiplist:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"skiplist\", \"unique\" : false, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/163089891\", \n  \"type\" : \"skiplist\", \n  \"unique\" : false, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Creating a skiplist:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"skiplist\", \"unique\" : false, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/161666258\", \n  \"type\" : \"skiplist\", \n  \"unique\" : false, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "createsASkipList" } ], @@ -268,7 +268,7 @@ "notes": "

Creates a fulltext index for the collection collection-name, if it does not already exist. The call expects an object containing the index details.

- type: must be equal to \"fulltext\".

- fields: A list of attribute names. Currently, the list is limited to exactly one attribute, so the value of fields should look like this for example: [ \"text\" ].

- minLength: Minimum character length of words to index. Will default to a server-defined value if unspecified. It is thus recommended to set this value explicitly when creating the index.

", "summary": "creates a fulltext index", "httpMethod": "POST", - "examples": "Creating a fulltext index:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\" : \"fulltext\", \"fields\" : [ \"text\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/163876323\", \n  \"type\" : \"fulltext\", \n  \"unique\" : false, \n  \"minLength\" : 2, \n  \"fields\" : [ \n    \"text\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Creating a fulltext index:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\" : \"fulltext\", \"fields\" : [ \"text\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/162518226\", \n  \"type\" : \"fulltext\", \n  \"unique\" : false, \n  \"minLength\" : 2, \n  \"fields\" : [ \n    \"text\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "createsAFulltextIndex" } ], @@ -310,7 +310,7 @@ "notes": "

Creates a bitarray index for the collection collection-name, if it does not already exist. The call expects an object containing the index details.

- type: must be equal to \"bitarray\".

- fields: A list of pairs. A pair consists of an attribute path followed by a list of values.

- unique: Must always be set to false.

", "summary": "creates a bitarray index", "httpMethod": "POST", - "examples": "Creating a bitarray index:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\" : \"bitarray\", \"unique\" : false, \"fields\" : [ \"x\", [0,1,[]], \"y\", [\"a\",\"b\",[]] ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/164793827\", \n  \"type\" : \"bitarray\", \n  \"unique\" : false, \n  \"fields\" : [ \n    [ \n      \"x\", \n      [ \n        0, \n        1, \n        [ ] \n      ] \n    ], \n    [ \n      \"y\", \n      [ \n        \"a\", \n        \"b\", \n        [ ] \n      ] \n    ] \n  ], \n  \"undefined\" : false, \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Creating a bitarray index:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\" : \"bitarray\", \"unique\" : false, \"fields\" : [ \"x\", [0,1,[]], \"y\", [\"a\",\"b\",[]] ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/163370194\", \n  \"type\" : \"bitarray\", \n  \"unique\" : false, \n  \"fields\" : [ \n    [ \n      \"x\", \n      [ \n        0, \n        1, \n        [ ] \n      ] \n    ], \n    [ \n      \"y\", \n      [ \n        \"a\", \n        \"b\", \n        [ ] \n      ] \n    ] \n  ], \n  \"undefined\" : false, \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "createsABitarrayIndex" } ], @@ -375,7 +375,7 @@ "notes": "

Deletes an index with index-handle.

", "summary": "deletes an index", "httpMethod": "DELETE", - "examples": "

unix> curl -X DELETE --dump - http://localhost:8529/_api/index/products/165645795\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/165645795\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl -X DELETE --dump - http://localhost:8529/_api/index/products/164287698\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/164287698\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "deletesAnIndex" } ], diff --git a/html/admin/api-docs/query.json b/html/admin/api-docs/query.json index c1800fcc47..4de5a0e2a9 100644 --- a/html/admin/api-docs/query.json +++ b/html/admin/api-docs/query.json @@ -28,7 +28,7 @@ "notes": "

To validate a query string without executing it, the query string can be passed to the server via an HTTP POST request.

These query string needs to be passed in the attribute query of a JSON object as the body of the POST request.

", "summary": "parses a query", "httpMethod": "POST", - "examples": "Valid query:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/query\n{ \"query\" : \"FOR p IN products FILTER p.name == @name LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"bindVars\" : [ \n    \"name\" \n  ], \n  \"collections\" : [ \n    \"products\" \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Invalid query:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/query\n{ \"query\" : \"FOR p IN products FILTER p.name = @name LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 400, \n  \"errorNum\" : 1501, \n  \"errorMessage\" : \"syntax error, unexpected assignment near '= @name LIMIT 2 RETURN p.n' at position 1:33\" \n}\n\n

", + "examples": "Valid query:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/query\n{ \"query\" : \"FOR p IN products FILTER p.name == @name LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"bindVars\" : [ \n    \"name\" \n  ], \n  \"collections\" : [ \n    \"products\" \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Invalid query:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/query\n{ \"query\" : \"FOR p IN products FILTER p.name = @name LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 400, \n  \"errorNum\" : 1501, \n  \"errorMessage\" : \"syntax error, unexpected assignment near '= @name LIMIT 2 RETURN p.n' at positio...\" \n}\n\n

", "nickname": "parsesAQuery" } ], diff --git a/html/admin/api-docs/replication.json b/html/admin/api-docs/replication.json index f6cdf52771..545fd7be49 100644 --- a/html/admin/api-docs/replication.json +++ b/html/admin/api-docs/replication.json @@ -78,7 +78,7 @@ "notes": "Returns the current state of the server's replication logger. The state will include information about whether the logger is running and about the last logged tick value. This tick value is important for incremental fetching of data.

The state API can be called regardless of whether the logger is currently running or not.

The body of the response contains a JSON object with the following attributes:

- state: the current logger state as a JSON hash array with the following sub-attributes:

- running: whether or not the logger is running

- lastLogTick: the tick value of the latest tick the logger has logged. This value can be used for incremental fetching of log data.

- time: the current date and time on the logger server

- server: a JSON hash with the following sub-attributes:

- version: the logger server's version

- serverId: the logger server's id

- clients: a list of all replication clients that ever connected to the logger since it was started. This list can be used to determine approximately how much data the individual clients have already fetched from the logger server.

", "summary": "returns the replication logger state", "httpMethod": "GET", - "examples": "Returns the state of an inactive replication logger.

unix> curl --dump - http://localhost:8529/_api/replication/logger-state\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"state\" : { \n    \"running\" : false, \n    \"lastLogTick\" : \"318868963\", \n    \"time\" : \"2013-07-25T12:11:28Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"1.4.devel\", \n    \"serverId\" : \"4979095191664\" \n  }, \n  \"clients\" : [ ] \n}\n\n

Returns the state of an active replication logger.

unix> curl --dump - http://localhost:8529/_api/replication/logger-state\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"state\" : { \n    \"running\" : true, \n    \"lastLogTick\" : \"319065571\", \n    \"time\" : \"2013-07-25T12:11:28Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"1.4.devel\", \n    \"serverId\" : \"4979095191664\" \n  }, \n  \"clients\" : [ ] \n}\n\n

", + "examples": "Returns the state of an inactive replication logger.

unix> curl --dump - http://localhost:8529/_api/replication/logger-state\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"state\" : { \n    \"running\" : false, \n    \"lastLogTick\" : \"317707474\", \n    \"time\" : \"2013-07-25T14:35:20Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"1.4.devel\", \n    \"serverId\" : \"126961789421778\" \n  }, \n  \"clients\" : [ ] \n}\n\n

Returns the state of an active replication logger.

unix> curl --dump - http://localhost:8529/_api/replication/logger-state\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"state\" : { \n    \"running\" : true, \n    \"lastLogTick\" : \"317904082\", \n    \"time\" : \"2013-07-25T14:35:20Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"1.4.devel\", \n    \"serverId\" : \"126961789421778\" \n  }, \n  \"clients\" : [ ] \n}\n\n

", "nickname": "returnsTheReplicationLoggerState" } ], @@ -132,7 +132,7 @@ "notes": "Returns data from the server's replication log. This method can be called by replication clients after an initial synchronisation of data. The method will return all \"recent\" log entries from the logger server, and the clients can replay and apply these entries locally so they get to the same data state as the logger server.

Clients can call this method repeatedly to incrementally fetch all changes from the logger server. In this case, they should provide the from value so they will only get returned the log events since their last fetch.

When the from URL parameter is not used, the logger server will return log entries starting at the beginning of its replication log. When the from parameter is used, the logger server will only return log entries which have higher tick values than the specified from value (note: the log entry with a tick value equal to from will be excluded). Use the from value when incrementally fetching log data.

The to URL parameter can be used to optionally restrict the upper bound of the result to a certain tick value. If used, the result will contain only log events with tick values up to (including) to. In incremental fetching, there is no need to use the to parameter. It only makes sense in special situations, when only parts of the change log are required.

The chunkSize URL parameter can be used to control the size of the result. It must be specified in bytes. The chunkSize value will only be honored approximately. Otherwise a too low chunkSize value could cause the server to not be able to put just one log entry into the result and return it. Therefore, the chunkSize value will only be consulted after a log entry has been written into the result. If the result size is then bigger than chunkSize, the server will respond with as many log entries as there are in the response already. If the result size is still smaller than chunkSize, the server will try to return more data if there's more data left to return.

If chunkSize is not specified, some server-side default value will be used.

The Content-Type of the result is application/x-arango-dump. This is an easy-to-process format, with all log events going onto separate lines in the response body. Each log event itself is a JSON hash, with at least the following attributes:

- tick: the log event tick value

- type: the log event type

Individual log events will also have additional attributes, depending on the event type. A few common attributes which are used for multiple events types are:

- cid: id of the collection the event was for

- tid: id of the transaction the event was contained in

- key: document key

- rev: document revision id

- data: the original document data

A more detailed description of the individual replication event types and their data structures can be found in the manual.

The response will also contain the following HTTP headers:

- x-arango-replication-active: whether or not the logger is active. Clients can use this flag as an indication for their polling frequency. If the logger is not active and there are no more replication events available, it might be sensible for a client to abort, or to go to sleep for a long time and try again later to check whether the logger has been activated.

- x-arango-replication-lastincluded: the tick value of the last included value in the result. In incremental log fetching, this value can be used as the from value for the following request. Note that if the result is empty, the value will be 0. This value should not be used as from value by clients in the next request (otherwise the server would return the log events from the start of the log again).

- x-arango-replication-lasttick: the last tick value the logger server has logged (not necessarily included in the result). By comparing the the last tick and last included tick values, clients have an approximate indication of how many events there are still left to fetch.

- x-arango-replication-checkmore: whether or not there already exists more log data which the client could fetch immediately. If there is more log data available, the client could call logger-follow again with an adjusted from value to fetch remaining log entries until there are no more.

If there isn't any more log data to fetch, the client might decide to go to sleep for a while before calling the logger again.

", "summary": "returns recent log entries from the replication log", "httpMethod": "GET", - "examples": "No log events available:

unix> curl --dump - http://localhost:8529/_api/replication/logger-follow?from=319393251\n\nHTTP/1.1 204 No Content\ncontent-type: application/x-arango-dump; charset=utf-8\nx-arango-replication-active: true\nx-arango-replication-checkmore: false\nx-arango-replication-lastincluded: 0\nx-arango-replication-lasttick: 319393251\n\n

A few log events:

unix> curl --dump - http://localhost:8529/_api/replication/logger-follow?from=319720931\n\nHTTP/1.1 200 OK\ncontent-type: application/x-arango-dump; charset=utf-8\nx-arango-replication-active: true\nx-arango-replication-checkmore: false\nx-arango-replication-lastincluded: 322276835\nx-arango-replication-lasttick: 322276835\n\n{\"tick\":\"320507363\",\"type\":2000,\"cid\":\"319786467\",\"collection\":{\"version\":4,\"type\":2,\"cid\":\"319786467\",\"deleted\":false,\"doCompact\":true,\"maximalSize\":1048576,\"name\":\"products\",\"isVolatile\":false,\"waitForSync\":false}}\n{\"tick\":\"321031651\",\"type\":2300,\"cid\":\"319786467\",\"key\":\"p1\",\"rev\":\"320769507\",\"data\":{\"_key\":\"p1\",\"_rev\":\"320769507\",\"name\":\"flux compensator\"}}\n{\"tick\":\"321490403\",\"type\":2300,\"cid\":\"319786467\",\"key\":\"p2\",\"rev\":\"321293795\",\"data\":{\"_key\":\"p2\",\"_rev\":\"321293795\",\"hp\":5100,\"name\":\"hybrid hovercraft\"}}\n{\"tick\":\"321818083\",\"type\":2302,\"cid\":\"319786467\",\"key\":\"p1\",\"rev\":\"321621475\",\"oldRev\":\"320769507\"}\n{\"tick\":\"322145763\",\"type\":2300,\"cid\":\"319786467\",\"key\":\"p2\",\"rev\":\"321949155\",\"oldRev\":\"321293795\",\"data\":{\"_key\":\"p2\",\"_rev\":\"321949155\",\"hp\":5100,\"name\":\"broken hovercraft\"}}\n{\"tick\":\"322276835\",\"type\":2001,\"cid\":\"319786467\"}\n\n\n

More events than would fit into the response:

unix> curl --dump - http://localhost:8529/_api/replication/logger-follow?from=322604515&chunkSize=400\n\nHTTP/1.1 200 OK\ncontent-type: application/x-arango-dump; charset=utf-8\nx-arango-replication-active: true\nx-arango-replication-checkmore: true\nx-arango-replication-lastincluded: 324373987\nx-arango-replication-lasttick: 325160419\n\n{\"tick\":\"323390947\",\"type\":2000,\"cid\":\"322670051\",\"collection\":{\"version\":4,\"type\":2,\"cid\":\"322670051\",\"deleted\":false,\"doCompact\":true,\"maximalSize\":1048576,\"name\":\"products\",\"isVolatile\":false,\"waitForSync\":false}}\n{\"tick\":\"323915235\",\"type\":2300,\"cid\":\"322670051\",\"key\":\"p1\",\"rev\":\"323653091\",\"data\":{\"_key\":\"p1\",\"_rev\":\"323653091\",\"name\":\"flux compensator\"}}\n{\"tick\":\"324373987\",\"type\":2300,\"cid\":\"322670051\",\"key\":\"p2\",\"rev\":\"324177379\",\"data\":{\"_key\":\"p2\",\"_rev\":\"324177379\",\"hp\":5100,\"name\":\"hybrid hovercraft\"}}\n\n\n

", + "examples": "No log events available:

unix> curl --dump - http://localhost:8529/_api/replication/logger-follow?from=318231762\n\nHTTP/1.1 204 No Content\ncontent-type: application/x-arango-dump; charset=utf-8\nx-arango-replication-active: true\nx-arango-replication-checkmore: false\nx-arango-replication-lastincluded: 0\nx-arango-replication-lasttick: 318231762\n\n

A few log events:

unix> curl --dump - http://localhost:8529/_api/replication/logger-follow?from=318559442\n\nHTTP/1.1 200 OK\ncontent-type: application/x-arango-dump; charset=utf-8\nx-arango-replication-active: true\nx-arango-replication-checkmore: false\nx-arango-replication-lastincluded: 321115346\nx-arango-replication-lasttick: 321115346\n\n{\"tick\":\"319345874\",\"type\":2000,\"cid\":\"318624978\",\"collection\":{\"version\":4,\"type\":2,\"cid\":\"318624978\",\"deleted\":false,\"doCompact\":true,\"maximalSize\":1048576,\"name\":\"products\",\"isVolatile\":false,\"waitForSync\":false}}\n{\"tick\":\"319870162\",\"type\":2300,\"cid\":\"318624978\",\"key\":\"p1\",\"rev\":\"319608018\",\"data\":{\"_key\":\"p1\",\"_rev\":\"319608018\",\"name\":\"flux compensator\"}}\n{\"tick\":\"320328914\",\"type\":2300,\"cid\":\"318624978\",\"key\":\"p2\",\"rev\":\"320132306\",\"data\":{\"_key\":\"p2\",\"_rev\":\"320132306\",\"hp\":5100,\"name\":\"hybrid hovercraft\"}}\n{\"tick\":\"320656594\",\"type\":2302,\"cid\":\"318624978\",\"key\":\"p1\",\"rev\":\"320459986\",\"oldRev\":\"319608018\"}\n{\"tick\":\"320984274\",\"type\":2300,\"cid\":\"318624978\",\"key\":\"p2\",\"rev\":\"320787666\",\"oldRev\":\"320132306\",\"data\":{\"_key\":\"p2\",\"_rev\":\"320787666\",\"hp\":5100,\"name\":\"broken hovercraft\"}}\n{\"tick\":\"321115346\",\"type\":2001,\"cid\":\"318624978\"}\n\n\n

More events than would fit into the response:

unix> curl --dump - http://localhost:8529/_api/replication/logger-follow?from=321443026&chunkSize=400\n\nHTTP/1.1 200 OK\ncontent-type: application/x-arango-dump; charset=utf-8\nx-arango-replication-active: true\nx-arango-replication-checkmore: true\nx-arango-replication-lastincluded: 323212498\nx-arango-replication-lasttick: 323998930\n\n{\"tick\":\"322229458\",\"type\":2000,\"cid\":\"321508562\",\"collection\":{\"version\":4,\"type\":2,\"cid\":\"321508562\",\"deleted\":false,\"doCompact\":true,\"maximalSize\":1048576,\"name\":\"products\",\"isVolatile\":false,\"waitForSync\":false}}\n{\"tick\":\"322753746\",\"type\":2300,\"cid\":\"321508562\",\"key\":\"p1\",\"rev\":\"322491602\",\"data\":{\"_key\":\"p1\",\"_rev\":\"322491602\",\"name\":\"flux compensator\"}}\n{\"tick\":\"323212498\",\"type\":2300,\"cid\":\"321508562\",\"key\":\"p2\",\"rev\":\"323015890\",\"data\":{\"_key\":\"p2\",\"_rev\":\"323015890\",\"hp\":5100,\"name\":\"hybrid hovercraft\"}}\n\n\n

", "nickname": "returnsRecentLogEntriesFromTheReplicationLog" } ], @@ -159,7 +159,7 @@ "notes": "Returns the list of collections and indexes available on the server. This list can be used by replication clients to initiate an initial sync with the server.

The response will contain a JSON hash array with the collection and state attributes.

collections is a list of collections with the following sub-attributes:

- parameters: the collection properties

- indexes: a list of the indexes of a the collection. Primary indexes and edges indexes are not included in this list.

The state attribute contains the current state of the replication logger. It contains the following sub-attributes:

- running: whether or not the replication logger is currently active

- lastLogTick: the value of the last tick the replication logger has written

- time: the current time on the server

Replication clients should note the lastLogTick value returned. They can then fetch collections' data using the dump method up to the value of lastLogTick, and query the continuous replication log for log events after this tick value.

To create a full copy of the collections on the logger server, a replication client can execute these steps:

- call the /inventory API method. This returns the lastLogTick value and the list of collections and indexes from the logger server.

- for each collection returned by /inventory, create the collection locally and call /dump to stream the collection data to the client, up to the value of lastLogTick. After that, the client can create the indexes on the collections as they were reported by /inventory.

If the clients wants to continuously stream replication log events from the logger server, the following additional steps need to be carried out:

- the client should call /logger-follow initially to fetch the first batch of replication events that were logged after the client's call to /inventory.

The call to /logger-follow should use a from parameter with the value of the lastLogTick as reported by /inventory. The call to /logger-follow will return the x-arango-replication-lastincluded which will contain the last tick value included in the response.

- the client can then continuously call /logger-follow to incrementally fetch new replication events that occurred after the last transfer.

Calls should use a from parameter with the value of the x-arango-replication-lastincluded header of the previous response. If there are no more replication events, the response will be empty and clients can go to sleep for a while and try again later.

", "summary": "returns an inventory of collections and indexes", "httpMethod": "GET", - "examples": "

unix> curl --dump - http://localhost:8529/_api/replication/inventory\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"collections\" : [ \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"19303907\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"demo\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"20811235\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"animals\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    } \n  ], \n  \"state\" : { \n    \"running\" : false, \n    \"lastLogTick\" : \"325291491\", \n    \"time\" : \"2013-07-25T12:11:28Z\" \n  } \n}\n\n

With some additional indexes:

unix> curl --dump - http://localhost:8529/_api/replication/inventory\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"collections\" : [ \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"19303907\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"demo\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"20811235\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"animals\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"325357027\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"IndexedCollection1\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ \n        { \n          \"id\" : \"326077923\", \n          \"type\" : \"hash\", \n          \"unique\" : false, \n          \"fields\" : [ \n            \"name\" \n          ] \n        }, \n        { \n          \"id\" : \"326274531\", \n          \"type\" : \"skiplist\", \n          \"unique\" : true, \n          \"fields\" : [ \n            \"a\", \n            \"b\" \n          ] \n        }, \n        { \n          \"id\" : \"326340067\", \n          \"type\" : \"cap\", \n          \"unique\" : false, \n          \"size\" : 500, \n          \"byteSize\" : 0 \n        } \n      ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"326405603\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"IndexedCollection2\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ \n        { \n          \"id\" : \"327192035\", \n          \"type\" : \"fulltext\", \n          \"unique\" : false, \n          \"minLength\" : 10, \n          \"fields\" : [ \n            \"text\" \n          ] \n        }, \n        { \n          \"id\" : \"327323107\", \n          \"type\" : \"skiplist\", \n          \"unique\" : false, \n          \"fields\" : [ \n            \"a\" \n          ] \n        }, \n        { \n          \"id\" : \"327388643\", \n          \"type\" : \"cap\", \n          \"unique\" : false, \n          \"size\" : 0, \n          \"byteSize\" : 1048576 \n        } \n      ] \n    } \n  ], \n  \"state\" : { \n    \"running\" : false, \n    \"lastLogTick\" : \"325291491\", \n    \"time\" : \"2013-07-25T12:11:28Z\" \n  } \n}\n\n

", + "examples": "

unix> curl --dump - http://localhost:8529/_api/replication/inventory\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"collections\" : [ \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"13292754\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"demo\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"14800082\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"animals\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"81908946\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"vertices1\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 3, \n        \"cid\" : \"84530386\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"edges2\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    } \n  ], \n  \"state\" : { \n    \"running\" : false, \n    \"lastLogTick\" : \"324130002\", \n    \"time\" : \"2013-07-25T14:35:21Z\" \n  } \n}\n\n

With some additional indexes:

unix> curl --dump - http://localhost:8529/_api/replication/inventory\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"collections\" : [ \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"13292754\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"demo\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"14800082\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"animals\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"81908946\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"vertices1\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 3, \n        \"cid\" : \"84530386\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"edges2\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"324195538\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"IndexedCollection1\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ \n        { \n          \"id\" : \"324916434\", \n          \"type\" : \"hash\", \n          \"unique\" : false, \n          \"fields\" : [ \n            \"name\" \n          ] \n        }, \n        { \n          \"id\" : \"325113042\", \n          \"type\" : \"skiplist\", \n          \"unique\" : true, \n          \"fields\" : [ \n            \"a\", \n            \"b\" \n          ] \n        }, \n        { \n          \"id\" : \"325178578\", \n          \"type\" : \"cap\", \n          \"unique\" : false, \n          \"size\" : 500, \n          \"byteSize\" : 0 \n        } \n      ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 4, \n        \"type\" : 2, \n        \"cid\" : \"325244114\", \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"IndexedCollection2\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ \n        { \n          \"id\" : \"326030546\", \n          \"type\" : \"fulltext\", \n          \"unique\" : false, \n          \"minLength\" : 10, \n          \"fields\" : [ \n            \"text\" \n          ] \n        }, \n        { \n          \"id\" : \"326161618\", \n          \"type\" : \"skiplist\", \n          \"unique\" : false, \n          \"fields\" : [ \n            \"a\" \n          ] \n        }, \n        { \n          \"id\" : \"326227154\", \n          \"type\" : \"cap\", \n          \"unique\" : false, \n          \"size\" : 0, \n          \"byteSize\" : 1048576 \n        } \n      ] \n    } \n  ], \n  \"state\" : { \n    \"running\" : false, \n    \"lastLogTick\" : \"324130002\", \n    \"time\" : \"2013-07-25T14:35:21Z\" \n  } \n}\n\n

", "nickname": "returnsAnInventoryOfCollectionsAndIndexes" } ], @@ -181,6 +181,10 @@ "reason": "is returned when the collection could not be found. ", "code": "404" }, + { + "reason": "is returned when an invalid HTTP method is used. ", + "code": "405" + }, { "reason": "is returned if an error occurred while assembling the response. ", "code": "500" @@ -216,11 +220,162 @@ "notes": "Returns the data from the collection for the requested range.

When the from URL parameter is not used, collection events are returned from the beginning. When the from parameter is used, the result will only contain collection entries which have higher tick values than the specified from value (note: the log entry with a tick value equal to from will be excluded).

The to URL parameter can be used to optionally restrict the upper bound of the result to a certain tick value. If used, the result will only contain collection entries with tick values up to (including) to.

The chunkSize URL parameter can be used to control the size of the result. It must be specified in bytes. The chunkSize value will only be honored approximately. Otherwise a too low chunkSize value could cause the server to not be able to put just one entry into the result and return it. Therefore, the chunkSize value will only be consulted after an entry has been written into the result. If the result size is then bigger than chunkSize, the server will respond with as many entries as there are in the response already. If the result size is still smaller than chunkSize, the server will try to return more data if there's more data left to return.

If chunkSize is not specified, some server-side default value will be used.

The Content-Type of the result is application/x-arango-dump. This is an easy-to-process format, with all entries going onto separate lines in the response body.

Each line itself is a JSON hash, with at least the following attributes:

- type: the type of entry. Possible values for type are:

- 2300: document insertion/update

- 2301: edge insertion/update

- 2302: document/edge deletion

- key: the key of the document/edge or the key used in the deletion operation

- rev: the revision id of the document/edge or the deletion operation

- data: the actual document/edge data for types 2300 and 2301. The full document/edge data will be returned even for updates.

A more detailed description of the different entry types and their data structures can be found in the manual.

Note: there will be no distinction between inserts and updates when calling this method.

", "summary": "returns the data of a collection", "httpMethod": "GET", - "examples": "Empty collection:

unix> curl --dump - http://localhost:8529/_api/replication/dump?collection=testCollection\n\nHTTP/1.1 204 No Content\ncontent-type: application/x-arango-dump; charset=utf-8\nx-arango-replication-checkmore: false\nx-arango-replication-lastincluded: 0\n\n

Non-empty collection:

unix> curl --dump - http://localhost:8529/_api/replication/dump?collection=testCollection\n\nHTTP/1.1 200 OK\ncontent-type: application/x-arango-dump; charset=utf-8\nx-arango-replication-checkmore: false\nx-arango-replication-lastincluded: 330599907\n\n{\"tick\":\"329223651\",\"type\":2300,\"key\":\"abcdef\",\"rev\":\"329158115\",\"data\":{\"_key\":\"abcdef\",\"_rev\":\"329158115\",\"test\":true,\"a\":\"abc\"}}\n{\"tick\":\"329616867\",\"type\":2300,\"key\":\"123456\",\"rev\":\"329551331\",\"data\":{\"_key\":\"123456\",\"_rev\":\"329551331\",\"c\":false,\"b\":1}}\n{\"tick\":\"329944547\",\"type\":2300,\"key\":\"123456\",\"rev\":\"329879011\",\"data\":{\"_key\":\"123456\",\"_rev\":\"329879011\",\"c\":false,\"b\":1,\"d\":\"additional value\"}}\n{\"tick\":\"330206691\",\"type\":2300,\"key\":\"foobar\",\"rev\":\"330141155\",\"data\":{\"_key\":\"foobar\",\"_rev\":\"330141155\"}}\n{\"tick\":\"330403299\",\"type\":2302,\"key\":\"foobar\",\"rev\":\"330337763\"}\n{\"tick\":\"330599907\",\"type\":2302,\"key\":\"abcdef\",\"rev\":\"330534371\"}\n\n\n

", + "examples": "Empty collection:

unix> curl --dump - http://localhost:8529/_api/replication/dump?collection=testCollection\n\nHTTP/1.1 204 No Content\ncontent-type: application/x-arango-dump; charset=utf-8\nx-arango-replication-checkmore: false\nx-arango-replication-lastincluded: 0\n\n

Non-empty collection:

unix> curl --dump - http://localhost:8529/_api/replication/dump?collection=testCollection\n\nHTTP/1.1 200 OK\ncontent-type: application/x-arango-dump; charset=utf-8\nx-arango-replication-checkmore: false\nx-arango-replication-lastincluded: 329438418\n\n{\"tick\":\"328062162\",\"type\":2300,\"key\":\"abcdef\",\"rev\":\"327996626\",\"data\":{\"_key\":\"abcdef\",\"_rev\":\"327996626\",\"test\":true,\"a\":\"abc\"}}\n{\"tick\":\"328455378\",\"type\":2300,\"key\":\"123456\",\"rev\":\"328389842\",\"data\":{\"_key\":\"123456\",\"_rev\":\"328389842\",\"c\":false,\"b\":1}}\n{\"tick\":\"328783058\",\"type\":2300,\"key\":\"123456\",\"rev\":\"328717522\",\"data\":{\"_key\":\"123456\",\"_rev\":\"328717522\",\"c\":false,\"b\":1,\"d\":\"additional value\"}}\n{\"tick\":\"329045202\",\"type\":2300,\"key\":\"foobar\",\"rev\":\"328979666\",\"data\":{\"_key\":\"foobar\",\"_rev\":\"328979666\"}}\n{\"tick\":\"329241810\",\"type\":2302,\"key\":\"foobar\",\"rev\":\"329176274\"}\n{\"tick\":\"329438418\",\"type\":2302,\"key\":\"abcdef\",\"rev\":\"329372882\"}\n\n\n

", "nickname": "returnsTheDataOfACollection" } ], "path": "/_api/replication/dump" + }, + { + "operations": [ + { + "errorResponses": [ + { + "reason": "is returned if the request was executed successfully. ", + "code": "200" + }, + { + "reason": "is returned when an invalid HTTP method is used. ", + "code": "405" + }, + { + "reason": "is returned if an error occurred while assembling the response. ", + "code": "500" + } + ], + "parameters": [], + "notes": "Returns the configuration of the replication applier.

The body of the response is a JSON hash with the configuration. The following attributes may be present in the configuration:

- endpoint: the logger server to connect to (e.g. \"tcp://192.168.173.13:8529\").

- username: an optional ArangoDB username to use when connecting to the endpoint.

- password: the password to use when connecting to the endpoint.

- connectTimeout: the timeout (in seconds) when connecting to the endpoint.

- requestTimeout: the timeout (in seconds) for individual requests to the endpoint.

- autoStart: whether or not to auto-start the replication applier on (next and following) server starts

- adaptivePolling: whether or not the replication applier will use adaptive polling.

", + "summary": "returns the configuration of the replication applier", + "httpMethod": "GET", + "examples": "

unix> curl --dump - http://localhost:8529/_api/replication/applier-config\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"requestTimeout\" : 300, \n  \"connectTimeout\" : 10, \n  \"ignoreErrors\" : 0, \n  \"maxConnectRetries\" : 10, \n  \"autoStart\" : false, \n  \"adaptivePolling\" : true \n}\n\n

", + "nickname": "returnsTheConfigurationOfTheReplicationApplier" + } + ], + "path": "/_api/replication/applier-config" + }, + { + "operations": [ + { + "errorResponses": [ + { + "reason": "is returned if the request was executed successfully. ", + "code": "200" + }, + { + "reason": "is returned if the configuration is incomplete or malformed, or if the replication applier is currently running. ", + "code": "400" + }, + { + "reason": "is returned when an invalid HTTP method is used. ", + "code": "405" + }, + { + "reason": "is returned if an error occurred while assembling the response. ", + "code": "500" + } + ], + "parameters": [ + { + "dataType": "Json", + "paramType": "body", + "required": "true", + "name": "configuration", + "description": "A JSON representation of the configuration. " + } + ], + "notes": "Sets the configuration of the replication applier. The configuration can only be changed while the applier is not running. The updated configuration will be saved immediately but only become active with the next start of the applier.

The body of the request must be JSON hash with the configuration. The following attributes are allowed for the configuration:

- endpoint: the logger server to connect to (e.g. \"tcp://192.168.173.13:8529\"). The endpoint must be specified.

- username: an optional ArangoDB username to use when connecting to the endpoint.

- password: the password to use when connecting to the endpoint.

- connectTimeout: the timeout (in seconds) when connecting to the endpoint.

- requestTimeout: the timeout (in seconds) for individual requests to the endpoint.

- autoStart: whether or not to auto-start the replication applier on (next and following) server starts

- adaptivePolling: if set to true, the replication applier will fall to sleep for an increasingly long period in case the logger server at the endpoint does not have any more replication events to apply. Using adaptive polling is thus useful to reduce the amount of work for both the applier and the logger server for cases when there are only infrequent changes. The downside is that when using adaptive polling, it might take longer for the replication applier to detect that there are new replication events on the logger server.

Setting adaptivePolling to false will make the replication applier contact the logger server in a constant interval, regardless of whether the logger server provides updates frequently or seldomly.

In case of success, the body of the response is a JSON hash with the updated configuration.

", + "summary": "adjusts the configuration of the replication applier", + "httpMethod": "PUT", + "examples": "

unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/replication/applier-config\n{\"endpoint\":\"tcp://127.0.0.1:8529\",\"username\":\"replicationApplier\",\"password\":\"applier1234@foxx\",\"autoStart\":false,\"adaptivePolling\":true}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"endpoint\" : \"tcp://127.0.0.1:8529\", \n  \"username\" : \"replicationApplier\", \n  \"requestTimeout\" : 300, \n  \"connectTimeout\" : 10, \n  \"ignoreErrors\" : 0, \n  \"maxConnectRetries\" : 10, \n  \"autoStart\" : false, \n  \"adaptivePolling\" : true \n}\n\n

", + "nickname": "adjustsTheConfigurationOfTheReplicationApplier" + } + ], + "path": "/_api/replication/applier-config" + }, + { + "operations": [ + { + "errorResponses": [ + { + "reason": "is returned if the request was executed successfully. ", + "code": "200" + }, + { + "reason": "is returned if the replication applier is not fully configured or the configuration is invalid. ", + "code": "400" + }, + { + "reason": "is returned when an invalid HTTP method is used. ", + "code": "405" + }, + { + "reason": "is returned if an error occurred while assembling the response. ", + "code": "500" + } + ], + "parameters": [], + "notes": "Starts the replication applier. This will return immediately if the replication applier is already running.

If the replication applier is not already running, the applier configuration will be checked, and if it is complete, the applier will be started in a background thread. This means that even if the applier will encounter any errors while running, they will not be reported in the response to this method.

To detect replication applier errors after the applier was started, use the /_api/replication/applier-state API instead.

", + "summary": "starts the replication applier", + "httpMethod": "PUT", + "examples": "

unix> curl -X PUT --dump - http://localhost:8529/_api/replication/applier-start\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"state\" : { \n    \"running\" : true, \n    \"lastAppliedContinuousTick\" : null, \n    \"lastProcessedContinuousTick\" : null, \n    \"lastAvailableContinuousTick\" : null, \n    \"lastAppliedInitialTick\" : null, \n    \"currentPhase\" : { \n      \"id\" : 1, \n      \"label\" : \"initialising\" \n    }, \n    \"progress\" : { \n      \"time\" : \"2013-07-25T14:34:48Z\", \n      \"message\" : \"applier created\" \n    }, \n    \"lastError\" : { \n    }, \n    \"time\" : \"2013-07-25T14:35:21Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"1.4.devel\", \n    \"serverId\" : \"126961789421778\" \n  }, \n  \"endpoint\" : \"tcp://127.0.0.1:8529\" \n}\n\n

", + "nickname": "startsTheReplicationApplier" + } + ], + "path": "/_api/replication/applier-start" + }, + { + "operations": [ + { + "errorResponses": [ + { + "reason": "is returned if the request was executed successfully. ", + "code": "200" + }, + { + "reason": "is returned when an invalid HTTP method is used. ", + "code": "405" + }, + { + "reason": "is returned if an error occurred while assembling the response. ", + "code": "500" + } + ], + "parameters": [], + "notes": "Stops the replication applier. This will return immediately if the replication applier is not running.

", + "summary": "stops the replication applier", + "httpMethod": "PUT", + "examples": "

unix> curl -X PUT --dump - http://localhost:8529/_api/replication/applier-stop\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"state\" : { \n    \"running\" : false, \n    \"lastAppliedContinuousTick\" : null, \n    \"lastProcessedContinuousTick\" : null, \n    \"lastAvailableContinuousTick\" : null, \n    \"lastAppliedInitialTick\" : null, \n    \"currentPhase\" : { \n      \"id\" : 0, \n      \"label\" : \"not running\" \n    }, \n    \"progress\" : { \n      \"time\" : \"2013-07-25T14:35:21Z\", \n      \"message\" : \"applier stopped\" \n    }, \n    \"lastError\" : { \n    }, \n    \"time\" : \"2013-07-25T14:35:21Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"1.4.devel\", \n    \"serverId\" : \"126961789421778\" \n  }, \n  \"endpoint\" : \"tcp://127.0.0.1:8529\" \n}\n\n

", + "nickname": "stopsTheReplicationApplier" + } + ], + "path": "/_api/replication/applier-stop" + }, + { + "operations": [ + { + "errorResponses": [ + { + "reason": "is returned if the request was executed successfully. ", + "code": "200" + }, + { + "reason": "is returned when an invalid HTTP method is used. ", + "code": "405" + }, + { + "reason": "is returned if an error occurred while assembling the response. ", + "code": "500" + } + ], + "parameters": [], + "notes": "Returns the state of the replication applier, regardless of whether the applier is currently running or not.

The response is a JSON hash with the following attributes:

- state: a JSON hash with the following sub-attributes:

- running: whether or not the applier is active and running

- lastAppliedContinuousTick: the last tick value from the continuous replication log the applier has applied.

- lastProcessedContinuousTick: the last tick value from the continuous replication log the applier has processed.

Regularly, the last applied and last processed tick values should be identical. For transactional operations, the replication applier will first process incoming log events before applying them, so the processed tick value might be higher than the applied tick value. This will be the case until the applier encounters the transaction commit log event for the transaction.

- lastAvailableContinuousTick: the last tick value the logger server can provide.

- time: the time on the applier server.

- progress: a JSON hash with details about the replication applier progress. It contains the following sub-attributes if there is progress to report:

- message: a textual description of the progress

- time: the date and time the progress was logged

- lastError: a JSON hash with details about the last error that happened on the applier. It contains the following sub-attributes if there was an error:

- errorNum: a numerical error code

- errorMessage: a textual error description

- time: the date and time the error occurred

In case no error has occurred, lastError will be empty.

- server: a JSON hash with the following sub-attributes:

- version: the applier server's version

- serverId: the applier server's id

- endpoint: the endpoint the applier is connected to (if applier is active) or will connect to (if applier is currently inactive)

", + "summary": "returns the state of the replication applier", + "httpMethod": "GET", + "examples": "Fetching the state of an inactive applier:

unix> curl --dump - http://localhost:8529/_api/replication/applier-state\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"state\" : { \n    \"running\" : false, \n    \"lastAppliedContinuousTick\" : null, \n    \"lastProcessedContinuousTick\" : null, \n    \"lastAvailableContinuousTick\" : null, \n    \"lastAppliedInitialTick\" : null, \n    \"currentPhase\" : { \n      \"id\" : 0, \n      \"label\" : \"not running\" \n    }, \n    \"progress\" : { \n      \"time\" : \"2013-07-25T14:35:21Z\", \n      \"message\" : \"applier stopped\" \n    }, \n    \"lastError\" : { \n    }, \n    \"time\" : \"2013-07-25T14:35:21Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"1.4.devel\", \n    \"serverId\" : \"126961789421778\" \n  }, \n  \"endpoint\" : \"tcp://127.0.0.1:8529\" \n}\n\n

Fetching the state of an active applier:

unix> curl --dump - http://localhost:8529/_api/replication/applier-state\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"state\" : { \n    \"running\" : true, \n    \"lastAppliedContinuousTick\" : null, \n    \"lastProcessedContinuousTick\" : null, \n    \"lastAvailableContinuousTick\" : null, \n    \"lastAppliedInitialTick\" : null, \n    \"currentPhase\" : { \n      \"id\" : 1, \n      \"label\" : \"initialising\" \n    }, \n    \"progress\" : { \n      \"time\" : \"2013-07-25T14:35:21Z\", \n      \"message\" : \"fetching master state from /_api/replication/logger-state?serverId=1269617894217...\" \n    }, \n    \"lastError\" : { \n      \"time\" : \"2013-07-25T14:35:21Z\", \n      \"errorNum\" : 1400, \n      \"errorMessage\" : \"could not connect to master at tcp://127.0.0.1:8529: Could not connect to 'tcp:/...\" \n    }, \n    \"time\" : \"2013-07-25T14:35:21Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"1.4.devel\", \n    \"serverId\" : \"126961789421778\" \n  }, \n  \"endpoint\" : \"tcp://127.0.0.1:8529\" \n}\n\n

", + "nickname": "returnsTheStateOfTheReplicationApplier" + } + ], + "path": "/_api/replication/applier-state" } ] } diff --git a/html/admin/api-docs/simple.json b/html/admin/api-docs/simple.json index 5a78f90459..b1e480ccaf 100644 --- a/html/admin/api-docs/simple.json +++ b/html/admin/api-docs/simple.json @@ -32,7 +32,7 @@ "notes": "

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

- collection: The name of the collection to query.

- skip: The number of documents to skip in the query (optional).

- limit: The maximal amount of documents to return. The skip is applied before the limit restriction. (optional)

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 @- --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/166628835\", \n      \"_rev\" : \"166628835\", \n      \"_key\" : \"166628835\", \n      \"Hello1\" : \"World1\" \n    }, \n    { \n      \"_id\" : \"products/167022051\", \n      \"_rev\" : \"167022051\", \n      \"_key\" : \"167022051\", \n      \"Hello2\" : \"World2\" \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 @- --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/170495459\", \n      \"_rev\" : \"170495459\", \n      \"_key\" : \"170495459\", \n      \"Hello5\" : \"World5\" \n    }, \n    { \n      \"_id\" : \"products/169512419\", \n      \"_rev\" : \"169512419\", \n      \"_key\" : \"169512419\", \n      \"Hello2\" : \"World2\" \n    }, \n    { \n      \"_id\" : \"products/169119203\", \n      \"_rev\" : \"169119203\", \n      \"_key\" : \"169119203\", \n      \"Hello1\" : \"World1\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"170692067\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "Limit the amount of documents using limit

unix> curl -X PUT --data @- --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/165598418\", \n      \"_rev\" : \"165598418\", \n      \"_key\" : \"165598418\", \n      \"Hello2\" : \"World2\" \n    }, \n    { \n      \"_id\" : \"products/166253778\", \n      \"_rev\" : \"166253778\", \n      \"_key\" : \"166253778\", \n      \"Hello4\" : \"World4\" \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 @- --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/168088786\", \n      \"_rev\" : \"168088786\", \n      \"_key\" : \"168088786\", \n      \"Hello2\" : \"World2\" \n    }, \n    { \n      \"_id\" : \"products/168416466\", \n      \"_rev\" : \"168416466\", \n      \"_key\" : \"168416466\", \n      \"Hello3\" : \"World3\" \n    }, \n    { \n      \"_id\" : \"products/168744146\", \n      \"_rev\" : \"168744146\", \n      \"_key\" : \"168744146\", \n      \"Hello4\" : \"World4\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"169268434\", \n  \"count\" : 5, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "executesSimpleQueryAll" } ], @@ -67,7 +67,7 @@ "notes": "

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

- collection: The identifier or name of the collection to query.

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 attrbute contains null.

", "summary": "executes simple query ANY", "httpMethod": "PUT", - "examples": "

unix> curl -X PUT --data @- --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/172658147\", \n    \"_rev\" : \"172658147\", \n    \"_key\" : \"172658147\", \n    \"Hello4\" : \"World4\" \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl -X PUT --data @- --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/170251474\", \n    \"_rev\" : \"170251474\", \n    \"_key\" : \"170251474\", \n    \"Hello1\" : \"World1\" \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "executesSimpleQueryAny" } ], @@ -102,7 +102,7 @@ "notes": "

The default will find at most 100 documents near a given coordinate. The returned list is sorted according to the distance, with the nearest document coming first. 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 hash array as body with the following attributes:

- collection: The name of the collection to query.

- latitude: The latitude of the coordinate.

- longitude: The longitude of the coordinate.

- distance: If given, the attribute key used to store the distance. (optional)

- skip: The number of documents to skip in the query. (optional)

- limit: The maximal amount of documents to return. The skip is applied before the limit restriction. The default is 100. (optional)

- geo: If given, the identifier of the geo-index to use. (optional)

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

", "summary": "executes simple query NEAR", "httpMethod": "PUT", - "examples": "Without distance:

unix> curl -X PUT --data @- --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/175476195\", \n      \"_rev\" : \"175476195\", \n      \"_key\" : \"175476195\", \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/175082979\", \n      \"_rev\" : \"175082979\", \n      \"_key\" : \"175082979\", \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 @- --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/178490851\", \n      \"_rev\" : \"178490851\", \n      \"_key\" : \"178490851\", \n      \"distance\" : 222.38985328911744, \n      \"name\" : \"Name/-0.002/\", \n      \"loc\" : [ \n        -0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/178884067\", \n      \"_rev\" : \"178884067\", \n      \"_key\" : \"178884067\", \n      \"distance\" : 222.38985328911744, \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/178294243\", \n      \"_rev\" : \"178294243\", \n      \"_key\" : \"178294243\", \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

", + "examples": "Without distance:

unix> curl -X PUT --data @- --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/174052562\", \n      \"_rev\" : \"174052562\", \n      \"_key\" : \"174052562\", \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/173659346\", \n      \"_rev\" : \"173659346\", \n      \"_key\" : \"173659346\", \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 @- --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/177067218\", \n      \"_rev\" : \"177067218\", \n      \"_key\" : \"177067218\", \n      \"distance\" : 222.38985328911744, \n      \"name\" : \"Name/-0.002/\", \n      \"loc\" : [ \n        -0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/177460434\", \n      \"_rev\" : \"177460434\", \n      \"_key\" : \"177460434\", \n      \"distance\" : 222.38985328911744, \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/176870610\", \n      \"_rev\" : \"176870610\", \n      \"_key\" : \"176870610\", \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": "executesSimpleQueryNear" } ], @@ -137,7 +137,7 @@ "notes": "

This will find all documents with in 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 hash array as body with the following attributes:

- collection: The name of the collection to query.

- latitude: The latitude of the coordinate.

- longitude: The longitude of the coordinate.

- radius: The maximal radius (in meters).

- distance: If given, the result attribute key used to store the distance values (optional). If specified, distances are returned in meters.

- skip: The documents to skip in the query. (optional)

- limit: The maximal amount of documents to return. (optional)

- geo: If given, the identifier of the geo-index to use. (optional)

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

", "summary": "executes simple query WITHIN", "httpMethod": "PUT", - "examples": "Without distance:

unix> curl -X PUT --data @- --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/182291939\", \n      \"_rev\" : \"182291939\", \n      \"_key\" : \"182291939\", \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/181898723\", \n      \"_rev\" : \"181898723\", \n      \"_key\" : \"181898723\", \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 @- --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/185306595\", \n      \"_rev\" : \"185306595\", \n      \"_key\" : \"185306595\", \n      \"distance\" : 222.38985328911744, \n      \"name\" : \"Name/-0.002/\", \n      \"loc\" : [ \n        -0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/185699811\", \n      \"_rev\" : \"185699811\", \n      \"_key\" : \"185699811\", \n      \"distance\" : 222.38985328911744, \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/185109987\", \n      \"_rev\" : \"185109987\", \n      \"_key\" : \"185109987\", \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

", + "examples": "Without distance:

unix> curl -X PUT --data @- --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/180868306\", \n      \"_rev\" : \"180868306\", \n      \"_key\" : \"180868306\", \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/180475090\", \n      \"_rev\" : \"180475090\", \n      \"_key\" : \"180475090\", \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 @- --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/183882962\", \n      \"_rev\" : \"183882962\", \n      \"_key\" : \"183882962\", \n      \"distance\" : 222.38985328911744, \n      \"name\" : \"Name/-0.002/\", \n      \"loc\" : [ \n        -0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/184276178\", \n      \"_rev\" : \"184276178\", \n      \"_key\" : \"184276178\", \n      \"distance\" : 222.38985328911744, \n      \"name\" : \"Name/0.002/\", \n      \"loc\" : [ \n        0.002, \n        0 \n      ] \n    }, \n    { \n      \"_id\" : \"products/183686354\", \n      \"_rev\" : \"183686354\", \n      \"_key\" : \"183686354\", \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": "executesSimpleQueryWithin" } ], @@ -172,7 +172,7 @@ "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 hash array as body with the following attributes:

- collection: The name of the collection to query.

- attribute: The attribute that contains the texts.

- query: The fulltext query.

- skip: The documents to skip in the query. (optional)

- limit: The maximal amount of documents to return. (optional)

- index: If given, the identifier of the fulltext-index to use. (optional)

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

", "summary": "executes simple query FULLTEXT", "httpMethod": "PUT", - "examples": "

unix> curl -X PUT --data @- --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/187731427\", \n      \"_rev\" : \"187731427\", \n      \"_key\" : \"187731427\", \n      \"text\" : \"this text contains word\" \n    }, \n    { \n      \"_id\" : \"products/187928035\", \n      \"_rev\" : \"187928035\", \n      \"_key\" : \"187928035\", \n      \"text\" : \"this text also has a word\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "

unix> curl -X PUT --data @- --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/186307794\", \n      \"_rev\" : \"186307794\", \n      \"_key\" : \"186307794\", \n      \"text\" : \"this text contains word\" \n    }, \n    { \n      \"_id\" : \"products/186504402\", \n      \"_rev\" : \"186504402\", \n      \"_key\" : \"186504402\", \n      \"text\" : \"this text also has a word\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "executesSimpleQueryFulltext" } ], @@ -207,7 +207,7 @@ "notes": "

This will find all documents matching a given example.

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

- collection: The name of the collection to query.

- example: The example.

- skip: The documents to skip in the query. (optional)

- limit: The maximal amount of documents to return. (optional)

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 @- --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/190287331\", \n      \"_rev\" : \"190287331\", \n      \"_key\" : \"190287331\", \n      \"i\" : 1 \n    }, \n    { \n      \"_id\" : \"products/189697507\", \n      \"_rev\" : \"189697507\", \n      \"_key\" : \"189697507\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 1, \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/190483939\", \n      \"_rev\" : \"190483939\", \n      \"_key\" : \"190483939\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 2, \n        \"j\" : 2 \n      } \n    }, \n    { \n      \"_id\" : \"products/190025187\", \n      \"_rev\" : \"190025187\", \n      \"_key\" : \"190025187\", \n      \"i\" : 1, \n      \"a\" : { \n        \"j\" : 1 \n      } \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 @- --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/192253411\", \n      \"_rev\" : \"192253411\", \n      \"_key\" : \"192253411\", \n      \"i\" : 1, \n      \"a\" : { \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/191925731\", \n      \"_rev\" : \"191925731\", \n      \"_key\" : \"191925731\", \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 @- --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/194481635\", \n      \"_rev\" : \"194481635\", \n      \"_key\" : \"194481635\", \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

", + "examples": "Matching an attribute:

unix> curl -X PUT --data @- --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/189060306\", \n      \"_rev\" : \"189060306\", \n      \"_key\" : \"189060306\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 2, \n        \"j\" : 2 \n      } \n    }, \n    { \n      \"_id\" : \"products/188273874\", \n      \"_rev\" : \"188273874\", \n      \"_key\" : \"188273874\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 1, \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/188863698\", \n      \"_rev\" : \"188863698\", \n      \"_key\" : \"188863698\", \n      \"i\" : 1 \n    }, \n    { \n      \"_id\" : \"products/188601554\", \n      \"_rev\" : \"188601554\", \n      \"_key\" : \"188601554\", \n      \"i\" : 1, \n      \"a\" : { \n        \"j\" : 1 \n      } \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 @- --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/190502098\", \n      \"_rev\" : \"190502098\", \n      \"_key\" : \"190502098\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 1, \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/190829778\", \n      \"_rev\" : \"190829778\", \n      \"_key\" : \"190829778\", \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\n

Matching an attribute within a sub-document:

unix> curl -X PUT --data @- --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/193058002\", \n      \"_rev\" : \"193058002\", \n      \"_key\" : \"193058002\", \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" } ], @@ -234,7 +234,7 @@ "notes": "

This will return the first document matching a given example.

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

- collection: The name of the collection to query.

- example: The example.

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

", "summary": "executes simple query first-example", "httpMethod": "PUT", - "examples": "If a matching document was found:

unix> curl -X PUT --data @- --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/196972003\", \n    \"_rev\" : \"196972003\", \n    \"_key\" : \"196972003\", \n    \"i\" : 1 \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

If no document was found:

unix> curl -X PUT --data @- --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

", + "examples": "If a matching document was found:

unix> curl -X PUT --data @- --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/194958546\", \n    \"_rev\" : \"194958546\", \n    \"_key\" : \"194958546\", \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 @- --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": "executesSimpleQueryFirst-example" } ], @@ -269,7 +269,7 @@ "notes": "

This will return the first 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 \"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.

", "summary": "executes simple query first", "httpMethod": "PUT", - "examples": "Retrieving the first n documents:

unix> curl -X PUT --data @- --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/200773091\", \n      \"_rev\" : \"200773091\", \n      \"_key\" : \"200773091\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 1, \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/201100771\", \n      \"_rev\" : \"201100771\", \n      \"_key\" : \"201100771\", \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 @- --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/202935779\", \n    \"_rev\" : \"202935779\", \n    \"_key\" : \"202935779\", \n    \"i\" : 1, \n    \"a\" : { \n      \"k\" : 1, \n      \"j\" : 1 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "Retrieving the first n documents:

unix> curl -X PUT --data @- --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/199283922\", \n      \"_rev\" : \"199283922\", \n      \"_key\" : \"199283922\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 1, \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/199677138\", \n      \"_rev\" : \"199677138\", \n      \"_key\" : \"199677138\", \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 @- --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/201446610\", \n    \"_rev\" : \"201446610\", \n    \"_key\" : \"201446610\", \n    \"i\" : 1, \n    \"a\" : { \n      \"k\" : 1, \n      \"j\" : 1 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "executesSimpleQueryFirst" } ], @@ -304,7 +304,7 @@ "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. If the count argument is not supplied, the result is the \"latest\" document of the collection, or null if the collection is empty.

", "summary": "executes simple query last", "httpMethod": "PUT", - "examples": "Retrieving the last n documents:

unix> curl -X PUT --data @- --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/205884899\", \n      \"_rev\" : \"205884899\", \n      \"_key\" : \"205884899\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 2, \n        \"j\" : 2 \n      } \n    }, \n    { \n      \"_id\" : \"products/205688291\", \n      \"_rev\" : \"205688291\", \n      \"_key\" : \"205688291\", \n      \"i\" : 1 \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Retrieving the first document:

unix> curl -X PUT --data @- --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/208047587\", \n    \"_rev\" : \"208047587\", \n    \"_key\" : \"208047587\", \n    \"i\" : 1, \n    \"a\" : { \n      \"k\" : 2, \n      \"j\" : 2 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "Retrieving the last n documents:

unix> curl -X PUT --data @- --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/204461266\", \n      \"_rev\" : \"204461266\", \n      \"_key\" : \"204461266\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 2, \n        \"j\" : 2 \n      } \n    }, \n    { \n      \"_id\" : \"products/204264658\", \n      \"_rev\" : \"204264658\", \n      \"_key\" : \"204264658\", \n      \"i\" : 1 \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Retrieving the first document:

unix> curl -X PUT --data @- --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/206623954\", \n    \"_rev\" : \"206623954\", \n    \"_key\" : \"206623954\", \n    \"i\" : 1, \n    \"a\" : { \n      \"k\" : 2, \n      \"j\" : 2 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "executesSimpleQueryLast" } ], @@ -331,7 +331,7 @@ "notes": "

This will find all documents within a given range. You must declare a skip-list index on the attribute in order to be able to use a range query.

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

- collection: The name of the collection to query.

- attribute: The attribute path to check.

- left: The lower bound.

- right: The upper bound.

- closed: If true, use interval including left and right, otherwise exclude right, but include left.

- skip: The documents to skip in the query. (optional)

- limit: The maximal amount of documents to return. (optional)

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

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

unix> curl -X PUT --data @- --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/209423843\", \n      \"_rev\" : \"209423843\", \n      \"_key\" : \"209423843\", \n      \"i\" : 2 \n    }, \n    { \n      \"_id\" : \"products/209620451\", \n      \"_rev\" : \"209620451\", \n      \"_key\" : \"209620451\", \n      \"i\" : 3 \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", + "examples": "

unix> curl -X PUT --data @- --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/208000210\", \n      \"_rev\" : \"208000210\", \n      \"_key\" : \"208000210\", \n      \"i\" : 2 \n    }, \n    { \n      \"_id\" : \"products/208196818\", \n      \"_rev\" : \"208196818\", \n      \"_key\" : \"208196818\", \n      \"i\" : 3 \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "executesSimpleRangeQuery" } ], diff --git a/html/admin/api-docs/system.json b/html/admin/api-docs/system.json index fbeadb1214..9f4e1c7ea4 100644 --- a/html/admin/api-docs/system.json +++ b/html/admin/api-docs/system.json @@ -92,7 +92,7 @@ "notes": "

Returns the statistics information. The returned object contains the statistics figures grouped together according to the description returned by _admin/statistics-description. For instance, to access a figure userTime from the group system, you first select the sub-object describing the group stored in system and in that sub-object the value for userTime is stored in the attribute of the same name.

In case of a distribution, the returned object contains the total count in count and the distribution list in counts. The sum (or total) of the individual values is returned in sum.

", "summary": "reads the statistics", "httpMethod": "GET", - "examples": "

unix> curl --dump - http://localhost:8529/_admin/statistics\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"system\" : { \n    \"minorPageFaults\" : 72614, \n    \"majorPageFaults\" : 208, \n    \"userTime\" : 7.63, \n    \"systemTime\" : 0.34, \n    \"numberOfThreads\" : 16, \n    \"residentSize\" : 39522304, \n    \"virtualSize\" : 3514204160 \n  }, \n  \"client\" : { \n    \"httpConnections\" : 1, \n    \"connectionTime\" : { \n      \"sum\" : 0.000492095947265625, \n      \"count\" : 1, \n      \"counts\" : [ \n        1, \n        0, \n        0, \n        0 \n      ] \n    }, \n    \"totalTime\" : { \n      \"sum\" : 18.698437452316284, \n      \"count\" : 741, \n      \"counts\" : [ \n        317, \n        314, \n        80, \n        28, \n        2, \n        0, \n        0 \n      ] \n    }, \n    \"requestTime\" : { \n      \"sum\" : 18.574909448623657, \n      \"count\" : 741, \n      \"counts\" : [ \n        320, \n        311, \n        80, \n        28, \n        2, \n        0, \n        0 \n      ] \n    }, \n    \"queueTime\" : { \n      \"sum\" : 0.02922201156616211, \n      \"count\" : 739, \n      \"counts\" : [ \n        739, \n        0, \n        0, \n        0, \n        0, \n        0, \n        0 \n      ] \n    }, \n    \"bytesSent\" : { \n      \"sum\" : 338888, \n      \"count\" : 741, \n      \"counts\" : [ \n        207, \n        439, \n        95, \n        0, \n        0, \n        0 \n      ] \n    }, \n    \"bytesReceived\" : { \n      \"sum\" : 132955, \n      \"count\" : 741, \n      \"counts\" : [ \n        729, \n        12, \n        0, \n        0, \n        0, \n        0 \n      ] \n    } \n  }, \n  \"server\" : { \n    \"uptime\" : 23.991722106933594 \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl --dump - http://localhost:8529/_admin/statistics\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"system\" : { \n    \"minorPageFaults\" : 315192, \n    \"majorPageFaults\" : 217, \n    \"userTime\" : 7.57, \n    \"systemTime\" : 0.7, \n    \"numberOfThreads\" : 16, \n    \"residentSize\" : 36724736, \n    \"virtualSize\" : 3520462848 \n  }, \n  \"client\" : { \n    \"httpConnections\" : 1, \n    \"connectionTime\" : { \n      \"sum\" : 0.00044417381286621094, \n      \"count\" : 1, \n      \"counts\" : [ \n        1, \n        0, \n        0, \n        0 \n      ] \n    }, \n    \"totalTime\" : { \n      \"sum\" : 20.906060695648193, \n      \"count\" : 753, \n      \"counts\" : [ \n        316, \n        317, \n        89, \n        30, \n        1, \n        0, \n        0 \n      ] \n    }, \n    \"requestTime\" : { \n      \"sum\" : 20.780781745910645, \n      \"count\" : 753, \n      \"counts\" : [ \n        318, \n        315, \n        89, \n        30, \n        1, \n        0, \n        0 \n      ] \n    }, \n    \"queueTime\" : { \n      \"sum\" : 0.03127312660217285, \n      \"count\" : 751, \n      \"counts\" : [ \n        751, \n        0, \n        0, \n        0, \n        0, \n        0, \n        0 \n      ] \n    }, \n    \"bytesSent\" : { \n      \"sum\" : 356177, \n      \"count\" : 753, \n      \"counts\" : [ \n        214, \n        443, \n        79, \n        17, \n        0, \n        0 \n      ] \n    }, \n    \"bytesReceived\" : { \n      \"sum\" : 134857, \n      \"count\" : 753, \n      \"counts\" : [ \n        741, \n        12, \n        0, \n        0, \n        0, \n        0 \n      ] \n    } \n  }, \n  \"server\" : { \n    \"uptime\" : 25.26134705543518 \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "readsTheStatistics" } ], @@ -111,7 +111,7 @@ "notes": "

Returns a description of the statistics returned by /_admin/statistics. The returned objects contains a list of statistics groups in the attribute groups and a list of statistics figures in the attribute figures.

A statistics group is described by

- group: The identifier of the group.- name: The name of the group.- description: A description of the group.

A statistics figure is described by

- group: The identifier of the group to which this figure belongs.- identifier: The identifier of the figure. It is unique within the group.- name: The name of the figure.- description: A description of the group.- type: Either current, accumulated, or distribution.- cuts: The distribution vector.- units: Units in which the figure is measured.

", "summary": "statistics description", "httpMethod": "GET", - "examples": "

unix> curl --dump - http://localhost:8529/_admin/statistics-description\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"groups\" : [ \n    { \n      \"group\" : \"system\", \n      \"name\" : \"Process Statistics\", \n      \"description\" : \"Statistics about the ArangoDB process\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"name\" : \"Client Statistics\", \n      \"description\" : \"Statistics about the clients connecting to the server.\" \n    }, \n    { \n      \"group\" : \"server\", \n      \"name\" : \"Server Statistics\", \n      \"description\" : \"Statistics about the ArangoDB server\" \n    } \n  ], \n  \"figures\" : [ \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"userTime\", \n      \"name\" : \"User Time\", \n      \"description\" : \"Amount of time that this process has been scheduled in user mode, measured in clock ticks divided by sysconf(_SC_CLK_TCK) aka seconds.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"systemTime\", \n      \"name\" : \"System Time\", \n      \"description\" : \"Amount of time that this process has been scheduled in kernel mode, measured in clock ticks divided by sysconf(_SC_CLK_TCK) aka seconds.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"numberOfThreads\", \n      \"name\" : \"Number of Threads\", \n      \"description\" : \"Number of threads in this process.\", \n      \"type\" : \"current\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"residentSize\", \n      \"name\" : \"Resident Set Size\", \n      \"description\" : \"The total size of the number of pages the process has in real memory. This is just the pages which count toward text, data, or stack space. This does not include pages which have not been demand-loaded in, or which are swapped out. The resident set size is reported in bytes.\", \n      \"type\" : \"current\", \n      \"units\" : \"bytes\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"virtualSize\", \n      \"name\" : \"Virtual Memory Size\", \n      \"description\" : \"The size of the virtual memory the process is using.\", \n      \"type\" : \"current\", \n      \"units\" : \"bytes\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"minorPageFaults\", \n      \"name\" : \"Minor Page Faults\", \n      \"description\" : \"The number of minor faults the process has made which have not required loading a memory page from disk.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"majorPageFaults\", \n      \"name\" : \"Major Page Faults\", \n      \"description\" : \"The number of major faults the process has made which have required loading a memory page from disk.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"httpConnections\", \n      \"name\" : \"HTTP Client Connections\", \n      \"description\" : \"The number of http connections that are currently open.\", \n      \"type\" : \"current\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"totalTime\", \n      \"name\" : \"Total Time\", \n      \"description\" : \"Total time needed to answer a request.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        0.01, \n        0.05, \n        0.1, \n        0.2, \n        0.5, \n        1 \n      ], \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"requestTime\", \n      \"name\" : \"Request Time\", \n      \"description\" : \"Request time needed to answer a request.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        0.01, \n        0.05, \n        0.1, \n        0.2, \n        0.5, \n        1 \n      ], \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"queueTime\", \n      \"name\" : \"Queue Time\", \n      \"description\" : \"Queue time needed to answer a request.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        0.01, \n        0.05, \n        0.1, \n        0.2, \n        0.5, \n        1 \n      ], \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"bytesSent\", \n      \"name\" : \"Bytes Sent\", \n      \"description\" : \"Bytes sents for a request.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        250, \n        1000, \n        2000, \n        5000, \n        10000 \n      ], \n      \"units\" : \"bytes\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"bytesReceived\", \n      \"name\" : \"Bytes Received\", \n      \"description\" : \"Bytes receiveds for a request.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        250, \n        1000, \n        2000, \n        5000, \n        10000 \n      ], \n      \"units\" : \"bytes\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"connectionTime\", \n      \"name\" : \"Connection Time\", \n      \"description\" : \"Total connection time of a client.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        0.1, \n        1, \n        60 \n      ], \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"server\", \n      \"identifier\" : \"uptime\", \n      \"name\" : \"Server Uptime\", \n      \"description\" : \"Number of seconds elapsed since server start.\", \n      \"type\" : \"current\", \n      \"units\" : \"seconds\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", + "examples": "

unix> curl --dump - http://localhost:8529/_admin/statistics-description\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"groups\" : [ \n    { \n      \"group\" : \"system\", \n      \"name\" : \"Process Statistics\", \n      \"description\" : \"Statistics about the ArangoDB process\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"name\" : \"Client Statistics\", \n      \"description\" : \"Statistics about the clients connecting to the server.\" \n    }, \n    { \n      \"group\" : \"server\", \n      \"name\" : \"Server Statistics\", \n      \"description\" : \"Statistics about the ArangoDB server\" \n    } \n  ], \n  \"figures\" : [ \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"userTime\", \n      \"name\" : \"User Time\", \n      \"description\" : \"Amount of time that this process has been scheduled in user mode, measured in cl...\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"systemTime\", \n      \"name\" : \"System Time\", \n      \"description\" : \"Amount of time that this process has been scheduled in kernel mode, measured in ...\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"numberOfThreads\", \n      \"name\" : \"Number of Threads\", \n      \"description\" : \"Number of threads in this process.\", \n      \"type\" : \"current\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"residentSize\", \n      \"name\" : \"Resident Set Size\", \n      \"description\" : \"The total size of the number of pages the process has in real memory. This is ju...\", \n      \"type\" : \"current\", \n      \"units\" : \"bytes\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"virtualSize\", \n      \"name\" : \"Virtual Memory Size\", \n      \"description\" : \"The size of the virtual memory the process is using.\", \n      \"type\" : \"current\", \n      \"units\" : \"bytes\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"minorPageFaults\", \n      \"name\" : \"Minor Page Faults\", \n      \"description\" : \"The number of minor faults the process has made which have not required loading ...\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"majorPageFaults\", \n      \"name\" : \"Major Page Faults\", \n      \"description\" : \"The number of major faults the process has made which have required loading a me...\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"httpConnections\", \n      \"name\" : \"HTTP Client Connections\", \n      \"description\" : \"The number of http connections that are currently open.\", \n      \"type\" : \"current\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"totalTime\", \n      \"name\" : \"Total Time\", \n      \"description\" : \"Total time needed to answer a request.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        0.01, \n        0.05, \n        0.1, \n        0.2, \n        0.5, \n        1 \n      ], \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"requestTime\", \n      \"name\" : \"Request Time\", \n      \"description\" : \"Request time needed to answer a request.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        0.01, \n        0.05, \n        0.1, \n        0.2, \n        0.5, \n        1 \n      ], \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"queueTime\", \n      \"name\" : \"Queue Time\", \n      \"description\" : \"Queue time needed to answer a request.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        0.01, \n        0.05, \n        0.1, \n        0.2, \n        0.5, \n        1 \n      ], \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"bytesSent\", \n      \"name\" : \"Bytes Sent\", \n      \"description\" : \"Bytes sents for a request.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        250, \n        1000, \n        2000, \n        5000, \n        10000 \n      ], \n      \"units\" : \"bytes\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"bytesReceived\", \n      \"name\" : \"Bytes Received\", \n      \"description\" : \"Bytes receiveds for a request.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        250, \n        1000, \n        2000, \n        5000, \n        10000 \n      ], \n      \"units\" : \"bytes\" \n    }, \n    { \n      \"group\" : \"client\", \n      \"identifier\" : \"connectionTime\", \n      \"name\" : \"Connection Time\", \n      \"description\" : \"Total connection time of a client.\", \n      \"type\" : \"distribution\", \n      \"cuts\" : [ \n        0.1, \n        1, \n        60 \n      ], \n      \"units\" : \"seconds\" \n    }, \n    { \n      \"group\" : \"server\", \n      \"identifier\" : \"uptime\", \n      \"name\" : \"Server Uptime\", \n      \"description\" : \"Number of seconds elapsed since server start.\", \n      \"type\" : \"current\", \n      \"units\" : \"seconds\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "statisticsDescription" } ], diff --git a/html/admin/api-docs/transaction.json b/html/admin/api-docs/transaction.json index 0b2b02258c..ef9f740f3d 100644 --- a/html/admin/api-docs/transaction.json +++ b/html/admin/api-docs/transaction.json @@ -29,10 +29,10 @@ "description": "Contains the collections and action. " } ], - "notes": "

The transaction description must be passed in the body of the POST request.

The following attributes must be specified inside the JSON object:

- collections: contains the list of collections to be used in the transaction (mandatory). collections must be a JSON array that can have the optional sub-attributes read and write. read and write must each be either lists of collections names or strings with a single collection name.

- action: the actual transaction operations to be executed, in the form of stringified Javascript code. The code will be executed on server side, with late binding. It is thus critical that the code specified in action properly sets up all the variables it needs. If the code specified in action ends with a return statement, the value returned will also be returned by the REST API in the result attribute if the transaction committed successfully.

The following optional attributes may also be specified in the request:

- waitForSync: an optional boolean flag that, if set, will force the transaction to write all data to disk before returning.

- lockTimeout: an optional numeric value that can be used to set a timeout for waiting on collection locks. If not specified, a default value will be used. Setting lockTimeout to 0 will make ArangoDB not time out waiting for a lock.

- params: optional arguments passed to action.

If the transaction is fully executed and committed on the server, HTTP 200 will be returned. Additionally, the return value of the code defined in action will be returned in the result attribute.

For successfully committed transactions, the returned JSON object has the following properties:

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

- code: the HTTP status code

- result: the return value of the transaction

If the transaction specification is either missing or malformed, the server will respond with HTTP 400.

The body of the response will then 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 a transaction fails to commit, either by an exception thrown in the action code, or by an internal error, the server will respond with an error. Any other errors will be returned with any of the return codes HTTP 400, HTTP 409, or HTTP 500.

", + "notes": "

The transaction description must be passed in the body of the POST request.

The following attributes must be specified inside the JSON object:

- collections: contains the list of collections to be used in the transaction (mandatory). collections must be a JSON array that can have the optional sub-attributes read and write. read and write must each be either lists of collections names or strings with a single collection name.

- action: the actual transaction operations to be executed, in the form of stringified Javascript code. The code will be executed on server side, with late binding. It is thus critical that the code specified in action properly sets up all the variables it needs. If the code specified in action ends with a return statement, the value returned will also be returned by the REST API in the result attribute if the transaction committed successfully.

The following optional attributes may also be specified in the request:

- waitForSync: an optional boolean flag that, if set, will force the transaction to write all data to disk before returning.

- lockTimeout: an optional numeric value that can be used to set a timeout for waiting on collection locks. If not specified, a default value will be used. Setting lockTimeout to 0 will make ArangoDB not time out waiting for a lock.

- replicate: whether or not to replicate the operations from this transaction. If not specified, the default value is true.

- params: optional arguments passed to action.

If the transaction is fully executed and committed on the server, HTTP 200 will be returned. Additionally, the return value of the code defined in action will be returned in the result attribute.

For successfully committed transactions, the returned JSON object has the following properties:

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

- code: the HTTP status code

- result: the return value of the transaction

If the transaction specification is either missing or malformed, the server will respond with HTTP 400.

The body of the response will then 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 a transaction fails to commit, either by an exception thrown in the action code, or by an internal error, the server will respond with an error. Any other errors will be returned with any of the return codes HTTP 400, HTTP 409, or HTTP 500.

", "summary": "executes a transaction", "httpMethod": "POST", - "examples": "Executing a transaction on a single collection:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{ \"collections\": { \"write\" : \"products\" }, \"action\" : \"function () { var db = require(\\\"internal\\\").db;db.products.save({});return db.products.count(); }\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : 1, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Executing a transaction using multiple collections:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{ \"collections\": { \"write\" : [\"products\", \"materials\" ] }, \"action\" : \"function () { var db = require(\\\"internal\\\").db;db.products.save({});db.materials.save({});return \\\"worked!\\\"; }\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : \"worked!\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Aborting a transaction due to an internal error:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{ \"collections\": { \"write\" : \"products\" }, \"action\" : \"function () { var db = require(\\\"internal\\\").db;db.products.save({_key: \\\"abc\\\"});db.products.save({_key: \\\"abc\\\"});\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

Aborting a transaction by throwing an exception:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{ \"collections\": { \"read\" : \"products\" }, \"action\" : \"function () { throw \\\"doh!\\\"; }\" }\n\nHTTP/1.1 500 Internal Error\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 500, \n  \"errorNum\" : 500, \n  \"errorMessage\" : \"doh!\" \n}\n\n

", + "examples": "Executing a transaction on a single collection:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{\"collections\":{\"write\":\"products\"},\"action\":\"function () { var db = require('internal').db; db.products.save({}); return db.products.count(); }\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : 1, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Executing a transaction using multiple collections:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{\"collections\":{\"write\":[\"products\",\"materials\"]},\"action\":\"function () { var db = require('internal').db; db.products.save({}); db.materials.save({}); return 'worked!'; }\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : \"worked!\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Aborting a transaction due to an internal error:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{\"collections\":{\"write\":\"products\"},\"action\":\"function () { var db = require('internal').db; db.products.save({ _key: 'abc'}); db.products.save({ _key: 'abc'}); }\"}\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 400, \n  \"errorNum\" : 1210, \n  \"errorMessage\" : \"cannot save document: unique constraint violated\" \n}\n\n

Aborting a transaction by explicitly throwing an exception:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{\"collections\":{\"read\":\"products\"},\"action\":\"function () { throw 'doh!'; }\"}\n\nHTTP/1.1 500 Internal Error\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 500, \n  \"errorNum\" : 500, \n  \"errorMessage\" : \"doh!\" \n}\n\n

Referring to a non-existing collection:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{\"collections\":{\"read\":\"products\"},\"action\":\"function () { return true; }\"}\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\" : \"collection not found\" \n}\n\n

", "nickname": "executesATransaction" } ], diff --git a/html/admin/api-docs/traversal.json b/html/admin/api-docs/traversal.json index 03bb303701..5a2ed31168 100644 --- a/html/admin/api-docs/traversal.json +++ b/html/admin/api-docs/traversal.json @@ -36,7 +36,7 @@ "notes": "Starts a traversal starting from a given vertex and following. edges contained in a given edgeCollection. The request must contain the following attributes.

- startVertex: id of the startVertex, e.g. \"users/foo\".

- edgeCollection: name of the collection that contains the edges.

- filter (optional, default is to include all nodes): body (JavaScript code) of custom filter function function signature: (config, vertex, path) -> mixed can return four different string values: - \"exclude\" -> this vertex will not be visited. - \"prune\" -> the edges of this vertex will not be followed. - \"\" or undefined -> visit the vertex and follow it's edges. - Array -> containing any combination of the above. If there is at least one \"exclude\" or \"prune\" respectivly is contained, it's effect will occur. - minDepth (optional, ANDed with any existing filters): visits only nodes in at least the given depth - maxDepth (optional, ANDed with any existing filters): visits only nodes in at most the given depth - visitor (optional): body (JavaScript) code of custom visitor function function signature: (config, result, vertex, path) -> void visitor function can do anything, but its return value is ignored. To populate a result, use the result variable by reference - direction (optional): direction for traversal - *if set*, must be either \"outbound\", \"inbound\", or \"any\" - *if not set*, the expander attribute must be specified - init (optional): body (JavaScript) code of custom result initialisation function function signature: (config, result) -> void initialise any values in result with what is required - expander (optional): body (JavaScript) code of custom expander function *must* be set if direction attribute is *not* set function signature: (config, vertex, path) -> array expander must return an array of the connections for vertex each connection is an object with the attributes edge and vertex - strategy (optional): traversal strategy can be \"depthfirst\" or \"breadthfirst\" - order (optional): traversal order can be \"preorder\" or \"postorder\" - itemOrder (optional): item iteration order can be \"forward\" or \"backward\" - uniqueness (optional): specifies uniqueness for vertices and edges visited if set, must be an object like this: \"uniqueness\": {\"vertices\": \"none\"|\"global\"|path\", \"edges\": \"none\"|\"global\"|\"path\"} - maxIterations (optional): Maximum number of iterations in each traversal. This number can be set to prevent endless loops in traversal of cyclic graphs. When a traversal performs as many iterations as the maxIterations value, the traversal will abort with an error. If maxIterations is not set, a server-defined value may be used.



If the Traversal is successfully executed HTTP 200 will be returned. Additionally the result object will be returned by the traversal.

For successful traversals, the returned JSON object has the following properties:

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

- code: the HTTP status code

- result: the return value of the traversal

If the traversal specification is either missing or malformed, the server will respond with HTTP 400.

The body of the response will then 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

", "summary": "executes a traversal", "httpMethod": "POST", - "examples": "In the following examples the underlying graph will contain five persons Alice, Bob, Charlie, Dave and Eve. We will have the following directed relations: - Alice knows Bob - Bob knows Charlie - Bob knows Dave - Eve knows Alice - Eve knows Bob The starting vertex will always be Alice. Follow only outbound edges:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/225218019\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/225218019\", \n          \"_rev\" : \"225218019\", \n          \"_key\" : \"225218019\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/225480163\", \n          \"_rev\" : \"225480163\", \n          \"_key\" : \"225480163\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/225742307\", \n          \"_rev\" : \"225742307\", \n          \"_key\" : \"225742307\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/225938915\", \n          \"_rev\" : \"225938915\", \n          \"_key\" : \"225938915\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/225218019\", \n              \"_rev\" : \"225218019\", \n              \"_key\" : \"225218019\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/226397667\", \n              \"_rev\" : \"226397667\", \n              \"_key\" : \"226397667\", \n              \"_from\" : \"persons/225218019\", \n              \"_to\" : \"persons/225480163\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/225218019\", \n              \"_rev\" : \"225218019\", \n              \"_key\" : \"225218019\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/225480163\", \n              \"_rev\" : \"225480163\", \n              \"_key\" : \"225480163\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/226397667\", \n              \"_rev\" : \"226397667\", \n              \"_key\" : \"226397667\", \n              \"_from\" : \"persons/225218019\", \n              \"_to\" : \"persons/225480163\" \n            }, \n            { \n              \"_id\" : \"knows/226594275\", \n              \"_rev\" : \"226594275\", \n              \"_key\" : \"226594275\", \n              \"_from\" : \"persons/225480163\", \n              \"_to\" : \"persons/225742307\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/225218019\", \n              \"_rev\" : \"225218019\", \n              \"_key\" : \"225218019\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/225480163\", \n              \"_rev\" : \"225480163\", \n              \"_key\" : \"225480163\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/225742307\", \n              \"_rev\" : \"225742307\", \n              \"_key\" : \"225742307\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/226397667\", \n              \"_rev\" : \"226397667\", \n              \"_key\" : \"226397667\", \n              \"_from\" : \"persons/225218019\", \n              \"_to\" : \"persons/225480163\" \n            }, \n            { \n              \"_id\" : \"knows/226790883\", \n              \"_rev\" : \"226790883\", \n              \"_key\" : \"226790883\", \n              \"_from\" : \"persons/225480163\", \n              \"_to\" : \"persons/225938915\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/225218019\", \n              \"_rev\" : \"225218019\", \n              \"_key\" : \"225218019\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/225480163\", \n              \"_rev\" : \"225480163\", \n              \"_key\" : \"225480163\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/225938915\", \n              \"_rev\" : \"225938915\", \n              \"_key\" : \"225938915\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Follow only inbound edges:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/229674467\", \"edgeCollection\" : \"knows\", \"direction\" : \"inbound\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/229674467\", \n          \"_rev\" : \"229674467\", \n          \"_key\" : \"229674467\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/230657507\", \n          \"_rev\" : \"230657507\", \n          \"_key\" : \"230657507\", \n          \"name\" : \"Eve\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/229674467\", \n              \"_rev\" : \"229674467\", \n              \"_key\" : \"229674467\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/231509475\", \n              \"_rev\" : \"231509475\", \n              \"_key\" : \"231509475\", \n              \"_from\" : \"persons/230657507\", \n              \"_to\" : \"persons/229674467\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/229674467\", \n              \"_rev\" : \"229674467\", \n              \"_key\" : \"229674467\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/230657507\", \n              \"_rev\" : \"230657507\", \n              \"_key\" : \"230657507\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Follow any direction of edges:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/233999843\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"global\"}}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/233999843\", \n          \"_rev\" : \"233999843\", \n          \"_key\" : \"233999843\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/234917347\", \n          \"_rev\" : \"234917347\", \n          \"_key\" : \"234917347\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/234261987\", \n          \"_rev\" : \"234261987\", \n          \"_key\" : \"234261987\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/233999843\", \n          \"_rev\" : \"233999843\", \n          \"_key\" : \"233999843\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/234524131\", \n          \"_rev\" : \"234524131\", \n          \"_key\" : \"234524131\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/234720739\", \n          \"_rev\" : \"234720739\", \n          \"_key\" : \"234720739\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/233999843\", \n              \"_rev\" : \"233999843\", \n              \"_key\" : \"233999843\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/235769315\", \n              \"_rev\" : \"235769315\", \n              \"_key\" : \"235769315\", \n              \"_from\" : \"persons/234917347\", \n              \"_to\" : \"persons/233999843\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/233999843\", \n              \"_rev\" : \"233999843\", \n              \"_key\" : \"233999843\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/234917347\", \n              \"_rev\" : \"234917347\", \n              \"_key\" : \"234917347\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/235769315\", \n              \"_rev\" : \"235769315\", \n              \"_key\" : \"235769315\", \n              \"_from\" : \"persons/234917347\", \n              \"_to\" : \"persons/233999843\" \n            }, \n            { \n              \"_id\" : \"knows/235965923\", \n              \"_rev\" : \"235965923\", \n              \"_key\" : \"235965923\", \n              \"_from\" : \"persons/234917347\", \n              \"_to\" : \"persons/234261987\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/233999843\", \n              \"_rev\" : \"233999843\", \n              \"_key\" : \"233999843\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/234917347\", \n              \"_rev\" : \"234917347\", \n              \"_key\" : \"234917347\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/234261987\", \n              \"_rev\" : \"234261987\", \n              \"_key\" : \"234261987\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/235769315\", \n              \"_rev\" : \"235769315\", \n              \"_key\" : \"235769315\", \n              \"_from\" : \"persons/234917347\", \n              \"_to\" : \"persons/233999843\" \n            }, \n            { \n              \"_id\" : \"knows/235965923\", \n              \"_rev\" : \"235965923\", \n              \"_key\" : \"235965923\", \n              \"_from\" : \"persons/234917347\", \n              \"_to\" : \"persons/234261987\" \n            }, \n            { \n              \"_id\" : \"knows/235179491\", \n              \"_rev\" : \"235179491\", \n              \"_key\" : \"235179491\", \n              \"_from\" : \"persons/233999843\", \n              \"_to\" : \"persons/234261987\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/233999843\", \n              \"_rev\" : \"233999843\", \n              \"_key\" : \"233999843\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/234917347\", \n              \"_rev\" : \"234917347\", \n              \"_key\" : \"234917347\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/234261987\", \n              \"_rev\" : \"234261987\", \n              \"_key\" : \"234261987\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/233999843\", \n              \"_rev\" : \"233999843\", \n              \"_key\" : \"233999843\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/235769315\", \n              \"_rev\" : \"235769315\", \n              \"_key\" : \"235769315\", \n              \"_from\" : \"persons/234917347\", \n              \"_to\" : \"persons/233999843\" \n            }, \n            { \n              \"_id\" : \"knows/235965923\", \n              \"_rev\" : \"235965923\", \n              \"_key\" : \"235965923\", \n              \"_from\" : \"persons/234917347\", \n              \"_to\" : \"persons/234261987\" \n            }, \n            { \n              \"_id\" : \"knows/235376099\", \n              \"_rev\" : \"235376099\", \n              \"_key\" : \"235376099\", \n              \"_from\" : \"persons/234261987\", \n              \"_to\" : \"persons/234524131\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/233999843\", \n              \"_rev\" : \"233999843\", \n              \"_key\" : \"233999843\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/234917347\", \n              \"_rev\" : \"234917347\", \n              \"_key\" : \"234917347\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/234261987\", \n              \"_rev\" : \"234261987\", \n              \"_key\" : \"234261987\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/234524131\", \n              \"_rev\" : \"234524131\", \n              \"_key\" : \"234524131\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/235769315\", \n              \"_rev\" : \"235769315\", \n              \"_key\" : \"235769315\", \n              \"_from\" : \"persons/234917347\", \n              \"_to\" : \"persons/233999843\" \n            }, \n            { \n              \"_id\" : \"knows/235965923\", \n              \"_rev\" : \"235965923\", \n              \"_key\" : \"235965923\", \n              \"_from\" : \"persons/234917347\", \n              \"_to\" : \"persons/234261987\" \n            }, \n            { \n              \"_id\" : \"knows/235572707\", \n              \"_rev\" : \"235572707\", \n              \"_key\" : \"235572707\", \n              \"_from\" : \"persons/234261987\", \n              \"_to\" : \"persons/234720739\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/233999843\", \n              \"_rev\" : \"233999843\", \n              \"_key\" : \"233999843\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/234917347\", \n              \"_rev\" : \"234917347\", \n              \"_key\" : \"234917347\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/234261987\", \n              \"_rev\" : \"234261987\", \n              \"_key\" : \"234261987\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/234720739\", \n              \"_rev\" : \"234720739\", \n              \"_key\" : \"234720739\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Excluding Charlie and Bob:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/239242723\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\", \"filter\" : \"if (vertex.name === \\\"Bob\\\" || vertex.name === \\\"Charlie\\\") {return \\\"exclude\\\";}return;\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/239242723\", \n          \"_rev\" : \"239242723\", \n          \"_key\" : \"239242723\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/239963619\", \n          \"_rev\" : \"239963619\", \n          \"_key\" : \"239963619\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/239242723\", \n              \"_rev\" : \"239242723\", \n              \"_key\" : \"239242723\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/240422371\", \n              \"_rev\" : \"240422371\", \n              \"_key\" : \"240422371\", \n              \"_from\" : \"persons/239242723\", \n              \"_to\" : \"persons/239504867\" \n            }, \n            { \n              \"_id\" : \"knows/240815587\", \n              \"_rev\" : \"240815587\", \n              \"_key\" : \"240815587\", \n              \"_from\" : \"persons/239504867\", \n              \"_to\" : \"persons/239963619\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/239242723\", \n              \"_rev\" : \"239242723\", \n              \"_key\" : \"239242723\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/239504867\", \n              \"_rev\" : \"239504867\", \n              \"_key\" : \"239504867\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/239963619\", \n              \"_rev\" : \"239963619\", \n              \"_key\" : \"239963619\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Do not follow edges from Bob:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/243764707\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\", \"filter\" : \"if (vertex.name === \\\"Bob\\\") {return \\\"prune\\\";}return;\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/243764707\", \n          \"_rev\" : \"243764707\", \n          \"_key\" : \"243764707\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/244026851\", \n          \"_rev\" : \"244026851\", \n          \"_key\" : \"244026851\", \n          \"name\" : \"Bob\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/243764707\", \n              \"_rev\" : \"243764707\", \n              \"_key\" : \"243764707\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/244944355\", \n              \"_rev\" : \"244944355\", \n              \"_key\" : \"244944355\", \n              \"_from\" : \"persons/243764707\", \n              \"_to\" : \"persons/244026851\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/243764707\", \n              \"_rev\" : \"243764707\", \n              \"_key\" : \"243764707\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/244026851\", \n              \"_rev\" : \"244026851\", \n              \"_key\" : \"244026851\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Visit only nodes in a depth of at least 2:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/247893475\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\", \"minDepth\" : 2}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/248483299\", \n          \"_rev\" : \"248483299\", \n          \"_key\" : \"248483299\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/248679907\", \n          \"_rev\" : \"248679907\", \n          \"_key\" : \"248679907\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/249138659\", \n              \"_rev\" : \"249138659\", \n              \"_key\" : \"249138659\", \n              \"_from\" : \"persons/247893475\", \n              \"_to\" : \"persons/248221155\" \n            }, \n            { \n              \"_id\" : \"knows/249335267\", \n              \"_rev\" : \"249335267\", \n              \"_key\" : \"249335267\", \n              \"_from\" : \"persons/248221155\", \n              \"_to\" : \"persons/248483299\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/247893475\", \n              \"_rev\" : \"247893475\", \n              \"_key\" : \"247893475\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/248221155\", \n              \"_rev\" : \"248221155\", \n              \"_key\" : \"248221155\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/248483299\", \n              \"_rev\" : \"248483299\", \n              \"_key\" : \"248483299\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/249138659\", \n              \"_rev\" : \"249138659\", \n              \"_key\" : \"249138659\", \n              \"_from\" : \"persons/247893475\", \n              \"_to\" : \"persons/248221155\" \n            }, \n            { \n              \"_id\" : \"knows/249531875\", \n              \"_rev\" : \"249531875\", \n              \"_key\" : \"249531875\", \n              \"_from\" : \"persons/248221155\", \n              \"_to\" : \"persons/248679907\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/247893475\", \n              \"_rev\" : \"247893475\", \n              \"_key\" : \"247893475\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/248221155\", \n              \"_rev\" : \"248221155\", \n              \"_key\" : \"248221155\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/248679907\", \n              \"_rev\" : \"248679907\", \n              \"_key\" : \"248679907\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Visit only nodes in a depth of at most 1:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/252480995\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\", \"maxDepth\" : 1}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/252480995\", \n          \"_rev\" : \"252480995\", \n          \"_key\" : \"252480995\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/252743139\", \n          \"_rev\" : \"252743139\", \n          \"_key\" : \"252743139\", \n          \"name\" : \"Bob\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/252480995\", \n              \"_rev\" : \"252480995\", \n              \"_key\" : \"252480995\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/253660643\", \n              \"_rev\" : \"253660643\", \n              \"_key\" : \"253660643\", \n              \"_from\" : \"persons/252480995\", \n              \"_to\" : \"persons/252743139\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/252480995\", \n              \"_rev\" : \"252480995\", \n              \"_key\" : \"252480995\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/252743139\", \n              \"_rev\" : \"252743139\", \n              \"_key\" : \"252743139\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Count all visited nodes and return a list of nodes only:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/256609763\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\", \"init\" : \"result.visited = 0; result.myVertices = [ ];\", \"visitor\" : \"result.visited++; result.myVertices.push(vertex);\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : 4, \n    \"myVertices\" : [ \n      { \n        \"_id\" : \"persons/256609763\", \n        \"_rev\" : \"256609763\", \n        \"_key\" : \"256609763\", \n        \"name\" : \"Alice\" \n      }, \n      { \n        \"_id\" : \"persons/256937443\", \n        \"_rev\" : \"256937443\", \n        \"_key\" : \"256937443\", \n        \"name\" : \"Bob\" \n      }, \n      { \n        \"_id\" : \"persons/257199587\", \n        \"_rev\" : \"257199587\", \n        \"_key\" : \"257199587\", \n        \"name\" : \"Charlie\" \n      }, \n      { \n        \"_id\" : \"persons/257396195\", \n        \"_rev\" : \"257396195\", \n        \"_key\" : \"257396195\", \n        \"name\" : \"Dave\" \n      } \n    ] \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Expand only inbound edges of Alice and outbound edges of Eve:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/261000675\",\"edgeCollection\":\"knows\",\"expander\":\"var connections = [ ];if (vertex.name === \\\"Alice\\\") {config.edgeCollection.inEdges(vertex).forEach(function (e) {connections.push({ vertex: require(\\\"internal\\\").db._document(e._from), edge: e});});}if (vertex.name === \\\"Eve\\\") {config.edgeCollection.outEdges(vertex).forEach(function (e) {connections.push({vertex: require(\\\"internal\\\").db._document(e._to), edge: e});});}return connections;\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/261000675\", \n          \"_rev\" : \"261000675\", \n          \"_key\" : \"261000675\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/261852643\", \n          \"_rev\" : \"261852643\", \n          \"_key\" : \"261852643\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/261197283\", \n          \"_rev\" : \"261197283\", \n          \"_key\" : \"261197283\", \n          \"name\" : \"Bob\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/261000675\", \n              \"_rev\" : \"261000675\", \n              \"_key\" : \"261000675\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/262704611\", \n              \"_rev\" : \"262704611\", \n              \"_key\" : \"262704611\", \n              \"_from\" : \"persons/261852643\", \n              \"_to\" : \"persons/261000675\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/261000675\", \n              \"_rev\" : \"261000675\", \n              \"_key\" : \"261000675\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/261852643\", \n              \"_rev\" : \"261852643\", \n              \"_key\" : \"261852643\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/262704611\", \n              \"_rev\" : \"262704611\", \n              \"_key\" : \"262704611\", \n              \"_from\" : \"persons/261852643\", \n              \"_to\" : \"persons/261000675\" \n            }, \n            { \n              \"_id\" : \"knows/262901219\", \n              \"_rev\" : \"262901219\", \n              \"_key\" : \"262901219\", \n              \"_from\" : \"persons/261852643\", \n              \"_to\" : \"persons/261197283\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/261000675\", \n              \"_rev\" : \"261000675\", \n              \"_key\" : \"261000675\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/261852643\", \n              \"_rev\" : \"261852643\", \n              \"_key\" : \"261852643\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/261197283\", \n              \"_rev\" : \"261197283\", \n              \"_key\" : \"261197283\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Follow the depthfirst strategy:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/265326051\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"strategy\":\"depthfirst\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/265326051\", \n          \"_rev\" : \"265326051\", \n          \"_key\" : \"265326051\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/266243555\", \n          \"_rev\" : \"266243555\", \n          \"_key\" : \"266243555\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/265588195\", \n          \"_rev\" : \"265588195\", \n          \"_key\" : \"265588195\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/265326051\", \n          \"_rev\" : \"265326051\", \n          \"_key\" : \"265326051\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/265850339\", \n          \"_rev\" : \"265850339\", \n          \"_key\" : \"265850339\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/266046947\", \n          \"_rev\" : \"266046947\", \n          \"_key\" : \"266046947\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/265588195\", \n          \"_rev\" : \"265588195\", \n          \"_key\" : \"265588195\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/266243555\", \n          \"_rev\" : \"266243555\", \n          \"_key\" : \"266243555\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/265326051\", \n          \"_rev\" : \"265326051\", \n          \"_key\" : \"265326051\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/265850339\", \n          \"_rev\" : \"265850339\", \n          \"_key\" : \"265850339\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/266046947\", \n          \"_rev\" : \"266046947\", \n          \"_key\" : \"266046947\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/267095523\", \n              \"_rev\" : \"267095523\", \n              \"_key\" : \"267095523\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265326051\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/266243555\", \n              \"_rev\" : \"266243555\", \n              \"_key\" : \"266243555\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/267095523\", \n              \"_rev\" : \"267095523\", \n              \"_key\" : \"267095523\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265326051\" \n            }, \n            { \n              \"_id\" : \"knows/267292131\", \n              \"_rev\" : \"267292131\", \n              \"_key\" : \"267292131\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265588195\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/266243555\", \n              \"_rev\" : \"266243555\", \n              \"_key\" : \"266243555\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/265588195\", \n              \"_rev\" : \"265588195\", \n              \"_key\" : \"265588195\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/267095523\", \n              \"_rev\" : \"267095523\", \n              \"_key\" : \"267095523\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265326051\" \n            }, \n            { \n              \"_id\" : \"knows/267292131\", \n              \"_rev\" : \"267292131\", \n              \"_key\" : \"267292131\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265588195\" \n            }, \n            { \n              \"_id\" : \"knows/266505699\", \n              \"_rev\" : \"266505699\", \n              \"_key\" : \"266505699\", \n              \"_from\" : \"persons/265326051\", \n              \"_to\" : \"persons/265588195\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/266243555\", \n              \"_rev\" : \"266243555\", \n              \"_key\" : \"266243555\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/265588195\", \n              \"_rev\" : \"265588195\", \n              \"_key\" : \"265588195\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/267095523\", \n              \"_rev\" : \"267095523\", \n              \"_key\" : \"267095523\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265326051\" \n            }, \n            { \n              \"_id\" : \"knows/267292131\", \n              \"_rev\" : \"267292131\", \n              \"_key\" : \"267292131\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265588195\" \n            }, \n            { \n              \"_id\" : \"knows/266702307\", \n              \"_rev\" : \"266702307\", \n              \"_key\" : \"266702307\", \n              \"_from\" : \"persons/265588195\", \n              \"_to\" : \"persons/265850339\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/266243555\", \n              \"_rev\" : \"266243555\", \n              \"_key\" : \"266243555\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/265588195\", \n              \"_rev\" : \"265588195\", \n              \"_key\" : \"265588195\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/265850339\", \n              \"_rev\" : \"265850339\", \n              \"_key\" : \"265850339\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/267095523\", \n              \"_rev\" : \"267095523\", \n              \"_key\" : \"267095523\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265326051\" \n            }, \n            { \n              \"_id\" : \"knows/267292131\", \n              \"_rev\" : \"267292131\", \n              \"_key\" : \"267292131\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265588195\" \n            }, \n            { \n              \"_id\" : \"knows/266898915\", \n              \"_rev\" : \"266898915\", \n              \"_key\" : \"266898915\", \n              \"_from\" : \"persons/265588195\", \n              \"_to\" : \"persons/266046947\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/266243555\", \n              \"_rev\" : \"266243555\", \n              \"_key\" : \"266243555\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/265588195\", \n              \"_rev\" : \"265588195\", \n              \"_key\" : \"265588195\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/266046947\", \n              \"_rev\" : \"266046947\", \n              \"_key\" : \"266046947\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/266505699\", \n              \"_rev\" : \"266505699\", \n              \"_key\" : \"266505699\", \n              \"_from\" : \"persons/265326051\", \n              \"_to\" : \"persons/265588195\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/265588195\", \n              \"_rev\" : \"265588195\", \n              \"_key\" : \"265588195\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/266505699\", \n              \"_rev\" : \"266505699\", \n              \"_key\" : \"266505699\", \n              \"_from\" : \"persons/265326051\", \n              \"_to\" : \"persons/265588195\" \n            }, \n            { \n              \"_id\" : \"knows/267292131\", \n              \"_rev\" : \"267292131\", \n              \"_key\" : \"267292131\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265588195\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/265588195\", \n              \"_rev\" : \"265588195\", \n              \"_key\" : \"265588195\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/266243555\", \n              \"_rev\" : \"266243555\", \n              \"_key\" : \"266243555\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/266505699\", \n              \"_rev\" : \"266505699\", \n              \"_key\" : \"266505699\", \n              \"_from\" : \"persons/265326051\", \n              \"_to\" : \"persons/265588195\" \n            }, \n            { \n              \"_id\" : \"knows/267292131\", \n              \"_rev\" : \"267292131\", \n              \"_key\" : \"267292131\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265588195\" \n            }, \n            { \n              \"_id\" : \"knows/267095523\", \n              \"_rev\" : \"267095523\", \n              \"_key\" : \"267095523\", \n              \"_from\" : \"persons/266243555\", \n              \"_to\" : \"persons/265326051\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/265588195\", \n              \"_rev\" : \"265588195\", \n              \"_key\" : \"265588195\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/266243555\", \n              \"_rev\" : \"266243555\", \n              \"_key\" : \"266243555\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/266505699\", \n              \"_rev\" : \"266505699\", \n              \"_key\" : \"266505699\", \n              \"_from\" : \"persons/265326051\", \n              \"_to\" : \"persons/265588195\" \n            }, \n            { \n              \"_id\" : \"knows/266702307\", \n              \"_rev\" : \"266702307\", \n              \"_key\" : \"266702307\", \n              \"_from\" : \"persons/265588195\", \n              \"_to\" : \"persons/265850339\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/265588195\", \n              \"_rev\" : \"265588195\", \n              \"_key\" : \"265588195\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/265850339\", \n              \"_rev\" : \"265850339\", \n              \"_key\" : \"265850339\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/266505699\", \n              \"_rev\" : \"266505699\", \n              \"_key\" : \"266505699\", \n              \"_from\" : \"persons/265326051\", \n              \"_to\" : \"persons/265588195\" \n            }, \n            { \n              \"_id\" : \"knows/266898915\", \n              \"_rev\" : \"266898915\", \n              \"_key\" : \"266898915\", \n              \"_from\" : \"persons/265588195\", \n              \"_to\" : \"persons/266046947\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/265326051\", \n              \"_rev\" : \"265326051\", \n              \"_key\" : \"265326051\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/265588195\", \n              \"_rev\" : \"265588195\", \n              \"_key\" : \"265588195\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/266046947\", \n              \"_rev\" : \"266046947\", \n              \"_key\" : \"266046947\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Using postorder ordering:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/271551971\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"order\":\"postorder\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/271551971\", \n          \"_rev\" : \"271551971\", \n          \"_key\" : \"271551971\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/272076259\", \n          \"_rev\" : \"272076259\", \n          \"_key\" : \"272076259\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/272272867\", \n          \"_rev\" : \"272272867\", \n          \"_key\" : \"272272867\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/271814115\", \n          \"_rev\" : \"271814115\", \n          \"_key\" : \"271814115\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/272469475\", \n          \"_rev\" : \"272469475\", \n          \"_key\" : \"272469475\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/271551971\", \n          \"_rev\" : \"271551971\", \n          \"_key\" : \"271551971\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/272469475\", \n          \"_rev\" : \"272469475\", \n          \"_key\" : \"272469475\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/272076259\", \n          \"_rev\" : \"272076259\", \n          \"_key\" : \"272076259\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/272272867\", \n          \"_rev\" : \"272272867\", \n          \"_key\" : \"272272867\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/271814115\", \n          \"_rev\" : \"271814115\", \n          \"_key\" : \"271814115\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/271551971\", \n          \"_rev\" : \"271551971\", \n          \"_key\" : \"271551971\", \n          \"name\" : \"Alice\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/273321443\", \n              \"_rev\" : \"273321443\", \n              \"_key\" : \"273321443\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271551971\" \n            }, \n            { \n              \"_id\" : \"knows/273518051\", \n              \"_rev\" : \"273518051\", \n              \"_key\" : \"273518051\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271814115\" \n            }, \n            { \n              \"_id\" : \"knows/272731619\", \n              \"_rev\" : \"272731619\", \n              \"_key\" : \"272731619\", \n              \"_from\" : \"persons/271551971\", \n              \"_to\" : \"persons/271814115\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/272469475\", \n              \"_rev\" : \"272469475\", \n              \"_key\" : \"272469475\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/271814115\", \n              \"_rev\" : \"271814115\", \n              \"_key\" : \"271814115\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/273321443\", \n              \"_rev\" : \"273321443\", \n              \"_key\" : \"273321443\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271551971\" \n            }, \n            { \n              \"_id\" : \"knows/273518051\", \n              \"_rev\" : \"273518051\", \n              \"_key\" : \"273518051\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271814115\" \n            }, \n            { \n              \"_id\" : \"knows/272928227\", \n              \"_rev\" : \"272928227\", \n              \"_key\" : \"272928227\", \n              \"_from\" : \"persons/271814115\", \n              \"_to\" : \"persons/272076259\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/272469475\", \n              \"_rev\" : \"272469475\", \n              \"_key\" : \"272469475\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/271814115\", \n              \"_rev\" : \"271814115\", \n              \"_key\" : \"271814115\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/272076259\", \n              \"_rev\" : \"272076259\", \n              \"_key\" : \"272076259\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/273321443\", \n              \"_rev\" : \"273321443\", \n              \"_key\" : \"273321443\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271551971\" \n            }, \n            { \n              \"_id\" : \"knows/273518051\", \n              \"_rev\" : \"273518051\", \n              \"_key\" : \"273518051\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271814115\" \n            }, \n            { \n              \"_id\" : \"knows/273124835\", \n              \"_rev\" : \"273124835\", \n              \"_key\" : \"273124835\", \n              \"_from\" : \"persons/271814115\", \n              \"_to\" : \"persons/272272867\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/272469475\", \n              \"_rev\" : \"272469475\", \n              \"_key\" : \"272469475\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/271814115\", \n              \"_rev\" : \"271814115\", \n              \"_key\" : \"271814115\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/272272867\", \n              \"_rev\" : \"272272867\", \n              \"_key\" : \"272272867\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/273321443\", \n              \"_rev\" : \"273321443\", \n              \"_key\" : \"273321443\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271551971\" \n            }, \n            { \n              \"_id\" : \"knows/273518051\", \n              \"_rev\" : \"273518051\", \n              \"_key\" : \"273518051\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271814115\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/272469475\", \n              \"_rev\" : \"272469475\", \n              \"_key\" : \"272469475\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/271814115\", \n              \"_rev\" : \"271814115\", \n              \"_key\" : \"271814115\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/273321443\", \n              \"_rev\" : \"273321443\", \n              \"_key\" : \"273321443\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271551971\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/272469475\", \n              \"_rev\" : \"272469475\", \n              \"_key\" : \"272469475\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/272731619\", \n              \"_rev\" : \"272731619\", \n              \"_key\" : \"272731619\", \n              \"_from\" : \"persons/271551971\", \n              \"_to\" : \"persons/271814115\" \n            }, \n            { \n              \"_id\" : \"knows/273518051\", \n              \"_rev\" : \"273518051\", \n              \"_key\" : \"273518051\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271814115\" \n            }, \n            { \n              \"_id\" : \"knows/273321443\", \n              \"_rev\" : \"273321443\", \n              \"_key\" : \"273321443\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271551971\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/271814115\", \n              \"_rev\" : \"271814115\", \n              \"_key\" : \"271814115\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/272469475\", \n              \"_rev\" : \"272469475\", \n              \"_key\" : \"272469475\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/272731619\", \n              \"_rev\" : \"272731619\", \n              \"_key\" : \"272731619\", \n              \"_from\" : \"persons/271551971\", \n              \"_to\" : \"persons/271814115\" \n            }, \n            { \n              \"_id\" : \"knows/273518051\", \n              \"_rev\" : \"273518051\", \n              \"_key\" : \"273518051\", \n              \"_from\" : \"persons/272469475\", \n              \"_to\" : \"persons/271814115\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/271814115\", \n              \"_rev\" : \"271814115\", \n              \"_key\" : \"271814115\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/272469475\", \n              \"_rev\" : \"272469475\", \n              \"_key\" : \"272469475\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/272731619\", \n              \"_rev\" : \"272731619\", \n              \"_key\" : \"272731619\", \n              \"_from\" : \"persons/271551971\", \n              \"_to\" : \"persons/271814115\" \n            }, \n            { \n              \"_id\" : \"knows/272928227\", \n              \"_rev\" : \"272928227\", \n              \"_key\" : \"272928227\", \n              \"_from\" : \"persons/271814115\", \n              \"_to\" : \"persons/272076259\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/271814115\", \n              \"_rev\" : \"271814115\", \n              \"_key\" : \"271814115\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/272076259\", \n              \"_rev\" : \"272076259\", \n              \"_key\" : \"272076259\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/272731619\", \n              \"_rev\" : \"272731619\", \n              \"_key\" : \"272731619\", \n              \"_from\" : \"persons/271551971\", \n              \"_to\" : \"persons/271814115\" \n            }, \n            { \n              \"_id\" : \"knows/273124835\", \n              \"_rev\" : \"273124835\", \n              \"_key\" : \"273124835\", \n              \"_from\" : \"persons/271814115\", \n              \"_to\" : \"persons/272272867\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/271814115\", \n              \"_rev\" : \"271814115\", \n              \"_key\" : \"271814115\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/272272867\", \n              \"_rev\" : \"272272867\", \n              \"_key\" : \"272272867\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/272731619\", \n              \"_rev\" : \"272731619\", \n              \"_key\" : \"272731619\", \n              \"_from\" : \"persons/271551971\", \n              \"_to\" : \"persons/271814115\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/271814115\", \n              \"_rev\" : \"271814115\", \n              \"_key\" : \"271814115\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/271551971\", \n              \"_rev\" : \"271551971\", \n              \"_key\" : \"271551971\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Using backward item-ordering:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/277777891\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"itemOrder\":\"backward\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/277777891\", \n          \"_rev\" : \"277777891\", \n          \"_key\" : \"277777891\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/278040035\", \n          \"_rev\" : \"278040035\", \n          \"_key\" : \"278040035\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/278498787\", \n          \"_rev\" : \"278498787\", \n          \"_key\" : \"278498787\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/278302179\", \n          \"_rev\" : \"278302179\", \n          \"_key\" : \"278302179\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/278695395\", \n          \"_rev\" : \"278695395\", \n          \"_key\" : \"278695395\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/277777891\", \n          \"_rev\" : \"277777891\", \n          \"_key\" : \"277777891\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/278695395\", \n          \"_rev\" : \"278695395\", \n          \"_key\" : \"278695395\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/278040035\", \n          \"_rev\" : \"278040035\", \n          \"_key\" : \"278040035\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/278498787\", \n          \"_rev\" : \"278498787\", \n          \"_key\" : \"278498787\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/278302179\", \n          \"_rev\" : \"278302179\", \n          \"_key\" : \"278302179\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/277777891\", \n          \"_rev\" : \"277777891\", \n          \"_key\" : \"277777891\", \n          \"name\" : \"Alice\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/278957539\", \n              \"_rev\" : \"278957539\", \n              \"_key\" : \"278957539\", \n              \"_from\" : \"persons/277777891\", \n              \"_to\" : \"persons/278040035\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/278040035\", \n              \"_rev\" : \"278040035\", \n              \"_key\" : \"278040035\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/278957539\", \n              \"_rev\" : \"278957539\", \n              \"_key\" : \"278957539\", \n              \"_from\" : \"persons/277777891\", \n              \"_to\" : \"persons/278040035\" \n            }, \n            { \n              \"_id\" : \"knows/279350755\", \n              \"_rev\" : \"279350755\", \n              \"_key\" : \"279350755\", \n              \"_from\" : \"persons/278040035\", \n              \"_to\" : \"persons/278498787\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/278040035\", \n              \"_rev\" : \"278040035\", \n              \"_key\" : \"278040035\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/278498787\", \n              \"_rev\" : \"278498787\", \n              \"_key\" : \"278498787\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/278957539\", \n              \"_rev\" : \"278957539\", \n              \"_key\" : \"278957539\", \n              \"_from\" : \"persons/277777891\", \n              \"_to\" : \"persons/278040035\" \n            }, \n            { \n              \"_id\" : \"knows/279154147\", \n              \"_rev\" : \"279154147\", \n              \"_key\" : \"279154147\", \n              \"_from\" : \"persons/278040035\", \n              \"_to\" : \"persons/278302179\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/278040035\", \n              \"_rev\" : \"278040035\", \n              \"_key\" : \"278040035\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/278302179\", \n              \"_rev\" : \"278302179\", \n              \"_key\" : \"278302179\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/278957539\", \n              \"_rev\" : \"278957539\", \n              \"_key\" : \"278957539\", \n              \"_from\" : \"persons/277777891\", \n              \"_to\" : \"persons/278040035\" \n            }, \n            { \n              \"_id\" : \"knows/279743971\", \n              \"_rev\" : \"279743971\", \n              \"_key\" : \"279743971\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/278040035\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/278040035\", \n              \"_rev\" : \"278040035\", \n              \"_key\" : \"278040035\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/278695395\", \n              \"_rev\" : \"278695395\", \n              \"_key\" : \"278695395\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/278957539\", \n              \"_rev\" : \"278957539\", \n              \"_key\" : \"278957539\", \n              \"_from\" : \"persons/277777891\", \n              \"_to\" : \"persons/278040035\" \n            }, \n            { \n              \"_id\" : \"knows/279743971\", \n              \"_rev\" : \"279743971\", \n              \"_key\" : \"279743971\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/278040035\" \n            }, \n            { \n              \"_id\" : \"knows/279547363\", \n              \"_rev\" : \"279547363\", \n              \"_key\" : \"279547363\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/277777891\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/278040035\", \n              \"_rev\" : \"278040035\", \n              \"_key\" : \"278040035\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/278695395\", \n              \"_rev\" : \"278695395\", \n              \"_key\" : \"278695395\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/279547363\", \n              \"_rev\" : \"279547363\", \n              \"_key\" : \"279547363\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/277777891\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/278695395\", \n              \"_rev\" : \"278695395\", \n              \"_key\" : \"278695395\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/279547363\", \n              \"_rev\" : \"279547363\", \n              \"_key\" : \"279547363\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/277777891\" \n            }, \n            { \n              \"_id\" : \"knows/279743971\", \n              \"_rev\" : \"279743971\", \n              \"_key\" : \"279743971\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/278040035\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/278695395\", \n              \"_rev\" : \"278695395\", \n              \"_key\" : \"278695395\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/278040035\", \n              \"_rev\" : \"278040035\", \n              \"_key\" : \"278040035\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/279547363\", \n              \"_rev\" : \"279547363\", \n              \"_key\" : \"279547363\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/277777891\" \n            }, \n            { \n              \"_id\" : \"knows/279743971\", \n              \"_rev\" : \"279743971\", \n              \"_key\" : \"279743971\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/278040035\" \n            }, \n            { \n              \"_id\" : \"knows/279350755\", \n              \"_rev\" : \"279350755\", \n              \"_key\" : \"279350755\", \n              \"_from\" : \"persons/278040035\", \n              \"_to\" : \"persons/278498787\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/278695395\", \n              \"_rev\" : \"278695395\", \n              \"_key\" : \"278695395\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/278040035\", \n              \"_rev\" : \"278040035\", \n              \"_key\" : \"278040035\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/278498787\", \n              \"_rev\" : \"278498787\", \n              \"_key\" : \"278498787\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/279547363\", \n              \"_rev\" : \"279547363\", \n              \"_key\" : \"279547363\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/277777891\" \n            }, \n            { \n              \"_id\" : \"knows/279743971\", \n              \"_rev\" : \"279743971\", \n              \"_key\" : \"279743971\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/278040035\" \n            }, \n            { \n              \"_id\" : \"knows/279154147\", \n              \"_rev\" : \"279154147\", \n              \"_key\" : \"279154147\", \n              \"_from\" : \"persons/278040035\", \n              \"_to\" : \"persons/278302179\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/278695395\", \n              \"_rev\" : \"278695395\", \n              \"_key\" : \"278695395\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/278040035\", \n              \"_rev\" : \"278040035\", \n              \"_key\" : \"278040035\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/278302179\", \n              \"_rev\" : \"278302179\", \n              \"_key\" : \"278302179\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/279547363\", \n              \"_rev\" : \"279547363\", \n              \"_key\" : \"279547363\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/277777891\" \n            }, \n            { \n              \"_id\" : \"knows/279743971\", \n              \"_rev\" : \"279743971\", \n              \"_key\" : \"279743971\", \n              \"_from\" : \"persons/278695395\", \n              \"_to\" : \"persons/278040035\" \n            }, \n            { \n              \"_id\" : \"knows/278957539\", \n              \"_rev\" : \"278957539\", \n              \"_key\" : \"278957539\", \n              \"_from\" : \"persons/277777891\", \n              \"_to\" : \"persons/278040035\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/278695395\", \n              \"_rev\" : \"278695395\", \n              \"_key\" : \"278695395\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/278040035\", \n              \"_rev\" : \"278040035\", \n              \"_key\" : \"278040035\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/277777891\", \n              \"_rev\" : \"277777891\", \n              \"_key\" : \"277777891\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Edges should only be included once globally, but nodes are included every time they are visited:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/284003811\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"global\"}}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/284003811\", \n          \"_rev\" : \"284003811\", \n          \"_key\" : \"284003811\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/284921315\", \n          \"_rev\" : \"284921315\", \n          \"_key\" : \"284921315\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/284265955\", \n          \"_rev\" : \"284265955\", \n          \"_key\" : \"284265955\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/284003811\", \n          \"_rev\" : \"284003811\", \n          \"_key\" : \"284003811\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/284528099\", \n          \"_rev\" : \"284528099\", \n          \"_key\" : \"284528099\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/284724707\", \n          \"_rev\" : \"284724707\", \n          \"_key\" : \"284724707\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/284003811\", \n              \"_rev\" : \"284003811\", \n              \"_key\" : \"284003811\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/285773283\", \n              \"_rev\" : \"285773283\", \n              \"_key\" : \"285773283\", \n              \"_from\" : \"persons/284921315\", \n              \"_to\" : \"persons/284003811\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/284003811\", \n              \"_rev\" : \"284003811\", \n              \"_key\" : \"284003811\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/284921315\", \n              \"_rev\" : \"284921315\", \n              \"_key\" : \"284921315\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/285773283\", \n              \"_rev\" : \"285773283\", \n              \"_key\" : \"285773283\", \n              \"_from\" : \"persons/284921315\", \n              \"_to\" : \"persons/284003811\" \n            }, \n            { \n              \"_id\" : \"knows/285969891\", \n              \"_rev\" : \"285969891\", \n              \"_key\" : \"285969891\", \n              \"_from\" : \"persons/284921315\", \n              \"_to\" : \"persons/284265955\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/284003811\", \n              \"_rev\" : \"284003811\", \n              \"_key\" : \"284003811\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/284921315\", \n              \"_rev\" : \"284921315\", \n              \"_key\" : \"284921315\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/284265955\", \n              \"_rev\" : \"284265955\", \n              \"_key\" : \"284265955\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/285773283\", \n              \"_rev\" : \"285773283\", \n              \"_key\" : \"285773283\", \n              \"_from\" : \"persons/284921315\", \n              \"_to\" : \"persons/284003811\" \n            }, \n            { \n              \"_id\" : \"knows/285969891\", \n              \"_rev\" : \"285969891\", \n              \"_key\" : \"285969891\", \n              \"_from\" : \"persons/284921315\", \n              \"_to\" : \"persons/284265955\" \n            }, \n            { \n              \"_id\" : \"knows/285183459\", \n              \"_rev\" : \"285183459\", \n              \"_key\" : \"285183459\", \n              \"_from\" : \"persons/284003811\", \n              \"_to\" : \"persons/284265955\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/284003811\", \n              \"_rev\" : \"284003811\", \n              \"_key\" : \"284003811\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/284921315\", \n              \"_rev\" : \"284921315\", \n              \"_key\" : \"284921315\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/284265955\", \n              \"_rev\" : \"284265955\", \n              \"_key\" : \"284265955\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/284003811\", \n              \"_rev\" : \"284003811\", \n              \"_key\" : \"284003811\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/285773283\", \n              \"_rev\" : \"285773283\", \n              \"_key\" : \"285773283\", \n              \"_from\" : \"persons/284921315\", \n              \"_to\" : \"persons/284003811\" \n            }, \n            { \n              \"_id\" : \"knows/285969891\", \n              \"_rev\" : \"285969891\", \n              \"_key\" : \"285969891\", \n              \"_from\" : \"persons/284921315\", \n              \"_to\" : \"persons/284265955\" \n            }, \n            { \n              \"_id\" : \"knows/285380067\", \n              \"_rev\" : \"285380067\", \n              \"_key\" : \"285380067\", \n              \"_from\" : \"persons/284265955\", \n              \"_to\" : \"persons/284528099\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/284003811\", \n              \"_rev\" : \"284003811\", \n              \"_key\" : \"284003811\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/284921315\", \n              \"_rev\" : \"284921315\", \n              \"_key\" : \"284921315\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/284265955\", \n              \"_rev\" : \"284265955\", \n              \"_key\" : \"284265955\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/284528099\", \n              \"_rev\" : \"284528099\", \n              \"_key\" : \"284528099\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/285773283\", \n              \"_rev\" : \"285773283\", \n              \"_key\" : \"285773283\", \n              \"_from\" : \"persons/284921315\", \n              \"_to\" : \"persons/284003811\" \n            }, \n            { \n              \"_id\" : \"knows/285969891\", \n              \"_rev\" : \"285969891\", \n              \"_key\" : \"285969891\", \n              \"_from\" : \"persons/284921315\", \n              \"_to\" : \"persons/284265955\" \n            }, \n            { \n              \"_id\" : \"knows/285576675\", \n              \"_rev\" : \"285576675\", \n              \"_key\" : \"285576675\", \n              \"_from\" : \"persons/284265955\", \n              \"_to\" : \"persons/284724707\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/284003811\", \n              \"_rev\" : \"284003811\", \n              \"_key\" : \"284003811\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/284921315\", \n              \"_rev\" : \"284921315\", \n              \"_key\" : \"284921315\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/284265955\", \n              \"_rev\" : \"284265955\", \n              \"_key\" : \"284265955\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/284724707\", \n              \"_rev\" : \"284724707\", \n              \"_key\" : \"284724707\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

If the underlying graph is cyclic, maxIterations should be set: The underlying graph has two vertices Alice and Bob. With the directed edges: - Alice knows Bob _ Bob knows Alice

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/289181155\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"none\"},\"maxIterations\":5}\n\nHTTP/1.1 500 Internal Error\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 500, \n  \"errorNum\" : 1909, \n  \"errorMessage\" : \"too many iterations\" \n}\n\n

", + "examples": "In the following examples the underlying graph will contain five persons Alice, Bob, Charlie, Dave and Eve. We will have the following directed relations: - Alice knows Bob - Bob knows Charlie - Bob knows Dave - Eve knows Alice - Eve knows Bob The starting vertex will always be Alice. Follow only outbound edges:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/224056530\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/224056530\", \n          \"_rev\" : \"224056530\", \n          \"_key\" : \"224056530\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/224318674\", \n          \"_rev\" : \"224318674\", \n          \"_key\" : \"224318674\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/224580818\", \n          \"_rev\" : \"224580818\", \n          \"_key\" : \"224580818\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/224777426\", \n          \"_rev\" : \"224777426\", \n          \"_key\" : \"224777426\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/224056530\", \n              \"_rev\" : \"224056530\", \n              \"_key\" : \"224056530\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/225236178\", \n              \"_rev\" : \"225236178\", \n              \"_key\" : \"225236178\", \n              \"_from\" : \"persons/224056530\", \n              \"_to\" : \"persons/224318674\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/224056530\", \n              \"_rev\" : \"224056530\", \n              \"_key\" : \"224056530\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/224318674\", \n              \"_rev\" : \"224318674\", \n              \"_key\" : \"224318674\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/225236178\", \n              \"_rev\" : \"225236178\", \n              \"_key\" : \"225236178\", \n              \"_from\" : \"persons/224056530\", \n              \"_to\" : \"persons/224318674\" \n            }, \n            { \n              \"_id\" : \"knows/225432786\", \n              \"_rev\" : \"225432786\", \n              \"_key\" : \"225432786\", \n              \"_from\" : \"persons/224318674\", \n              \"_to\" : \"persons/224580818\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/224056530\", \n              \"_rev\" : \"224056530\", \n              \"_key\" : \"224056530\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/224318674\", \n              \"_rev\" : \"224318674\", \n              \"_key\" : \"224318674\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/224580818\", \n              \"_rev\" : \"224580818\", \n              \"_key\" : \"224580818\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/225236178\", \n              \"_rev\" : \"225236178\", \n              \"_key\" : \"225236178\", \n              \"_from\" : \"persons/224056530\", \n              \"_to\" : \"persons/224318674\" \n            }, \n            { \n              \"_id\" : \"knows/225629394\", \n              \"_rev\" : \"225629394\", \n              \"_key\" : \"225629394\", \n              \"_from\" : \"persons/224318674\", \n              \"_to\" : \"persons/224777426\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/224056530\", \n              \"_rev\" : \"224056530\", \n              \"_key\" : \"224056530\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/224318674\", \n              \"_rev\" : \"224318674\", \n              \"_key\" : \"224318674\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/224777426\", \n              \"_rev\" : \"224777426\", \n              \"_key\" : \"224777426\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Follow only inbound edges:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/228578514\", \"edgeCollection\" : \"knows\", \"direction\" : \"inbound\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/228578514\", \n          \"_rev\" : \"228578514\", \n          \"_key\" : \"228578514\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/229496018\", \n          \"_rev\" : \"229496018\", \n          \"_key\" : \"229496018\", \n          \"name\" : \"Eve\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/228578514\", \n              \"_rev\" : \"228578514\", \n              \"_key\" : \"228578514\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/230347986\", \n              \"_rev\" : \"230347986\", \n              \"_key\" : \"230347986\", \n              \"_from\" : \"persons/229496018\", \n              \"_to\" : \"persons/228578514\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/228578514\", \n              \"_rev\" : \"228578514\", \n              \"_key\" : \"228578514\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/229496018\", \n              \"_rev\" : \"229496018\", \n              \"_key\" : \"229496018\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Follow any direction of edges:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/232838354\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"global\"}}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/232838354\", \n          \"_rev\" : \"232838354\", \n          \"_key\" : \"232838354\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/233755858\", \n          \"_rev\" : \"233755858\", \n          \"_key\" : \"233755858\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/233100498\", \n          \"_rev\" : \"233100498\", \n          \"_key\" : \"233100498\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/232838354\", \n          \"_rev\" : \"232838354\", \n          \"_key\" : \"232838354\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/233362642\", \n          \"_rev\" : \"233362642\", \n          \"_key\" : \"233362642\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/233559250\", \n          \"_rev\" : \"233559250\", \n          \"_key\" : \"233559250\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/232838354\", \n              \"_rev\" : \"232838354\", \n              \"_key\" : \"232838354\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/234607826\", \n              \"_rev\" : \"234607826\", \n              \"_key\" : \"234607826\", \n              \"_from\" : \"persons/233755858\", \n              \"_to\" : \"persons/232838354\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/232838354\", \n              \"_rev\" : \"232838354\", \n              \"_key\" : \"232838354\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/233755858\", \n              \"_rev\" : \"233755858\", \n              \"_key\" : \"233755858\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/234607826\", \n              \"_rev\" : \"234607826\", \n              \"_key\" : \"234607826\", \n              \"_from\" : \"persons/233755858\", \n              \"_to\" : \"persons/232838354\" \n            }, \n            { \n              \"_id\" : \"knows/234804434\", \n              \"_rev\" : \"234804434\", \n              \"_key\" : \"234804434\", \n              \"_from\" : \"persons/233755858\", \n              \"_to\" : \"persons/233100498\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/232838354\", \n              \"_rev\" : \"232838354\", \n              \"_key\" : \"232838354\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/233755858\", \n              \"_rev\" : \"233755858\", \n              \"_key\" : \"233755858\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/233100498\", \n              \"_rev\" : \"233100498\", \n              \"_key\" : \"233100498\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/234607826\", \n              \"_rev\" : \"234607826\", \n              \"_key\" : \"234607826\", \n              \"_from\" : \"persons/233755858\", \n              \"_to\" : \"persons/232838354\" \n            }, \n            { \n              \"_id\" : \"knows/234804434\", \n              \"_rev\" : \"234804434\", \n              \"_key\" : \"234804434\", \n              \"_from\" : \"persons/233755858\", \n              \"_to\" : \"persons/233100498\" \n            }, \n            { \n              \"_id\" : \"knows/234018002\", \n              \"_rev\" : \"234018002\", \n              \"_key\" : \"234018002\", \n              \"_from\" : \"persons/232838354\", \n              \"_to\" : \"persons/233100498\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/232838354\", \n              \"_rev\" : \"232838354\", \n              \"_key\" : \"232838354\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/233755858\", \n              \"_rev\" : \"233755858\", \n              \"_key\" : \"233755858\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/233100498\", \n              \"_rev\" : \"233100498\", \n              \"_key\" : \"233100498\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/232838354\", \n              \"_rev\" : \"232838354\", \n              \"_key\" : \"232838354\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/234607826\", \n              \"_rev\" : \"234607826\", \n              \"_key\" : \"234607826\", \n              \"_from\" : \"persons/233755858\", \n              \"_to\" : \"persons/232838354\" \n            }, \n            { \n              \"_id\" : \"knows/234804434\", \n              \"_rev\" : \"234804434\", \n              \"_key\" : \"234804434\", \n              \"_from\" : \"persons/233755858\", \n              \"_to\" : \"persons/233100498\" \n            }, \n            { \n              \"_id\" : \"knows/234214610\", \n              \"_rev\" : \"234214610\", \n              \"_key\" : \"234214610\", \n              \"_from\" : \"persons/233100498\", \n              \"_to\" : \"persons/233362642\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/232838354\", \n              \"_rev\" : \"232838354\", \n              \"_key\" : \"232838354\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/233755858\", \n              \"_rev\" : \"233755858\", \n              \"_key\" : \"233755858\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/233100498\", \n              \"_rev\" : \"233100498\", \n              \"_key\" : \"233100498\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/233362642\", \n              \"_rev\" : \"233362642\", \n              \"_key\" : \"233362642\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/234607826\", \n              \"_rev\" : \"234607826\", \n              \"_key\" : \"234607826\", \n              \"_from\" : \"persons/233755858\", \n              \"_to\" : \"persons/232838354\" \n            }, \n            { \n              \"_id\" : \"knows/234804434\", \n              \"_rev\" : \"234804434\", \n              \"_key\" : \"234804434\", \n              \"_from\" : \"persons/233755858\", \n              \"_to\" : \"persons/233100498\" \n            }, \n            { \n              \"_id\" : \"knows/234411218\", \n              \"_rev\" : \"234411218\", \n              \"_key\" : \"234411218\", \n              \"_from\" : \"persons/233100498\", \n              \"_to\" : \"persons/233559250\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/232838354\", \n              \"_rev\" : \"232838354\", \n              \"_key\" : \"232838354\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/233755858\", \n              \"_rev\" : \"233755858\", \n              \"_key\" : \"233755858\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/233100498\", \n              \"_rev\" : \"233100498\", \n              \"_key\" : \"233100498\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/233559250\", \n              \"_rev\" : \"233559250\", \n              \"_key\" : \"233559250\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Excluding Charlie and Bob:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/238081234\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\", \"filter\" : \"if (vertex.name === \\\"Bob\\\" || vertex.name === \\\"Charlie\\\") {return \\\"exclude\\\";}return;\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/238081234\", \n          \"_rev\" : \"238081234\", \n          \"_key\" : \"238081234\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/238802130\", \n          \"_rev\" : \"238802130\", \n          \"_key\" : \"238802130\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/238081234\", \n              \"_rev\" : \"238081234\", \n              \"_key\" : \"238081234\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/239260882\", \n              \"_rev\" : \"239260882\", \n              \"_key\" : \"239260882\", \n              \"_from\" : \"persons/238081234\", \n              \"_to\" : \"persons/238343378\" \n            }, \n            { \n              \"_id\" : \"knows/239654098\", \n              \"_rev\" : \"239654098\", \n              \"_key\" : \"239654098\", \n              \"_from\" : \"persons/238343378\", \n              \"_to\" : \"persons/238802130\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/238081234\", \n              \"_rev\" : \"238081234\", \n              \"_key\" : \"238081234\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/238343378\", \n              \"_rev\" : \"238343378\", \n              \"_key\" : \"238343378\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/238802130\", \n              \"_rev\" : \"238802130\", \n              \"_key\" : \"238802130\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Do not follow edges from Bob:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/242603218\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\", \"filter\" : \"if (vertex.name === \\\"Bob\\\") {return \\\"prune\\\";}return;\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/242603218\", \n          \"_rev\" : \"242603218\", \n          \"_key\" : \"242603218\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/242865362\", \n          \"_rev\" : \"242865362\", \n          \"_key\" : \"242865362\", \n          \"name\" : \"Bob\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/242603218\", \n              \"_rev\" : \"242603218\", \n              \"_key\" : \"242603218\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/243782866\", \n              \"_rev\" : \"243782866\", \n              \"_key\" : \"243782866\", \n              \"_from\" : \"persons/242603218\", \n              \"_to\" : \"persons/242865362\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/242603218\", \n              \"_rev\" : \"242603218\", \n              \"_key\" : \"242603218\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/242865362\", \n              \"_rev\" : \"242865362\", \n              \"_key\" : \"242865362\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Visit only nodes in a depth of at least 2:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/246797522\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\", \"minDepth\" : 2}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/247321810\", \n          \"_rev\" : \"247321810\", \n          \"_key\" : \"247321810\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/247518418\", \n          \"_rev\" : \"247518418\", \n          \"_key\" : \"247518418\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/247977170\", \n              \"_rev\" : \"247977170\", \n              \"_key\" : \"247977170\", \n              \"_from\" : \"persons/246797522\", \n              \"_to\" : \"persons/247059666\" \n            }, \n            { \n              \"_id\" : \"knows/248173778\", \n              \"_rev\" : \"248173778\", \n              \"_key\" : \"248173778\", \n              \"_from\" : \"persons/247059666\", \n              \"_to\" : \"persons/247321810\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/246797522\", \n              \"_rev\" : \"246797522\", \n              \"_key\" : \"246797522\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/247059666\", \n              \"_rev\" : \"247059666\", \n              \"_key\" : \"247059666\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/247321810\", \n              \"_rev\" : \"247321810\", \n              \"_key\" : \"247321810\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/247977170\", \n              \"_rev\" : \"247977170\", \n              \"_key\" : \"247977170\", \n              \"_from\" : \"persons/246797522\", \n              \"_to\" : \"persons/247059666\" \n            }, \n            { \n              \"_id\" : \"knows/248370386\", \n              \"_rev\" : \"248370386\", \n              \"_key\" : \"248370386\", \n              \"_from\" : \"persons/247059666\", \n              \"_to\" : \"persons/247518418\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/246797522\", \n              \"_rev\" : \"246797522\", \n              \"_key\" : \"246797522\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/247059666\", \n              \"_rev\" : \"247059666\", \n              \"_key\" : \"247059666\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/247518418\", \n              \"_rev\" : \"247518418\", \n              \"_key\" : \"247518418\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Visit only nodes in a depth of at most 1:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/251319506\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\", \"maxDepth\" : 1}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/251319506\", \n          \"_rev\" : \"251319506\", \n          \"_key\" : \"251319506\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/251581650\", \n          \"_rev\" : \"251581650\", \n          \"_key\" : \"251581650\", \n          \"name\" : \"Bob\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/251319506\", \n              \"_rev\" : \"251319506\", \n              \"_key\" : \"251319506\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/252499154\", \n              \"_rev\" : \"252499154\", \n              \"_key\" : \"252499154\", \n              \"_from\" : \"persons/251319506\", \n              \"_to\" : \"persons/251581650\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/251319506\", \n              \"_rev\" : \"251319506\", \n              \"_key\" : \"251319506\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/251581650\", \n              \"_rev\" : \"251581650\", \n              \"_key\" : \"251581650\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Count all visited nodes and return a list of nodes only:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{ \"startVertex\": \"persons/255513810\", \"edgeCollection\" : \"knows\", \"direction\" : \"outbound\", \"init\" : \"result.visited = 0; result.myVertices = [ ];\", \"visitor\" : \"result.visited++; result.myVertices.push(vertex);\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : 4, \n    \"myVertices\" : [ \n      { \n        \"_id\" : \"persons/255513810\", \n        \"_rev\" : \"255513810\", \n        \"_key\" : \"255513810\", \n        \"name\" : \"Alice\" \n      }, \n      { \n        \"_id\" : \"persons/255775954\", \n        \"_rev\" : \"255775954\", \n        \"_key\" : \"255775954\", \n        \"name\" : \"Bob\" \n      }, \n      { \n        \"_id\" : \"persons/256038098\", \n        \"_rev\" : \"256038098\", \n        \"_key\" : \"256038098\", \n        \"name\" : \"Charlie\" \n      }, \n      { \n        \"_id\" : \"persons/256234706\", \n        \"_rev\" : \"256234706\", \n        \"_key\" : \"256234706\", \n        \"name\" : \"Dave\" \n      } \n    ] \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Expand only inbound edges of Alice and outbound edges of Eve:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/259773650\",\"edgeCollection\":\"knows\",\"expander\":\"var connections = [ ];if (vertex.name === \\\"Alice\\\") {config.edgeCollection.inEdges(vertex).forEach(function (e) {connections.push({ vertex: require(\\\"internal\\\").db._document(e._from), edge: e});});}if (vertex.name === \\\"Eve\\\") {config.edgeCollection.outEdges(vertex).forEach(function (e) {connections.push({vertex: require(\\\"internal\\\").db._document(e._to), edge: e});});}return connections;\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/259773650\", \n          \"_rev\" : \"259773650\", \n          \"_key\" : \"259773650\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/260691154\", \n          \"_rev\" : \"260691154\", \n          \"_key\" : \"260691154\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/260035794\", \n          \"_rev\" : \"260035794\", \n          \"_key\" : \"260035794\", \n          \"name\" : \"Bob\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/259773650\", \n              \"_rev\" : \"259773650\", \n              \"_key\" : \"259773650\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/261543122\", \n              \"_rev\" : \"261543122\", \n              \"_key\" : \"261543122\", \n              \"_from\" : \"persons/260691154\", \n              \"_to\" : \"persons/259773650\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/259773650\", \n              \"_rev\" : \"259773650\", \n              \"_key\" : \"259773650\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/260691154\", \n              \"_rev\" : \"260691154\", \n              \"_key\" : \"260691154\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/261543122\", \n              \"_rev\" : \"261543122\", \n              \"_key\" : \"261543122\", \n              \"_from\" : \"persons/260691154\", \n              \"_to\" : \"persons/259773650\" \n            }, \n            { \n              \"_id\" : \"knows/261739730\", \n              \"_rev\" : \"261739730\", \n              \"_key\" : \"261739730\", \n              \"_from\" : \"persons/260691154\", \n              \"_to\" : \"persons/260035794\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/259773650\", \n              \"_rev\" : \"259773650\", \n              \"_key\" : \"259773650\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/260691154\", \n              \"_rev\" : \"260691154\", \n              \"_key\" : \"260691154\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/260035794\", \n              \"_rev\" : \"260035794\", \n              \"_key\" : \"260035794\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Follow the depthfirst strategy:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/264164562\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"strategy\":\"depthfirst\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/264164562\", \n          \"_rev\" : \"264164562\", \n          \"_key\" : \"264164562\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/265082066\", \n          \"_rev\" : \"265082066\", \n          \"_key\" : \"265082066\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/264426706\", \n          \"_rev\" : \"264426706\", \n          \"_key\" : \"264426706\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/264164562\", \n          \"_rev\" : \"264164562\", \n          \"_key\" : \"264164562\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/264688850\", \n          \"_rev\" : \"264688850\", \n          \"_key\" : \"264688850\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/264885458\", \n          \"_rev\" : \"264885458\", \n          \"_key\" : \"264885458\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/264426706\", \n          \"_rev\" : \"264426706\", \n          \"_key\" : \"264426706\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/265082066\", \n          \"_rev\" : \"265082066\", \n          \"_key\" : \"265082066\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/264164562\", \n          \"_rev\" : \"264164562\", \n          \"_key\" : \"264164562\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/264688850\", \n          \"_rev\" : \"264688850\", \n          \"_key\" : \"264688850\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/264885458\", \n          \"_rev\" : \"264885458\", \n          \"_key\" : \"264885458\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/265934034\", \n              \"_rev\" : \"265934034\", \n              \"_key\" : \"265934034\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264164562\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/265082066\", \n              \"_rev\" : \"265082066\", \n              \"_key\" : \"265082066\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/265934034\", \n              \"_rev\" : \"265934034\", \n              \"_key\" : \"265934034\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264164562\" \n            }, \n            { \n              \"_id\" : \"knows/266130642\", \n              \"_rev\" : \"266130642\", \n              \"_key\" : \"266130642\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264426706\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/265082066\", \n              \"_rev\" : \"265082066\", \n              \"_key\" : \"265082066\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/264426706\", \n              \"_rev\" : \"264426706\", \n              \"_key\" : \"264426706\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/265934034\", \n              \"_rev\" : \"265934034\", \n              \"_key\" : \"265934034\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264164562\" \n            }, \n            { \n              \"_id\" : \"knows/266130642\", \n              \"_rev\" : \"266130642\", \n              \"_key\" : \"266130642\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264426706\" \n            }, \n            { \n              \"_id\" : \"knows/265344210\", \n              \"_rev\" : \"265344210\", \n              \"_key\" : \"265344210\", \n              \"_from\" : \"persons/264164562\", \n              \"_to\" : \"persons/264426706\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/265082066\", \n              \"_rev\" : \"265082066\", \n              \"_key\" : \"265082066\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/264426706\", \n              \"_rev\" : \"264426706\", \n              \"_key\" : \"264426706\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/265934034\", \n              \"_rev\" : \"265934034\", \n              \"_key\" : \"265934034\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264164562\" \n            }, \n            { \n              \"_id\" : \"knows/266130642\", \n              \"_rev\" : \"266130642\", \n              \"_key\" : \"266130642\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264426706\" \n            }, \n            { \n              \"_id\" : \"knows/265540818\", \n              \"_rev\" : \"265540818\", \n              \"_key\" : \"265540818\", \n              \"_from\" : \"persons/264426706\", \n              \"_to\" : \"persons/264688850\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/265082066\", \n              \"_rev\" : \"265082066\", \n              \"_key\" : \"265082066\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/264426706\", \n              \"_rev\" : \"264426706\", \n              \"_key\" : \"264426706\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/264688850\", \n              \"_rev\" : \"264688850\", \n              \"_key\" : \"264688850\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/265934034\", \n              \"_rev\" : \"265934034\", \n              \"_key\" : \"265934034\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264164562\" \n            }, \n            { \n              \"_id\" : \"knows/266130642\", \n              \"_rev\" : \"266130642\", \n              \"_key\" : \"266130642\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264426706\" \n            }, \n            { \n              \"_id\" : \"knows/265737426\", \n              \"_rev\" : \"265737426\", \n              \"_key\" : \"265737426\", \n              \"_from\" : \"persons/264426706\", \n              \"_to\" : \"persons/264885458\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/265082066\", \n              \"_rev\" : \"265082066\", \n              \"_key\" : \"265082066\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/264426706\", \n              \"_rev\" : \"264426706\", \n              \"_key\" : \"264426706\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/264885458\", \n              \"_rev\" : \"264885458\", \n              \"_key\" : \"264885458\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/265344210\", \n              \"_rev\" : \"265344210\", \n              \"_key\" : \"265344210\", \n              \"_from\" : \"persons/264164562\", \n              \"_to\" : \"persons/264426706\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/264426706\", \n              \"_rev\" : \"264426706\", \n              \"_key\" : \"264426706\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/265344210\", \n              \"_rev\" : \"265344210\", \n              \"_key\" : \"265344210\", \n              \"_from\" : \"persons/264164562\", \n              \"_to\" : \"persons/264426706\" \n            }, \n            { \n              \"_id\" : \"knows/266130642\", \n              \"_rev\" : \"266130642\", \n              \"_key\" : \"266130642\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264426706\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/264426706\", \n              \"_rev\" : \"264426706\", \n              \"_key\" : \"264426706\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/265082066\", \n              \"_rev\" : \"265082066\", \n              \"_key\" : \"265082066\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/265344210\", \n              \"_rev\" : \"265344210\", \n              \"_key\" : \"265344210\", \n              \"_from\" : \"persons/264164562\", \n              \"_to\" : \"persons/264426706\" \n            }, \n            { \n              \"_id\" : \"knows/266130642\", \n              \"_rev\" : \"266130642\", \n              \"_key\" : \"266130642\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264426706\" \n            }, \n            { \n              \"_id\" : \"knows/265934034\", \n              \"_rev\" : \"265934034\", \n              \"_key\" : \"265934034\", \n              \"_from\" : \"persons/265082066\", \n              \"_to\" : \"persons/264164562\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/264426706\", \n              \"_rev\" : \"264426706\", \n              \"_key\" : \"264426706\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/265082066\", \n              \"_rev\" : \"265082066\", \n              \"_key\" : \"265082066\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/265344210\", \n              \"_rev\" : \"265344210\", \n              \"_key\" : \"265344210\", \n              \"_from\" : \"persons/264164562\", \n              \"_to\" : \"persons/264426706\" \n            }, \n            { \n              \"_id\" : \"knows/265540818\", \n              \"_rev\" : \"265540818\", \n              \"_key\" : \"265540818\", \n              \"_from\" : \"persons/264426706\", \n              \"_to\" : \"persons/264688850\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/264426706\", \n              \"_rev\" : \"264426706\", \n              \"_key\" : \"264426706\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/264688850\", \n              \"_rev\" : \"264688850\", \n              \"_key\" : \"264688850\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/265344210\", \n              \"_rev\" : \"265344210\", \n              \"_key\" : \"265344210\", \n              \"_from\" : \"persons/264164562\", \n              \"_to\" : \"persons/264426706\" \n            }, \n            { \n              \"_id\" : \"knows/265737426\", \n              \"_rev\" : \"265737426\", \n              \"_key\" : \"265737426\", \n              \"_from\" : \"persons/264426706\", \n              \"_to\" : \"persons/264885458\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/264164562\", \n              \"_rev\" : \"264164562\", \n              \"_key\" : \"264164562\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/264426706\", \n              \"_rev\" : \"264426706\", \n              \"_key\" : \"264426706\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/264885458\", \n              \"_rev\" : \"264885458\", \n              \"_key\" : \"264885458\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Using postorder ordering:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/270390482\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"order\":\"postorder\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/270390482\", \n          \"_rev\" : \"270390482\", \n          \"_key\" : \"270390482\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/270914770\", \n          \"_rev\" : \"270914770\", \n          \"_key\" : \"270914770\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/271111378\", \n          \"_rev\" : \"271111378\", \n          \"_key\" : \"271111378\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/270652626\", \n          \"_rev\" : \"270652626\", \n          \"_key\" : \"270652626\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/271307986\", \n          \"_rev\" : \"271307986\", \n          \"_key\" : \"271307986\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/270390482\", \n          \"_rev\" : \"270390482\", \n          \"_key\" : \"270390482\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/271307986\", \n          \"_rev\" : \"271307986\", \n          \"_key\" : \"271307986\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/270914770\", \n          \"_rev\" : \"270914770\", \n          \"_key\" : \"270914770\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/271111378\", \n          \"_rev\" : \"271111378\", \n          \"_key\" : \"271111378\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/270652626\", \n          \"_rev\" : \"270652626\", \n          \"_key\" : \"270652626\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/270390482\", \n          \"_rev\" : \"270390482\", \n          \"_key\" : \"270390482\", \n          \"name\" : \"Alice\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/272159954\", \n              \"_rev\" : \"272159954\", \n              \"_key\" : \"272159954\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270390482\" \n            }, \n            { \n              \"_id\" : \"knows/272356562\", \n              \"_rev\" : \"272356562\", \n              \"_key\" : \"272356562\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270652626\" \n            }, \n            { \n              \"_id\" : \"knows/271570130\", \n              \"_rev\" : \"271570130\", \n              \"_key\" : \"271570130\", \n              \"_from\" : \"persons/270390482\", \n              \"_to\" : \"persons/270652626\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/271307986\", \n              \"_rev\" : \"271307986\", \n              \"_key\" : \"271307986\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/270652626\", \n              \"_rev\" : \"270652626\", \n              \"_key\" : \"270652626\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/272159954\", \n              \"_rev\" : \"272159954\", \n              \"_key\" : \"272159954\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270390482\" \n            }, \n            { \n              \"_id\" : \"knows/272356562\", \n              \"_rev\" : \"272356562\", \n              \"_key\" : \"272356562\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270652626\" \n            }, \n            { \n              \"_id\" : \"knows/271766738\", \n              \"_rev\" : \"271766738\", \n              \"_key\" : \"271766738\", \n              \"_from\" : \"persons/270652626\", \n              \"_to\" : \"persons/270914770\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/271307986\", \n              \"_rev\" : \"271307986\", \n              \"_key\" : \"271307986\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/270652626\", \n              \"_rev\" : \"270652626\", \n              \"_key\" : \"270652626\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/270914770\", \n              \"_rev\" : \"270914770\", \n              \"_key\" : \"270914770\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/272159954\", \n              \"_rev\" : \"272159954\", \n              \"_key\" : \"272159954\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270390482\" \n            }, \n            { \n              \"_id\" : \"knows/272356562\", \n              \"_rev\" : \"272356562\", \n              \"_key\" : \"272356562\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270652626\" \n            }, \n            { \n              \"_id\" : \"knows/271963346\", \n              \"_rev\" : \"271963346\", \n              \"_key\" : \"271963346\", \n              \"_from\" : \"persons/270652626\", \n              \"_to\" : \"persons/271111378\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/271307986\", \n              \"_rev\" : \"271307986\", \n              \"_key\" : \"271307986\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/270652626\", \n              \"_rev\" : \"270652626\", \n              \"_key\" : \"270652626\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/271111378\", \n              \"_rev\" : \"271111378\", \n              \"_key\" : \"271111378\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/272159954\", \n              \"_rev\" : \"272159954\", \n              \"_key\" : \"272159954\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270390482\" \n            }, \n            { \n              \"_id\" : \"knows/272356562\", \n              \"_rev\" : \"272356562\", \n              \"_key\" : \"272356562\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270652626\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/271307986\", \n              \"_rev\" : \"271307986\", \n              \"_key\" : \"271307986\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/270652626\", \n              \"_rev\" : \"270652626\", \n              \"_key\" : \"270652626\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/272159954\", \n              \"_rev\" : \"272159954\", \n              \"_key\" : \"272159954\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270390482\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/271307986\", \n              \"_rev\" : \"271307986\", \n              \"_key\" : \"271307986\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/271570130\", \n              \"_rev\" : \"271570130\", \n              \"_key\" : \"271570130\", \n              \"_from\" : \"persons/270390482\", \n              \"_to\" : \"persons/270652626\" \n            }, \n            { \n              \"_id\" : \"knows/272356562\", \n              \"_rev\" : \"272356562\", \n              \"_key\" : \"272356562\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270652626\" \n            }, \n            { \n              \"_id\" : \"knows/272159954\", \n              \"_rev\" : \"272159954\", \n              \"_key\" : \"272159954\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270390482\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/270652626\", \n              \"_rev\" : \"270652626\", \n              \"_key\" : \"270652626\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/271307986\", \n              \"_rev\" : \"271307986\", \n              \"_key\" : \"271307986\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/271570130\", \n              \"_rev\" : \"271570130\", \n              \"_key\" : \"271570130\", \n              \"_from\" : \"persons/270390482\", \n              \"_to\" : \"persons/270652626\" \n            }, \n            { \n              \"_id\" : \"knows/272356562\", \n              \"_rev\" : \"272356562\", \n              \"_key\" : \"272356562\", \n              \"_from\" : \"persons/271307986\", \n              \"_to\" : \"persons/270652626\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/270652626\", \n              \"_rev\" : \"270652626\", \n              \"_key\" : \"270652626\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/271307986\", \n              \"_rev\" : \"271307986\", \n              \"_key\" : \"271307986\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/271570130\", \n              \"_rev\" : \"271570130\", \n              \"_key\" : \"271570130\", \n              \"_from\" : \"persons/270390482\", \n              \"_to\" : \"persons/270652626\" \n            }, \n            { \n              \"_id\" : \"knows/271766738\", \n              \"_rev\" : \"271766738\", \n              \"_key\" : \"271766738\", \n              \"_from\" : \"persons/270652626\", \n              \"_to\" : \"persons/270914770\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/270652626\", \n              \"_rev\" : \"270652626\", \n              \"_key\" : \"270652626\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/270914770\", \n              \"_rev\" : \"270914770\", \n              \"_key\" : \"270914770\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/271570130\", \n              \"_rev\" : \"271570130\", \n              \"_key\" : \"271570130\", \n              \"_from\" : \"persons/270390482\", \n              \"_to\" : \"persons/270652626\" \n            }, \n            { \n              \"_id\" : \"knows/271963346\", \n              \"_rev\" : \"271963346\", \n              \"_key\" : \"271963346\", \n              \"_from\" : \"persons/270652626\", \n              \"_to\" : \"persons/271111378\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/270652626\", \n              \"_rev\" : \"270652626\", \n              \"_key\" : \"270652626\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/271111378\", \n              \"_rev\" : \"271111378\", \n              \"_key\" : \"271111378\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/271570130\", \n              \"_rev\" : \"271570130\", \n              \"_key\" : \"271570130\", \n              \"_from\" : \"persons/270390482\", \n              \"_to\" : \"persons/270652626\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/270652626\", \n              \"_rev\" : \"270652626\", \n              \"_key\" : \"270652626\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/270390482\", \n              \"_rev\" : \"270390482\", \n              \"_key\" : \"270390482\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Using backward item-ordering:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/276616402\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"itemOrder\":\"backward\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/276616402\", \n          \"_rev\" : \"276616402\", \n          \"_key\" : \"276616402\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/276878546\", \n          \"_rev\" : \"276878546\", \n          \"_key\" : \"276878546\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/277337298\", \n          \"_rev\" : \"277337298\", \n          \"_key\" : \"277337298\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/277140690\", \n          \"_rev\" : \"277140690\", \n          \"_key\" : \"277140690\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/277533906\", \n          \"_rev\" : \"277533906\", \n          \"_key\" : \"277533906\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/276616402\", \n          \"_rev\" : \"276616402\", \n          \"_key\" : \"276616402\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/277533906\", \n          \"_rev\" : \"277533906\", \n          \"_key\" : \"277533906\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/276878546\", \n          \"_rev\" : \"276878546\", \n          \"_key\" : \"276878546\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/277337298\", \n          \"_rev\" : \"277337298\", \n          \"_key\" : \"277337298\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/277140690\", \n          \"_rev\" : \"277140690\", \n          \"_key\" : \"277140690\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/276616402\", \n          \"_rev\" : \"276616402\", \n          \"_key\" : \"276616402\", \n          \"name\" : \"Alice\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/277796050\", \n              \"_rev\" : \"277796050\", \n              \"_key\" : \"277796050\", \n              \"_from\" : \"persons/276616402\", \n              \"_to\" : \"persons/276878546\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/276878546\", \n              \"_rev\" : \"276878546\", \n              \"_key\" : \"276878546\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/277796050\", \n              \"_rev\" : \"277796050\", \n              \"_key\" : \"277796050\", \n              \"_from\" : \"persons/276616402\", \n              \"_to\" : \"persons/276878546\" \n            }, \n            { \n              \"_id\" : \"knows/278189266\", \n              \"_rev\" : \"278189266\", \n              \"_key\" : \"278189266\", \n              \"_from\" : \"persons/276878546\", \n              \"_to\" : \"persons/277337298\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/276878546\", \n              \"_rev\" : \"276878546\", \n              \"_key\" : \"276878546\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/277337298\", \n              \"_rev\" : \"277337298\", \n              \"_key\" : \"277337298\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/277796050\", \n              \"_rev\" : \"277796050\", \n              \"_key\" : \"277796050\", \n              \"_from\" : \"persons/276616402\", \n              \"_to\" : \"persons/276878546\" \n            }, \n            { \n              \"_id\" : \"knows/277992658\", \n              \"_rev\" : \"277992658\", \n              \"_key\" : \"277992658\", \n              \"_from\" : \"persons/276878546\", \n              \"_to\" : \"persons/277140690\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/276878546\", \n              \"_rev\" : \"276878546\", \n              \"_key\" : \"276878546\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/277140690\", \n              \"_rev\" : \"277140690\", \n              \"_key\" : \"277140690\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/277796050\", \n              \"_rev\" : \"277796050\", \n              \"_key\" : \"277796050\", \n              \"_from\" : \"persons/276616402\", \n              \"_to\" : \"persons/276878546\" \n            }, \n            { \n              \"_id\" : \"knows/278582482\", \n              \"_rev\" : \"278582482\", \n              \"_key\" : \"278582482\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276878546\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/276878546\", \n              \"_rev\" : \"276878546\", \n              \"_key\" : \"276878546\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/277533906\", \n              \"_rev\" : \"277533906\", \n              \"_key\" : \"277533906\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/277796050\", \n              \"_rev\" : \"277796050\", \n              \"_key\" : \"277796050\", \n              \"_from\" : \"persons/276616402\", \n              \"_to\" : \"persons/276878546\" \n            }, \n            { \n              \"_id\" : \"knows/278582482\", \n              \"_rev\" : \"278582482\", \n              \"_key\" : \"278582482\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276878546\" \n            }, \n            { \n              \"_id\" : \"knows/278385874\", \n              \"_rev\" : \"278385874\", \n              \"_key\" : \"278385874\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276616402\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/276878546\", \n              \"_rev\" : \"276878546\", \n              \"_key\" : \"276878546\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/277533906\", \n              \"_rev\" : \"277533906\", \n              \"_key\" : \"277533906\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/278385874\", \n              \"_rev\" : \"278385874\", \n              \"_key\" : \"278385874\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276616402\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/277533906\", \n              \"_rev\" : \"277533906\", \n              \"_key\" : \"277533906\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/278385874\", \n              \"_rev\" : \"278385874\", \n              \"_key\" : \"278385874\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276616402\" \n            }, \n            { \n              \"_id\" : \"knows/278582482\", \n              \"_rev\" : \"278582482\", \n              \"_key\" : \"278582482\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276878546\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/277533906\", \n              \"_rev\" : \"277533906\", \n              \"_key\" : \"277533906\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/276878546\", \n              \"_rev\" : \"276878546\", \n              \"_key\" : \"276878546\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/278385874\", \n              \"_rev\" : \"278385874\", \n              \"_key\" : \"278385874\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276616402\" \n            }, \n            { \n              \"_id\" : \"knows/278582482\", \n              \"_rev\" : \"278582482\", \n              \"_key\" : \"278582482\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276878546\" \n            }, \n            { \n              \"_id\" : \"knows/278189266\", \n              \"_rev\" : \"278189266\", \n              \"_key\" : \"278189266\", \n              \"_from\" : \"persons/276878546\", \n              \"_to\" : \"persons/277337298\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/277533906\", \n              \"_rev\" : \"277533906\", \n              \"_key\" : \"277533906\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/276878546\", \n              \"_rev\" : \"276878546\", \n              \"_key\" : \"276878546\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/277337298\", \n              \"_rev\" : \"277337298\", \n              \"_key\" : \"277337298\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/278385874\", \n              \"_rev\" : \"278385874\", \n              \"_key\" : \"278385874\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276616402\" \n            }, \n            { \n              \"_id\" : \"knows/278582482\", \n              \"_rev\" : \"278582482\", \n              \"_key\" : \"278582482\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276878546\" \n            }, \n            { \n              \"_id\" : \"knows/277992658\", \n              \"_rev\" : \"277992658\", \n              \"_key\" : \"277992658\", \n              \"_from\" : \"persons/276878546\", \n              \"_to\" : \"persons/277140690\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/277533906\", \n              \"_rev\" : \"277533906\", \n              \"_key\" : \"277533906\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/276878546\", \n              \"_rev\" : \"276878546\", \n              \"_key\" : \"276878546\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/277140690\", \n              \"_rev\" : \"277140690\", \n              \"_key\" : \"277140690\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/278385874\", \n              \"_rev\" : \"278385874\", \n              \"_key\" : \"278385874\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276616402\" \n            }, \n            { \n              \"_id\" : \"knows/278582482\", \n              \"_rev\" : \"278582482\", \n              \"_key\" : \"278582482\", \n              \"_from\" : \"persons/277533906\", \n              \"_to\" : \"persons/276878546\" \n            }, \n            { \n              \"_id\" : \"knows/277796050\", \n              \"_rev\" : \"277796050\", \n              \"_key\" : \"277796050\", \n              \"_from\" : \"persons/276616402\", \n              \"_to\" : \"persons/276878546\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/277533906\", \n              \"_rev\" : \"277533906\", \n              \"_key\" : \"277533906\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/276878546\", \n              \"_rev\" : \"276878546\", \n              \"_key\" : \"276878546\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/276616402\", \n              \"_rev\" : \"276616402\", \n              \"_key\" : \"276616402\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

Edges should only be included once globally, but nodes are included every time they are visited:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/282842322\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"global\"}}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        { \n          \"_id\" : \"persons/282842322\", \n          \"_rev\" : \"282842322\", \n          \"_key\" : \"282842322\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/283759826\", \n          \"_rev\" : \"283759826\", \n          \"_key\" : \"283759826\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/283104466\", \n          \"_rev\" : \"283104466\", \n          \"_key\" : \"283104466\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/282842322\", \n          \"_rev\" : \"282842322\", \n          \"_key\" : \"282842322\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/283366610\", \n          \"_rev\" : \"283366610\", \n          \"_key\" : \"283366610\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/283563218\", \n          \"_rev\" : \"283563218\", \n          \"_key\" : \"283563218\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/282842322\", \n              \"_rev\" : \"282842322\", \n              \"_key\" : \"282842322\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/284611794\", \n              \"_rev\" : \"284611794\", \n              \"_key\" : \"284611794\", \n              \"_from\" : \"persons/283759826\", \n              \"_to\" : \"persons/282842322\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/282842322\", \n              \"_rev\" : \"282842322\", \n              \"_key\" : \"282842322\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/283759826\", \n              \"_rev\" : \"283759826\", \n              \"_key\" : \"283759826\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/284611794\", \n              \"_rev\" : \"284611794\", \n              \"_key\" : \"284611794\", \n              \"_from\" : \"persons/283759826\", \n              \"_to\" : \"persons/282842322\" \n            }, \n            { \n              \"_id\" : \"knows/284808402\", \n              \"_rev\" : \"284808402\", \n              \"_key\" : \"284808402\", \n              \"_from\" : \"persons/283759826\", \n              \"_to\" : \"persons/283104466\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/282842322\", \n              \"_rev\" : \"282842322\", \n              \"_key\" : \"282842322\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/283759826\", \n              \"_rev\" : \"283759826\", \n              \"_key\" : \"283759826\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/283104466\", \n              \"_rev\" : \"283104466\", \n              \"_key\" : \"283104466\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/284611794\", \n              \"_rev\" : \"284611794\", \n              \"_key\" : \"284611794\", \n              \"_from\" : \"persons/283759826\", \n              \"_to\" : \"persons/282842322\" \n            }, \n            { \n              \"_id\" : \"knows/284808402\", \n              \"_rev\" : \"284808402\", \n              \"_key\" : \"284808402\", \n              \"_from\" : \"persons/283759826\", \n              \"_to\" : \"persons/283104466\" \n            }, \n            { \n              \"_id\" : \"knows/284021970\", \n              \"_rev\" : \"284021970\", \n              \"_key\" : \"284021970\", \n              \"_from\" : \"persons/282842322\", \n              \"_to\" : \"persons/283104466\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/282842322\", \n              \"_rev\" : \"282842322\", \n              \"_key\" : \"282842322\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/283759826\", \n              \"_rev\" : \"283759826\", \n              \"_key\" : \"283759826\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/283104466\", \n              \"_rev\" : \"283104466\", \n              \"_key\" : \"283104466\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/282842322\", \n              \"_rev\" : \"282842322\", \n              \"_key\" : \"282842322\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/284611794\", \n              \"_rev\" : \"284611794\", \n              \"_key\" : \"284611794\", \n              \"_from\" : \"persons/283759826\", \n              \"_to\" : \"persons/282842322\" \n            }, \n            { \n              \"_id\" : \"knows/284808402\", \n              \"_rev\" : \"284808402\", \n              \"_key\" : \"284808402\", \n              \"_from\" : \"persons/283759826\", \n              \"_to\" : \"persons/283104466\" \n            }, \n            { \n              \"_id\" : \"knows/284218578\", \n              \"_rev\" : \"284218578\", \n              \"_key\" : \"284218578\", \n              \"_from\" : \"persons/283104466\", \n              \"_to\" : \"persons/283366610\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/282842322\", \n              \"_rev\" : \"282842322\", \n              \"_key\" : \"282842322\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/283759826\", \n              \"_rev\" : \"283759826\", \n              \"_key\" : \"283759826\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/283104466\", \n              \"_rev\" : \"283104466\", \n              \"_key\" : \"283104466\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/283366610\", \n              \"_rev\" : \"283366610\", \n              \"_key\" : \"283366610\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/284611794\", \n              \"_rev\" : \"284611794\", \n              \"_key\" : \"284611794\", \n              \"_from\" : \"persons/283759826\", \n              \"_to\" : \"persons/282842322\" \n            }, \n            { \n              \"_id\" : \"knows/284808402\", \n              \"_rev\" : \"284808402\", \n              \"_key\" : \"284808402\", \n              \"_from\" : \"persons/283759826\", \n              \"_to\" : \"persons/283104466\" \n            }, \n            { \n              \"_id\" : \"knows/284415186\", \n              \"_rev\" : \"284415186\", \n              \"_key\" : \"284415186\", \n              \"_from\" : \"persons/283104466\", \n              \"_to\" : \"persons/283563218\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/282842322\", \n              \"_rev\" : \"282842322\", \n              \"_key\" : \"282842322\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/283759826\", \n              \"_rev\" : \"283759826\", \n              \"_key\" : \"283759826\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/283104466\", \n              \"_rev\" : \"283104466\", \n              \"_key\" : \"283104466\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/283563218\", \n              \"_rev\" : \"283563218\", \n              \"_key\" : \"283563218\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

If the underlying graph is cyclic, maxIterations should be set: The underlying graph has two vertices Alice and Bob. With the directed edges: - Alice knows Bob _ Bob knows Alice

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/traversal\n{\"startVertex\":\"persons/288150738\",\"edgeCollection\":\"knows\",\"direction\":\"any\",\"uniqueness\":{\"vertices\":\"none\",\"edges\":\"none\"},\"maxIterations\":5}\n\nHTTP/1.1 500 Internal Error\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 500, \n  \"errorNum\" : 1909, \n  \"errorMessage\" : \"too many iterations\" \n}\n\n

", "nickname": "executesATraversal" } ], diff --git a/html/admin/css/documentsView.css b/html/admin/css/documentsView.css index ccf3d87507..bce0d49a4a 100644 --- a/html/admin/css/documentsView.css +++ b/html/admin/css/documentsView.css @@ -398,3 +398,13 @@ table.dataTable thead th { margin-left: 10px !important; margin-right: 10px !important; } + +.readOnlyClass a { + color: black !important; +} + +.readOnlyClass a:hover { + color: black !important; + opacity: 0.8 !important; +} + diff --git a/html/admin/js/graphViewer/graph/arangoAdapter.js b/html/admin/js/graphViewer/graph/arangoAdapter.js index 2eebe50044..1e601252bb 100644 --- a/html/admin/js/graphViewer/graph/arangoAdapter.js +++ b/html/admin/js/graphViewer/graph/arangoAdapter.js @@ -584,12 +584,16 @@ function ArangoAdapter(nodes, edges, config) { self.getAttributeExamples = function(callback) { if (callback && callback.length >= 1) { getNRandom(10, function(l) { - var ret = _.uniq( - _.flatten( - _.map(l, function(o) { - return _.keys(o); - }) - ) + var ret = _.sortBy( + _.uniq( + _.flatten( + _.map(l, function(o) { + return _.keys(o); + }) + ) + ), function(e) { + return e.toLowerCase(); + } ); callback(ret); }); diff --git a/html/admin/js/graphViewer/ui/arangoAdapterControls.js b/html/admin/js/graphViewer/ui/arangoAdapterControls.js index 199268c6f2..03be1dc36a 100644 --- a/html/admin/js/graphViewer/ui/arangoAdapterControls.js +++ b/html/admin/js/graphViewer/ui/arangoAdapterControls.js @@ -77,7 +77,7 @@ function ArangoAdapterControls(list, adapter) { objects: graphs } ] - },,{ + },{ type: "checkbox", id: "undirected" }], function () { @@ -86,12 +86,11 @@ function ArangoAdapterControls(list, adapter) { graph = $("#" + idprefix + "graph").attr("value"), undirected = !!$("#" + idprefix + "undirected").attr("checked"), selected = $("input[type='radio'][name='loadtype']:checked").attr("id"); - if (selected === "collections") { + if (selected === idprefix + "collections") { adapter.changeToCollections(nodes, edges, undirected); } else { adapter.changeToGraph(graph, undirected); } - if (_.isFunction(callback)) { callback(); } diff --git a/html/admin/js/graphViewer/ui/modalDialogHelper.js b/html/admin/js/graphViewer/ui/modalDialogHelper.js index 3a0545c1ed..4148bb757e 100644 --- a/html/admin/js/graphViewer/ui/modalDialogHelper.js +++ b/html/admin/js/graphViewer/ui/modalDialogHelper.js @@ -187,7 +187,10 @@ var modalDialogHelper = modalDialogHelper || {}; createListInput = function(id, list) { var input = document.createElement("select"); input.id = id; - _.each(list, function(entry) { + _.each( + _.sortBy(list, function(e) { + return e.toLowerCase(); + }), function(entry) { var option = document.createElement("option"); option.value = entry; option.appendChild( diff --git a/html/admin/js/graphViewer/ui/nodeShaperControls.js b/html/admin/js/graphViewer/ui/nodeShaperControls.js index 09a78a5738..acc756b9a0 100644 --- a/html/admin/js/graphViewer/ui/nodeShaperControls.js +++ b/html/admin/js/graphViewer/ui/nodeShaperControls.js @@ -225,14 +225,37 @@ function NodeShaperControls(list, shaper) { modalDialogHelper.createModalDialog("Switch Label Attribute", idprefix, [{ type: "text", - id: "attribute" + id: "label-attribute" + },{ + type: "decission", + id: "samecolour", + group: "colour", + text: "Use same for colour", + isDefault: true + },{ + type: "decission", + id: "othercolour", + group: "colour", + text: "Use other for colour", + isDefault: false, + interior: [ + { + type: "text", + id: "colour-attribute" + } + ] }], function () { - var key = $("#" + idprefix + "key").attr("value"); + var key = $("#" + idprefix + "label-attribute").attr("value"), + colourkey = $("#" + idprefix + "colour-attribute").attr("value"), + selected = $("input[type='radio'][name='colour']:checked").attr("id"); + if (selected === idprefix + "samecolour") { + colourkey = key + } shaper.changeTo({ label: key, color: { type: "attribute", - key: key + key: colourkey } }); if (colourDiv === undefined) { diff --git a/html/admin/js/modules/org/arangodb/graph.js b/html/admin/js/modules/org/arangodb/graph.js index 3a9032f1c0..00957e1df3 100644 --- a/html/admin/js/modules/org/arangodb/graph.js +++ b/html/admin/js/modules/org/arangodb/graph.js @@ -234,9 +234,18 @@ Graph.prototype.initialize = function (name, vertices, edges) { /// @{ //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// @brief return all graphs +//////////////////////////////////////////////////////////////////////////////// + +Graph.getAll = function () { + return GraphAPI.getAllGraphs(); +}; + //////////////////////////////////////////////////////////////////////////////// /// @brief drops the graph, the vertices, and the edges //////////////////////////////////////////////////////////////////////////////// + Graph.prototype.drop = function () { GraphAPI.deleteGraph(this._properties._key); }; diff --git a/html/admin/js/templates/graphView.ejs b/html/admin/js/templates/graphView.ejs index 9b732c1ae3..5b6e762425 100644 --- a/html/admin/js/templates/graphView.ejs +++ b/html/admin/js/templates/graphView.ejs @@ -16,28 +16,52 @@ console.log(ds, es);
Configuration -
- -
- + + +
+
+ +
+ +
+
+ +
+ +
+ +
- -
- -
- + + + - +
@@ -66,9 +90,9 @@ console.log(ds, es);
- +
- +
diff --git a/html/admin/js/views/collectionsView.js b/html/admin/js/views/collectionsView.js index eda5d53325..b0d73249b2 100644 --- a/html/admin/js/views/collectionsView.js +++ b/html/admin/js/views/collectionsView.js @@ -8,20 +8,6 @@ var collectionsView = Backbone.View.extend({ searchTimeout: null, initialize: function () { - var self = this; - self.system = {}; - $.ajax({ - type: "GET", - cache: false, - url: "/_admin/version", - contentType: "application/json", - processData: false, - async: false, - success: function(data) { - self.system.name = data.server; - self.system.version = data.version; - } - }); }, template: new EJS({url: 'js/templates/collectionsView.ejs'}), @@ -58,7 +44,6 @@ var collectionsView = Backbone.View.extend({ $('#searchInput').val(''); $('#searchInput').val(val); - $('.footer-right p').html(this.system.name+' : '+this.system.version); return this; }, diff --git a/html/admin/js/views/documentView.js b/html/admin/js/views/documentView.js index 7d52ddd80b..18e59ac403 100644 --- a/html/admin/js/views/documentView.js +++ b/html/admin/js/views/documentView.js @@ -260,7 +260,7 @@ var documentView = Backbone.View.extend({ return (""+ self.escaped(JSON.stringify(value)) + ""); } }; - return (isReadOnly ? "(read-only) " : "") + typify(value); + return (isReadOnly ? '' : '') + typify(value) + ''; }, escaped: function (value) { diff --git a/html/admin/js/views/documentsView.js b/html/admin/js/views/documentsView.js index b427a196bb..e280e3c2a3 100644 --- a/html/admin/js/views/documentsView.js +++ b/html/admin/js/views/documentsView.js @@ -9,6 +9,8 @@ var documentsView = Backbone.View.extend({ filters : { "0" : true }, filterId : 0, + addDocumentSwitch: true, + allowUpload: false, collectionContext : { @@ -86,6 +88,8 @@ var documentsView = Backbone.View.extend({ this.removeAllFilterItems(); this.clearTable(); + $('#documentsToolbarF ul').css("visibility", "visible"); + this.addDocumentSwitch = true; window.arangoDocumentsStore.getDocuments(this.collectionID, 1); }, @@ -97,7 +101,7 @@ var documentsView = Backbone.View.extend({ type: "POST", async: false, url: - '/_api/import?type=documents&collection='+ + '/_api/import?type=auto&collection='+ encodeURIComponent(self.colid)+ '&createCollection=false', data: self.file, @@ -107,7 +111,28 @@ var documentsView = Backbone.View.extend({ complete: function(xhr) { if (xhr.readyState === 4) { if (xhr.status === 201) { - arangoHelper.arangoNotification("Upload successful"); + var data; + + try { + data = JSON.parse(xhr.responseText); + } + + catch (e) { + arangoHelper.arangoNotification("Error: "+ e); + self.hideSpinner(); + self.hideImportModal(); + self.resetView(); + return; + } + + if (data.errors === 0) { + arangoHelper.arangoNotification("Upload successful. " + + data.created + "document(s) imported."); + } + else if (data.errors !== 0) { + arangoHelper.arangoNotification("Upload failed." + + data.errors + "error(s)."); + } self.hideSpinner(); self.hideImportModal(); self.resetView(); @@ -202,8 +227,10 @@ var documentsView = Backbone.View.extend({ } } + this.addDocumentSwitch = false; window.documentsView.clearTable(); window.arangoDocumentsStore.getFilteredDocuments(this.colid, 1, filters, bindValues); + $('#documentsToolbarF ul').css("visibility", "hidden"); }, addFilterItem : function () { @@ -426,13 +453,15 @@ var documentsView = Backbone.View.extend({ drawTable: function() { var self = this; - $(self.table).dataTable().fnAddData( - [ - 'Add document', - '', - '' - ] - ); + if (this.addDocumentSwitch === true) { + $(self.table).dataTable().fnAddData( + [ + 'Add document', + '', + '' + ] + ); + } $.each(window.arangoDocumentsStore.models, function(key, value) { diff --git a/html/admin/js/views/footerView.js b/html/admin/js/views/footerView.js index c5512d5e50..bfdb15a5ba 100644 --- a/html/admin/js/views/footerView.js +++ b/html/admin/js/views/footerView.js @@ -3,13 +3,28 @@ var footerView = Backbone.View.extend({ el: '.footer', - init: function () { + initialize: function () { + var self = this; + self.system = {}; + $.ajax({ + type: "GET", + cache: false, + url: "/_admin/version", + contentType: "application/json", + processData: false, + async: false, + success: function(data) { + self.system.name = data.server; + self.system.version = data.version; + } + }); }, template: new EJS({url: 'js/templates/footerView.ejs'}), render: function() { $(this.el).html(this.template.text); + $('.footer-right p').html(this.system.name+' : '+this.system.version); return this; } diff --git a/html/admin/js/views/graphView.js b/html/admin/js/views/graphView.js index 67fd3a1696..cda3f16c44 100644 --- a/html/admin/js/views/graphView.js +++ b/html/admin/js/views/graphView.js @@ -1,5 +1,5 @@ /*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, forin: true */ -/*global Backbone, $, window, EJS, GraphViewerUI */ +/*global Backbone, $, _, window, EJS, GraphViewerUI */ window.graphView = Backbone.View.extend({ el: '#content', @@ -8,11 +8,33 @@ window.graphView = Backbone.View.extend({ initialize: function () { var self = this; - + this.graphs = []; + $.ajax({ + cache: false, + type: 'GET', + url: "/_api/graph", + contentType: "application/json", + success: function(data) { + self.graphs = _.pluck(data.graphs, "_key"); + self.render(); + } + }); }, events: { - "click #createViewer" : "createViewer" + "click input[type='radio'][name='loadtype']": "toggleLoadtypeDisplay", + "click #createViewer": "createViewer" + }, + + toggleLoadtypeDisplay: function() { + var selected = $("input[type='radio'][name='loadtype']:checked").attr("id"); + if (selected === "collections") { + $("#collection_config").css("display", "block"); + $("#graph_config").css("display", "none"); + } else { + $("#collection_config").css("display", "none"); + $("#graph_config").css("display", "block"); + } }, createViewer: function() { @@ -63,15 +85,11 @@ window.graphView = Backbone.View.extend({ } else { ui = new GraphViewerUI($("#content")[0], aaconfig, 940, 680, config); } - - - - }, render: function() { - $(this.el).html(this.template.render({col: this.collection})); + $(this.el).html(this.template.render({col: this.collection, gs: this.graphs})); return this; } diff --git a/html/admin/js/views/queryView.js b/html/admin/js/views/queryView.js index baf4283f44..67235c9444 100644 --- a/html/admin/js/views/queryView.js +++ b/html/admin/js/views/queryView.js @@ -95,7 +95,6 @@ var queryView = Backbone.View.extend({ inputEditor.getSession().setMode("ace/mode/aql"); outputEditor.getSession().setMode("ace/mode/json"); - inputEditor.setTheme("ace/theme/merbivore_soft"); outputEditor.setValue(''); $('#queryOutput').resizable({ @@ -142,7 +141,11 @@ var queryView = Backbone.View.extend({ inputEditor.resize(); outputEditor.resize(); + inputEditor.setTheme("ace/theme/merbivore_soft"); + this.renderSelectboxes(); + this.deselect(outputEditor); + this.deselect(inputEditor); $('#queryDiv').show(); return this; @@ -426,7 +429,6 @@ var queryView = Backbone.View.extend({ var self = this; var inputEditor = ace.edit("aqlEditor"); var data = {query: inputEditor.getValue()}; - var outputEditor = ace.edit("queryOutput"); $.ajax({ @@ -441,6 +443,7 @@ var queryView = Backbone.View.extend({ localStorage.setItem("queryContent", inputEditor.getValue()); localStorage.setItem("queryOutput", outputEditor.getValue()); } + self.deselect(outputEditor); }, error: function(data) { try { diff --git a/html/admin/src/theme-merbivore_soft.js b/html/admin/src/theme-merbivore_soft.js index ee89a94048..23b04e91a2 100644 --- a/html/admin/src/theme-merbivore_soft.js +++ b/html/admin/src/theme-merbivore_soft.js @@ -119,7 +119,7 @@ border-color: #E6E1DC\ .ace-merbivore-soft .ace_comment,\ .ace-merbivore-soft .ace_meta {\ font-style: italic;\ -color: #AC4BB8\ +color: #8AA051\ }\ .ace-merbivore-soft .ace_entity.ace_other.ace_attribute-name {\ color: #EAF1A3\ diff --git a/js/actions/api-graph.js b/js/actions/api-graph.js index b5385010f4..bcee051210 100644 --- a/js/actions/api-graph.js +++ b/js/actions/api-graph.js @@ -130,7 +130,7 @@ function graph_by_request (req) { } //////////////////////////////////////////////////////////////////////////////// - /// @brief returns true if a "if-match" or "if-none-match" errer happens + /// @brief returns true if a "if-match" or "if-none-match" error happens //////////////////////////////////////////////////////////////////////////////// function matchError (req, res, doc, errorCode) { @@ -282,21 +282,27 @@ function post_graph_graph (req, res) { //////////////////////////////////////////////////////////////////////////////// /// @brief get graph properties /// -/// @RESTHEADER{GET /_api/graph/{graph-name},get graph properties} +/// @RESTHEADER{GET /_api/graph/{graph-name},get the properties of a specific or all graphs} /// /// @RESTURLPARAMETERS /// -/// @RESTURLPARAM{graph-name,string,required} -/// The name of the graph +/// @RESTURLPARAM{graph-name,string,optional} +/// The name of the graph. /// /// @RESTHEADERPARAMETERS /// /// @RESTHEADERPARAM{If-None-Match,string,optional} +/// If `graph-name` is specified, then this header can be used to check +/// whether a specific graph has changed or not. +/// /// If the "If-None-Match" header is given, then it must contain exactly one -/// etag. The document is returned, if it has a different revision than the +/// etag. The document is returned if it has a different revision than the /// given etag. Otherwise a `HTTP 304` is returned. /// /// @RESTHEADERPARAM{If-Match,string,optional} +/// If `graph-name` is specified, then this header can be used to check +/// whether a specific graph has changed or not. +/// /// If the "If-Match" header is given, then it must contain exactly one /// etag. The document is returned, if it has the same revision ad the /// given etag. Otherwise a `HTTP 412` is returned. As an alternative @@ -304,25 +310,32 @@ function post_graph_graph (req, res) { /// /// @RESTDESCRIPTION /// -/// Returns an object with an attribute `graph` containing a -/// list of all graph properties. +/// If `graph-name` is specified, returns an object with an attribute `graph` +/// containing a JSON hash with all properties of the specified graph. +/// +/// If `graph-name` is not specified, returns a list of graph objects. /// /// @RESTRETURNCODES /// /// @RESTRETURNCODE{200} -/// is returned if the graph was found +/// is returned if the graph was found (in case `graph-name` was specified) +/// or the list of graphs was assembled successfully (in case `graph-name` +/// was not specified). /// /// @RESTRETURNCODE{404} -/// is returned if the graph was not found. +/// is returned if the graph was not found. This response code may only be +/// returned if `graph-name` is specified in the request. /// The response body contains an error document in this case. /// /// @RESTRETURNCODE{304} /// "If-None-Match" header is given and the current graph has not a different -/// version +/// version. This response code may only be returned if `graph-name` is +/// specified in the request. /// /// @RESTRETURNCODE{412} /// "If-Match" header or `rev` is given and the current graph has -/// a different version +/// a different version. This response code may only be returned if `graph-name` +/// is specified in the request. /// /// @EXAMPLES /// @@ -341,6 +354,26 @@ function post_graph_graph (req, res) { /// db._drop("vertices"); /// db._graphs.remove("graph"); /// @END_EXAMPLE_ARANGOSH_RUN +/// +/// get all graphs +/// +/// @EXAMPLE_ARANGOSH_RUN{RestGraphGetGraphs} +/// var Graph = require("org/arangodb/graph").Graph; +/// new Graph("graph1", "vertices1", "edges1"); +/// new Graph("graph2", "vertices2", "edges2"); +/// var url = "/_api/graph"; +/// var response = logCurlRequest('GET', url); +/// +/// assert(response.code === 200); +/// +/// logJsonResponse(response); +/// db._drop("edges1"); +/// db._drop("vertices2"); +/// db._drop("edges1"); +/// db._drop("vertices2"); +/// db._graphs.remove("graph1"); +/// db._graphs.remove("graph2"); +/// @END_EXAMPLE_ARANGOSH_RUN //////////////////////////////////////////////////////////////////////////////// function get_graph_graph (req, res) { @@ -355,7 +388,7 @@ function get_graph_graph (req, res) { "Etag" : g._properties._rev }; - actions.resultOk(req, res, actions.HTTP_OK, { "graph" : g._properties}, headers ); + actions.resultOk(req, res, actions.HTTP_OK, { "graph" : g._properties }, headers ); } catch (err) { actions.resultNotFound(req, res, arangodb.ERROR_GRAPH_INVALID_GRAPH, err); @@ -799,7 +832,6 @@ function update_graph_vertex (req, res, g, isPatch) { } } - //////////////////////////////////////////////////////////////////////////////// /// @brief updates a vertex /// @@ -2176,8 +2208,9 @@ function post_graph (req, res) { function get_graph (req, res) { if (req.suffix.length === 0) { - // GET /_api/graph - actions.resultUnsupported(req, res); + // GET /_api/graph: return all graphs + + actions.resultOk(req, res, actions.HTTP_OK, { "graphs" : graph.Graph.getAll() }); } else if (req.suffix.length === 1) { // GET /_api/graph/ diff --git a/js/actions/api-transaction.js b/js/actions/api-transaction.js index ba6c976055..3d0ffc527b 100644 --- a/js/actions/api-transaction.js +++ b/js/actions/api-transaction.js @@ -78,6 +78,9 @@ var actions = require("org/arangodb/actions"); /// value will be used. Setting `lockTimeout` to `0` will make ArangoDB /// not time out waiting for a lock. /// +/// - `replicate`: whether or not to replicate the operations from this +/// transaction. If not specified, the default value is `true`. +/// /// - `params`: optional arguments passed to `action`. /// /// If the transaction is fully executed and committed on the server, @@ -137,11 +140,15 @@ var actions = require("org/arangodb/actions"); /// db._drop(cn); /// var products = db._create(cn); /// var url = "/_api/transaction"; -/// var body = '{ "collections": { "write" : "products" }, '; -/// body += '"action" : "function () { '; -/// body += 'var db = require(\\"internal\\").db;'; -/// body += 'db.products.save({});'; -/// body += 'return db.products.count(); }" }'; +/// var body = { +/// collections: { +/// write : "products" +/// }, +/// action: "function () { " + +/// "var db = require('internal').db; " + +/// "db.products.save({}); " + +/// "return db.products.count(); }" +/// }; /// /// var response = logCurlRequest('POST', url, body); /// assert(response.code === 200); @@ -160,15 +167,18 @@ var actions = require("org/arangodb/actions"); /// db._drop(cn2); /// var products = db._create(cn2); /// products.save({ "a": 1}); -/// materials.save({"b": 1}); +/// materials.save({ "b": 1}); /// var url = "/_api/transaction"; -/// var body = '{ "collections": { "write" : ["products", '; -/// body += '"materials" ] }, '; -/// body += '"action" : "function () { '; -/// body += 'var db = require(\\"internal\\").db;'; -/// body += 'db.products.save({});'; -/// body += 'db.materials.save({});'; -/// body += 'return \\"worked!\\"; }" }'; +/// var body = { +/// collections: { +/// write : [ "products", "materials" ] +/// }, +/// action: "function () { " + +/// "var db = require('internal').db; " + +/// "db.products.save({}); " + +/// "db.materials.save({}); " + +/// "return 'worked!'; }" +/// }; /// /// var response = logCurlRequest('POST', url, body); /// assert(response.code === 200); @@ -185,11 +195,15 @@ var actions = require("org/arangodb/actions"); /// db._drop(cn); /// var products = db._create(cn); /// var url = "/_api/transaction"; -/// var body = '{ "collections": { "write" : "products" }, '; -/// body += '"action" : "function () { '; -/// body += 'var db = require(\\"internal\\").db;'; -/// body += 'db.products.save({_key: \\"abc\\"});'; -/// body += 'db.products.save({_key: \\"abc\\"});'; +/// var body = { +/// collections: { +/// write : "products" +/// }, +/// action : "function () { " + +/// "var db = require('internal').db; " + +/// "db.products.save({ _key: 'abc'}); " + +/// "db.products.save({ _key: 'abc'}); }" +/// }; /// /// var response = logCurlRequest('POST', url, body); /// assert(response.code === 400); @@ -198,16 +212,20 @@ var actions = require("org/arangodb/actions"); /// db._drop(cn); /// @END_EXAMPLE_ARANGOSH_RUN /// -/// Aborting a transaction by throwing an exception: +/// Aborting a transaction by explicitly throwing an exception: /// /// @EXAMPLE_ARANGOSH_RUN{RestTransactionAbort} /// var cn = "products"; /// db._drop(cn); /// var products = db._create(cn, { waitForSync: true }); -/// products.save({ "a": 1}); +/// products.save({ "a": 1 }); /// var url = "/_api/transaction"; -/// var body = '{ "collections": { "read" : "products" }, '; -/// body += '"action" : "function () { throw \\"doh!\\"; }" }'; +/// var body = { +/// collections: { +/// read : "products" +/// }, +/// action : "function () { throw 'doh!'; }" +/// }; /// /// var response = logCurlRequest('POST', url, body); /// assert(response.code === 500); @@ -215,6 +233,25 @@ var actions = require("org/arangodb/actions"); /// logJsonResponse(response); /// db._drop(cn); /// @END_EXAMPLE_ARANGOSH_RUN +/// +/// Referring to a non-existing collection: +/// +/// @EXAMPLE_ARANGOSH_RUN{RestTransactionNonExisting} +/// var cn = "products"; +/// db._drop(cn); +/// var url = "/_api/transaction"; +/// var body = { +/// collections: { +/// read : "products" +/// }, +/// action : "function () { return true; }" +/// }; +/// +/// var response = logCurlRequest('POST', url, body); +/// assert(response.code === 404); +/// +/// logJsonResponse(response); +/// @END_EXAMPLE_ARANGOSH_RUN //////////////////////////////////////////////////////////////////////////////// function post_api_transaction(req, res) { diff --git a/js/client/modules/org/arangodb/api/graph.js b/js/client/modules/org/arangodb/api/graph.js index 894e362eff..32af0a7b50 100644 --- a/js/client/modules/org/arangodb/api/graph.js +++ b/js/client/modules/org/arangodb/api/graph.js @@ -58,6 +58,12 @@ GraphAPI = { return GraphAPI.sendWithoutData("GET", graphKey, ""); }, + getAllGraphs: function () { + var results = arangodb.arango.GET("/_api/graph"); + arangosh.checkRequestResult(results); + return results.graphs; + }, + postGraph: function (data) { var results = arangodb.arango.POST("/_api/graph", JSON.stringify(data)); arangosh.checkRequestResult(results); diff --git a/js/client/modules/org/arangodb/graph.js b/js/client/modules/org/arangodb/graph.js index f305f5aaf9..4e67b33d65 100644 --- a/js/client/modules/org/arangodb/graph.js +++ b/js/client/modules/org/arangodb/graph.js @@ -233,9 +233,18 @@ Graph.prototype.initialize = function (name, vertices, edges) { /// @{ //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// @brief return all graphs +//////////////////////////////////////////////////////////////////////////////// + +Graph.getAll = function () { + return GraphAPI.getAllGraphs(); +}; + //////////////////////////////////////////////////////////////////////////////// /// @brief drops the graph, the vertices, and the edges //////////////////////////////////////////////////////////////////////////////// + Graph.prototype.drop = function () { GraphAPI.deleteGraph(this._properties._key); }; diff --git a/js/server/modules/org/arangodb/graph.js b/js/server/modules/org/arangodb/graph.js index 7f8ad88509..e203fdb429 100644 --- a/js/server/modules/org/arangodb/graph.js +++ b/js/server/modules/org/arangodb/graph.js @@ -511,6 +511,32 @@ Graph.prototype.initialize = function (name, vertices, edges, waitForSync) { /// @{ //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// @fn JSF_graph_getAll +/// @brief returns all available graphs +/// +/// @FUN{@FA{graph}.getAll()} +/// +/// Returns all available graphs. +//////////////////////////////////////////////////////////////////////////////// + +function getAllGraphs () { + var gdb = db._collection("_graphs"), + graphs = [ ]; + + gdb.toArray().forEach(function(doc) { + var g = new Graph(doc._key); + + if (g._properties !== null) { + graphs.push(g._properties); + } + }); + + return graphs; +} + +Graph.getAll = getAllGraphs; + //////////////////////////////////////////////////////////////////////////////// /// @brief drops the graph, the vertices, and the edges ///