From 0420d77e432a664ace0222084615f1ad34c3f378 Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Mon, 23 Sep 2019 00:54:13 -0400 Subject: [PATCH 01/13] Add jmh. --- .gitignore | 1 + pom.xml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/.gitignore b/.gitignore index fef5738..c855f72 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /target /.idea /*.iml +*.jfr diff --git a/pom.xml b/pom.xml index 8b1aeca..1226c03 100644 --- a/pom.xml +++ b/pom.xml @@ -27,6 +27,8 @@ 1.1.3 1.3 4.12 + 1.21 + 8.6.19 @@ -214,6 +216,21 @@ hamcrest-all test + + org.openjdk.jmh + jmh-core + test + + + org.openjdk.jmh + jmh-generator-annprocess + test + + + org.spf4j + spf4j-jmh + test + @@ -243,6 +260,24 @@ hamcrest-all ${hamcrest-all.version} + + org.openjdk.jmh + jmh-core + ${jmh.version} + test + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh.version} + test + + + org.spf4j + spf4j-jmh + ${spf4j-jmh.version} + test + From d5b6043c362194394449ece0b91fa8ee94395604 Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Mon, 23 Sep 2019 00:54:25 -0400 Subject: [PATCH 02/13] Add first benchmark. --- .../java/com/arangodb/velocypack/Bench.java | 64 + src/test/resources/api-docs.json | 7377 +++++++++++++++++ 2 files changed, 7441 insertions(+) create mode 100644 src/test/java/com/arangodb/velocypack/Bench.java create mode 100644 src/test/resources/api-docs.json diff --git a/src/test/java/com/arangodb/velocypack/Bench.java b/src/test/java/com/arangodb/velocypack/Bench.java new file mode 100644 index 0000000..e174248 --- /dev/null +++ b/src/test/java/com/arangodb/velocypack/Bench.java @@ -0,0 +1,64 @@ +package com.arangodb.velocypack; + +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.infra.Blackhole; +import org.openjdk.jmh.profile.GCProfiler; +import org.openjdk.jmh.profile.StackProfiler; +import org.openjdk.jmh.results.format.ResultFormatType; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.RunnerException; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; +import org.spf4j.stackmonitor.JmhFlightRecorderProfiler; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.concurrent.TimeUnit; + +@Warmup(iterations = 8, time = 1, timeUnit = TimeUnit.SECONDS) +@Measurement(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +@Fork(3) +public class Bench { + @State(Scope.Benchmark) + public static class Data { + + public final String str; + + public Data() { + try { + this.str = new String( + Files.readAllBytes( + Paths.get(this.getClass().getResource("/api-docs.json").toURI()) + ) + ); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + public static void main(String[] args) throws RunnerException { + Options opt = new OptionsBuilder() + .include(Bench.class.getSimpleName()) + .addProfiler(GCProfiler.class) + .addProfiler(JmhFlightRecorderProfiler.class) + .jvmArgs("-Xmx256m", "-Xms256m", "-XX:+UnlockCommercialFeatures") // https://stackoverflow.com/a/37857708 + .resultFormat(ResultFormatType.JSON) + .result("target/jmh-result-" + System.currentTimeMillis() + ".json") + .build(); + + new Runner(opt).run(); + } + + + @Benchmark + public void fromJson(Data data, Blackhole bh) { + VPackParser parser = new VPackParser.Builder().build(); + VPackSlice slice = parser.fromJson(data.str); + bh.consume(slice); + } +} diff --git a/src/test/resources/api-docs.json b/src/test/resources/api-docs.json new file mode 100644 index 0000000..d23f573 --- /dev/null +++ b/src/test/resources/api-docs.json @@ -0,0 +1,7377 @@ +{ + "basePath": "/", + "definitions": { + "JSA_get_api_collection_figures_rc_200": { + "properties": { + "count": { + "description": "The number of documents currently present in the collection.
", + "format": "int64", + "type": "integer" + }, + "figures": { + "$ref": "#/definitions/collection_figures" + }, + "journalSize": { + "description": "The maximal size of a journal or datafile in bytes.
", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "count", + "journalSize" + ], + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "JSA_put_api_simple_any": { + "properties": { + "collection": { + "description": "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 document attrbute contains null.
", + "type": "string" + } + }, + "required": [ + "collection" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_by_example": { + "properties": { + "collection": { + "description": "The name of the collection to query.
", + "type": "string" + }, + "example": { + "description": "The example document.
", + "type": "string" + }, + "limit": { + "description": "The maximal amount of documents to return. The skip is applied before the limit restriction. (optional)
", + "type": "string" + }, + "skip": { + "description": "The number of documents to skip in the query (optional).
", + "type": "string" + } + }, + "required": [ + "collection", + "example", + "skip", + "limit" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_first": { + "properties": { + "collection": { + "description": "the name of the collection
", + "type": "string" + }, + "count": { + "description": "the number of documents to return at most. Specifying count is optional. If it is not specified, it defaults to 1.
", + "type": "string" + } + }, + "required": [ + "collection" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_first_example": { + "properties": { + "collection": { + "description": "The name of the collection to query.
", + "type": "string" + }, + "example": { + "description": "The example document.
", + "type": "string" + } + }, + "required": [ + "collection", + "example" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_fulltext": { + "properties": { + "attribute": { + "description": "The attribute that contains the texts.
", + "type": "string" + }, + "collection": { + "description": "The name of the collection to query.
", + "type": "string" + }, + "index": { + "description": "The identifier of the fulltext-index to use.
", + "type": "string" + }, + "limit": { + "description": "The maximal amount of documents to return. The skip is applied before the limit restriction. (optional)
", + "type": "string" + }, + "query": { + "description": "The fulltext query. Please refer to [Fulltext queries](../SimpleQueries/FulltextQueries.html) for details.
", + "type": "string" + }, + "skip": { + "description": "The number of documents to skip in the query (optional).
", + "type": "string" + } + }, + "required": [ + "collection", + "attribute", + "query", + "skip", + "limit", + "index" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_last": { + "properties": { + "collection": { + "description": " the name of the collection
", + "type": "string" + }, + "count": { + "description": "the number of documents to return at most. Specifying count is optional. If it is not specified, it defaults to 1.
", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "collection", + "count" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_near": { + "properties": { + "collection": { + "description": "The name of the collection to query.
", + "type": "string" + }, + "distance": { + "description": "If given, the attribute key used to return the distance to the given coordinate. (optional). If specified, distances are returned in meters.
", + "type": "string" + }, + "geo": { + "description": "If given, the identifier of the geo-index to use. (optional)
", + "type": "string" + }, + "latitude": { + "description": "The latitude of the coordinate.
", + "type": "string" + }, + "limit": { + "description": "The maximal amount of documents to return. The skip is applied before the limit restriction. The default is 100. (optional)
", + "type": "string" + }, + "longitude": { + "description": "The longitude of the coordinate.
", + "type": "string" + }, + "skip": { + "description": "The number of documents to skip in the query. (optional)
", + "type": "string" + } + }, + "required": [ + "collection", + "latitude", + "longitude", + "distance", + "skip", + "limit", + "geo" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_range": { + "properties": { + "attribute": { + "description": "The attribute path to check.
", + "type": "string" + }, + "closed": { + "description": "If true, use interval including left and right, otherwise exclude right, but include left.
", + "format": "", + "type": "boolean" + }, + "collection": { + "description": "The name of the collection to query.
", + "type": "string" + }, + "left": { + "description": "The lower bound.
", + "type": "string" + }, + "limit": { + "description": "The maximal amount of documents to return. The skip is applied before the limit restriction. (optional)
", + "format": "int64", + "type": "integer" + }, + "right": { + "description": "The upper bound.
", + "type": "string" + }, + "skip": { + "description": "The number of documents to skip in the query (optional).
", + "type": "string" + } + }, + "required": [ + "collection", + "attribute", + "left", + "right", + "closed", + "skip" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_remove_by_example": { + "properties": { + "collection": { + "description": "The name of the collection to remove from.
", + "type": "string" + }, + "example": { + "description": "An example document that all collection documents are compared against.
", + "type": "string" + }, + "options": { + "$ref": "#/definitions/put_api_simple_remove_by_example_opts" + } + }, + "required": [ + "collection", + "example" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_replace_by_example": { + "properties": { + "collection": { + "description": "The name of the collection to replace within.
", + "type": "string" + }, + "example": { + "description": "An example document that all collection documents are compared against.
", + "type": "string" + }, + "newValue": { + "description": "The replacement document that will get inserted in place of the \"old\" documents.
", + "type": "string" + }, + "options": { + "$ref": "#/definitions/put_api_simple_replace_by_example_options" + } + }, + "required": [ + "collection", + "example", + "newValue" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_update_by_example": { + "properties": { + "collection": { + "description": "The name of the collection to update within.
", + "type": "string" + }, + "example": { + "description": "An example document that all collection documents are compared against.
", + "type": "string" + }, + "newValue": { + "additionalProperties": {}, + "description": "A document containing all the attributes to update in the found documents.
", + "type": "object" + }, + "options": { + "$ref": "#/definitions/put_api_simple_update_by_example_options" + } + }, + "required": [ + "collection", + "example", + "newValue" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_within": { + "properties": { + "collection": { + "description": "The name of the collection to query.
", + "type": "string" + }, + "distance": { + "description": "If given, the attribute key used to return the distance to the given coordinate. (optional). If specified, distances are returned in meters.
", + "type": "string" + }, + "geo": { + "description": "If given, the identifier of the geo-index to use. (optional)
", + "type": "string" + }, + "latitude": { + "description": "The latitude of the coordinate.
", + "type": "string" + }, + "limit": { + "description": "The maximal amount of documents to return. The skip is applied before the limit restriction. The default is 100. (optional)
", + "type": "string" + }, + "longitude": { + "description": "The longitude of the coordinate.
", + "type": "string" + }, + "radius": { + "description": "The maximal radius (in meters).
", + "type": "string" + }, + "skip": { + "description": "The number of documents to skip in the query. (optional)
", + "type": "string" + } + }, + "required": [ + "collection", + "latitude", + "longitude", + "radius", + "distance", + "skip", + "limit", + "geo" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSA_put_api_simple_within_rectangle": { + "properties": { + "collection": { + "description": "The name of the collection to query.
", + "type": "string" + }, + "geo": { + "description": "If given, the identifier of the geo-index to use. (optional)
", + "type": "string" + }, + "latitude1": { + "description": "The latitude of the first rectangle coordinate.
", + "type": "string" + }, + "latitude2": { + "description": "The latitude of the second rectangle coordinate.
", + "type": "string" + }, + "limit": { + "description": "The maximal amount of documents to return. The skip is applied before the limit restriction. The default is 100. (optional)
", + "type": "string" + }, + "longitude1": { + "description": "The longitude of the first rectangle coordinate.
", + "type": "string" + }, + "longitude2": { + "description": "The longitude of the second rectangle coordinate.
", + "type": "string" + }, + "skip": { + "description": "The number of documents to skip in the query. (optional)
", + "type": "string" + } + }, + "required": [ + "collection", + "latitude1", + "longitude1", + "latitude2", + "longitude2", + "skip", + "limit", + "geo" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "JSF_HTTP_API_TRAVERSAL": { + "properties": { + "direction": { + "description": "direction for traversal
  • if set, must be either \"outbound\", \"inbound\", or \"any\"
  • if not set, the expander attribute must be specified
", + "type": "string" + }, + "edgeCollection": { + "description": "name of the collection that contains the edges.
", + "type": "string" + }, + "expander": { + "description": "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
", + "type": "string" + }, + "filter": { + "description": "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.
", + "type": "string" + }, + "graphName": { + "description": "name of the graph that contains the edges. Either edgeCollection or graphName has to be given. In case both values are set the graphName is prefered.
", + "type": "string" + }, + "init": { + "description": "body (JavaScript) code of custom result initialization function function signature: (config, result) -> void initialize any values in result with what is required
", + "type": "string" + }, + "itemOrder": { + "description": "item iteration order can be \"forward\" or \"backward\"
", + "type": "string" + }, + "maxDepth": { + "description": "ANDed with any existing filters visits only nodes in at most the given depth
", + "type": "string" + }, + "maxIterations": { + "description": "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.
", + "type": "string" + }, + "minDepth": { + "description": "ANDed with any existing filters): visits only nodes in at least the given depth
", + "type": "string" + }, + "order": { + "description": "traversal order can be \"preorder\", \"postorder\" or \"preorder-expander\"
", + "type": "string" + }, + "sort": { + "description": "body (JavaScript) code of a custom comparison function for the edges. The signature of this function is (l, r) -> integer (where l and r are edges) and must return -1 if l is smaller than, +1 if l is greater than, and 0 if l and r are equal. The reason for this is the following: The order of edges returned for a certain vertex is undefined. This is because there is no natural order of edges for a vertex with multiple connected edges. To explicitly define the order in which edges on the vertex are followed, you can specify an edge comparator function with this attribute. Note that the value here has to be a string to conform to the JSON standard, which in turn is parsed as function body on the server side. Furthermore note that this attribute is only used for the standard expanders. If you use your custom expander you have to do the sorting yourself within the expander code.
", + "type": "string" + }, + "startVertex": { + "description": "id of the startVertex, e.g. \"users/foo\".
", + "type": "string" + }, + "strategy": { + "description": "traversal strategy can be \"depthfirst\" or \"breadthfirst\"
", + "type": "string" + }, + "uniqueness": { + "description": "specifies uniqueness for vertices and edges visited if set, must be an object like this:
\"uniqueness\": {\"vertices\": \"none\"|\"global\"|\"path\", \"edges\": \"none\"|\"global\"|\"path\"}
", + "type": "string" + }, + "visitor": { + "description": "body (JavaScript) code of custom visitor function function signature: (config, result, vertex, path, connected) -> void The visitor function can do anything, but its return value is ignored. To populate a result, use the result variable by reference. Note that the connected argument is only populated when the order attribute is set to \"preorder-expander\".
", + "type": "string" + } + }, + "required": [ + "startVertex" + ], + "type": "object", + "x-filename": "Graph Traversal - js/actions/api-traversal.js" + }, + "JSF_cluster_dispatcher_POST": { + "properties": { + "action": { + "description": "can be one of the following: - \"launch\": the cluster is launched for the first time, all data directories and log files are cleaned and created - \"shutdown\": the cluster is shut down, the additional property runInfo (see below) must be bound as well - \"relaunch\": the cluster is launched again, all data directories and log files are untouched and need to be there already - \"cleanup\": use this after a shutdown to remove all data in the data directories and all log files, use with caution - \"isHealthy\": checks whether or not the processes involved in the cluster are running or not. The additional property runInfo (see above) must be bound as well - \"upgrade\": performs an upgrade of a cluster, to this end, the agency is started, and then every server is once started with the \"--upgrade\" option, and then normally. Finally, the script \"verion-check.js\" is run on one of the coordinators for the cluster.
", + "type": "string" + }, + "clusterPlan": { + "additionalProperties": {}, + "description": "is a cluster plan (see JSF_cluster_planner_POST),
", + "type": "object" + }, + "myname": { + "description": "is the ID of this dispatcher, this is used to decide which commands are executed locally and which are forwarded to other dispatchers
", + "type": "string" + }, + "runInfo": { + "additionalProperties": {}, + "description": "this is needed for the \"shutdown\" and \"isHealthy\" actions only and should be the structure that \"launch\", \"relaunch\" or \"upgrade\" returned. It contains runtime information like process IDs.
", + "type": "object" + } + }, + "required": [ + "clusterPlan", + "myname", + "action" + ], + "type": "object", + "x-filename": "Cluster - js/actions/api-cluster.js" + }, + "JSF_general_graph_create_http_examples": { + "properties": { + "edgeDefinitions": { + "description": "An array of definitions for the edge
", + "type": "string" + }, + "name": { + "description": "Name of the graph.
", + "type": "string" + }, + "orphanCollections": { + "description": "An array of additional vertex collections.
", + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object", + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "JSF_general_graph_edge_definition_add_http_examples": { + "properties": { + "collection": { + "description": "The name of the edge collection to be used.
", + "type": "string" + }, + "from": { + "description": "One or many vertex collections that can contain source vertices.
", + "items": { + "type": "string" + }, + "type": "array" + }, + "to": { + "description": "One or many edge collections that can contain target vertices.
", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "collection", + "from", + "to" + ], + "type": "object", + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "JSF_general_graph_edge_definition_modify_http_examples": { + "properties": { + "collection": { + "description": "The name of the edge collection to be used.
", + "type": "string" + }, + "from": { + "description": "One or many vertex collections that can contain source vertices.
", + "items": { + "type": "string" + }, + "type": "array" + }, + "to": { + "description": "One or many edge collections that can contain target vertices.
", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "collection", + "from", + "to" + ], + "type": "object", + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "JSF_get_api_database_new": { + "properties": { + "active": { + "description": "A Flag indicating whether the user account should be activated or not. The default value is true.
", + "format": "", + "type": "boolean" + }, + "extra": { + "additionalProperties": {}, + "description": "A JSON object with extra user information. The data contained in extra will be stored for the user but not be interpreted further by ArangoDB.
", + "type": "object" + }, + "name": { + "description": "Has to contain a valid database name.
", + "type": "string" + }, + "passwd": { + "description": "The user password as a string. If not specified, it will default to an empty string.
", + "type": "string" + }, + "username": { + "description": "The user name as a string. If users is not specified or does not contain any users, a default user root will be created with an empty string password. This ensures that the new database will be accessible after it is created.
", + "type": "string" + }, + "users": { + "description": "Has to be a list of user objects to initially create for the new database. Each user object can contain the following attributes:
", + "items": { + "$ref": "#/definitions/JSF_get_api_database_new_USERS" + }, + "type": "array" + } + }, + "required": [ + "name" + ], + "type": "object", + "x-filename": "Database - js/actions/api-database.js" + }, + "JSF_get_api_database_new_USERS": { + "description": "", + "properties": { + "active": { + "description": "if False the user won't be able to log into the database.
", + "type": "boolean" + }, + "passwd": { + "description": "Password for the user
", + "type": "string" + }, + "username": { + "description": "Loginname of the user to be created
", + "type": "string" + } + }, + "type": "object" + }, + "JSF_get_api_return_rc_200": { + "properties": { + "details": { + "additionalProperties": {}, + "description": "an optional JSON object with additional details. This is returned only if the details URL parameter is set to true in the request.
", + "type": "object" + }, + "server": { + "description": "will always contain arango
", + "type": "string" + }, + "version": { + "description": "the server version string. The string has the format \"major.*minor.*sub\". major and minor will be numeric, and sub may contain a number or a textual version.
", + "type": "string" + } + }, + "required": [ + "server", + "version" + ], + "type": "object", + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + }, + "JSF_post_api_aqlfunction": { + "properties": { + "code": { + "description": "a string representation of the function body.
", + "type": "string" + }, + "isDeterministic": { + "description": "an optional boolean value to indicate that the function results are fully deterministic (function return value solely depends on the input value and return value is the same for repeated calls with same input). The isDeterministic attribute is currently not used but may be used later for optimisations.
", + "format": "", + "type": "boolean" + }, + "name": { + "description": "the fully qualified name of the user functions.
", + "type": "string" + } + }, + "required": [ + "name", + "code" + ], + "type": "object", + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + }, + "JSF_post_api_collection": { + "properties": { + "doCompact": { + "description": "whether or not the collection will be compacted (default is true)
", + "format": "", + "type": "boolean" + }, + "indexBuckets": { + "description": "The: number of buckets into which indexes using a hash table are split. The default is 16 and this number has to be a power of 2 and less than or equal to 1024.
For very large collections one should increase this to avoid long pauses when the hash table has to be initially built or resized, since buckets are resized individually and can be initially built in parallel. For example, 64 might be a sensible value for a collection with 100 000 000 documents. Currently, only the edge index respects this value, but other index types might follow in future ArangoDB versions. Changes (see below) are applied when the collection is loaded the next time.
", + "format": "int64", + "type": "integer" + }, + "isSystem": { + "description": "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. (The default is false)
", + "format": "", + "type": "boolean" + }, + "isVolatile": { + "description": "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 synchronization to disk and does not calculate any CRC checksums for datafiles (as there are no datafiles). This option should therefore be used for cache-type collections only, and not for data that cannot be re-created otherwise. (The default is false)
", + "format": "", + "type": "boolean" + }, + "journalSize": { + "description": "The maximal size of a journal or datafile in bytes. The value must be at least `1048576` (1 MiB). (The default is a configuration parameter)
", + "format": "int64", + "type": "integer" + }, + "keyOptions": { + "$ref": "#/definitions/JSF_post_api_collection_opts" + }, + "name": { + "description": "The name of the collection.
", + "type": "string" + }, + "numberOfShards": { + "description": "(The default is 1): in a cluster, this value determines the number of shards to create for the collection. In a single server setup, this option is meaningless.
", + "format": "int64", + "type": "integer" + }, + "shardKeys": { + "description": "(The default is [ \"_key\" ]): in a cluster, this attribute determines which document attributes are used to determine the target shard for documents. Documents are sent to shards based on the values of their shard key attributes. The values of all shard key attributes in a document are hashed, and the hash value is used to determine the target shard. Note: Values of shard key attributes cannot be changed once set. This option is meaningless in a single server setup.
", + "type": "string" + }, + "type": { + "description": "(The default is 2): the type of the collection to create. The following values for type are valid:
  • 2: document collection
  • 3: edges collection
", + "format": "int64", + "type": "integer" + }, + "waitForSync": { + "description": "If true then the data is synchronized to disk before returning from a document create, update, replace or removal operation. (default: false)
", + "format": "", + "type": "boolean" + } + }, + "required": [ + "name" + ], + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "JSF_post_api_collection_opts": { + "description": "additional options for key generation. If specified, then keyOptions should be a JSON array containing the following attributes:
", + "properties": { + "allowUserKeys": { + "description": "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.
", + "type": "boolean" + }, + "increment": { + "description": "increment value for autoincrement key generator. Not used for other key generator types.
", + "format": "int64", + "type": "integer" + }, + "offset": { + "description": "Initial offset value for autoincrement key generator. Not used for other key generator types.
", + "format": "int64", + "type": "integer" + }, + "type": { + "description": "specifies the type of the key generator. The currently available generators are traditional and autoincrement.
", + "type": "string" + } + }, + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "JSF_post_api_cursor": { + "properties": { + "batchSize": { + "description": "maximum number of result documents to be transferred from the server to the client in one roundtrip. If this attribute is not set, a server-controlled default value will be used. A batchSize value of 0 is disallowed.
", + "format": "int64", + "type": "integer" + }, + "bindVars": { + "description": "list of bind parameter objects.
", + "items": { + "additionalProperties": {}, + "type": "object" + }, + "type": "array" + }, + "cache": { + "description": "flag to determine whether the AQL query cache shall be used. If set to false, then any query cache lookup will be skipped for the query. If set to true, it will lead to the query cache being checked for the query if the query cache mode is either on or demand.
", + "format": "", + "type": "boolean" + }, + "count": { + "description": "indicates whether the number of documents in the result set should be returned in the \"count\" attribute of the result. 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.
", + "format": "", + "type": "boolean" + }, + "options": { + "$ref": "#/definitions/JSF_post_api_cursor_opts" + }, + "query": { + "description": "contains the query string to be executed
", + "type": "string" + }, + "ttl": { + "description": "The time-to-live for the cursor (in seconds). The cursor will be removed on the server automatically after the specified amount of time. This is useful to ensure garbage collection of cursors that are not fully fetched by clients. If not set, a server-defined value will be used.
", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "query" + ], + "type": "object", + "x-filename": "Cursors - arangod/RestHandler/RestCursorHandler.cpp" + }, + "JSF_post_api_cursor_opts": { + "description": "key/value object with extra options for the query.
", + "properties": { + "fullCount": { + "description": "if set to true and the query contains a LIMIT clause, then the result will contain an extra attribute extra with a sub-attribute fullCount. This sub-attribute will contain the number of documents in the result before the last LIMIT in the query was applied. It can be used to count the number of documents that match certain filter criteria, but only return a subset of them, in one go. It is thus similar to MySQL's SQL_CALC_FOUND_ROWS hint. Note that setting the option will disable a few LIMIT optimizations and may lead to more documents being processed, and thus make queries run longer. Note that the fullCount sub-attribute will only be present in the result if the query has a LIMIT clause and the LIMIT clause is actually used in the query.
", + "type": "boolean" + }, + "maxPlans": { + "description": "limits the maximum number of plans that are created by the AQL query optimizer.
", + "format": "int64", + "type": "integer" + }, + "optimizer.rules": { + "description": "a list of to-be-included or to-be-excluded optimizer rules can be put into this attribute, telling the optimizer to include or exclude specific rules. To disable a rule, prefix its name with a `-`, to enable a rule, prefix it with a `+`. There is also a pseudo-rule `all`, which will match all optimizer rules.
", + "format": "string", + "items": { + "type": "string" + }, + "type": "array" + }, + "profile": { + "description": "if set to true, then the additional query profiling information will be returned in the extra.stats return attribute if the query result is not served from the query cache.
", + "type": "boolean" + } + }, + "type": "object", + "x-filename": "Cursors - arangod/RestHandler/RestCursorHandler.cpp" + }, + "JSF_post_api_cursor_rc_201": { + "properties": { + "cached": { + "description": "a boolean flag indicating whether the query result was served from the query cache or not. If the query result is served from the query cache, the extra return attribute will not contain any stats sub-attribute and no profile sub-attribute.
", + "format": "", + "type": "boolean" + }, + "code": { + "description": "the HTTP status code
", + "format": "integer", + "type": "integer" + }, + "count": { + "description": "the total number of result documents available (only available if the query was executed with the count attribute set)
", + "format": "int64", + "type": "integer" + }, + "error": { + "description": "A flag to indicate that an error occurred (false in this case)
", + "format": "", + "type": "boolean" + }, + "extra": { + "additionalProperties": {}, + "description": "an optional JSON object with extra information about the query result contained in its stats sub-attribute. For data-modification queries, the extra.stats sub-attribute will contain the number of modified documents and the number of documents that could not be modified due to an error (if ignoreErrors query option is specified)
", + "type": "object" + }, + "hasMore": { + "description": "A boolean indicator whether there are more results available for the cursor on the server
", + "format": "", + "type": "boolean" + }, + "id": { + "description": "id of temporary cursor created on the server (optional, see above)
", + "type": "string" + }, + "result": { + "description": "an array of result documents (might be empty if query has no results)
", + "items": {}, + "type": "array" + } + }, + "required": [ + "error", + "code", + "hasMore", + "id", + "cached" + ], + "type": "object", + "x-filename": "Cursors - arangod/RestHandler/RestCursorHandler.cpp" + }, + "JSF_post_api_cursor_rc_400": { + "properties": { + "code": { + "description": "the HTTP status code
", + "format": "int64", + "type": "integer" + }, + "error": { + "description": "boolean flag to indicate that an error occurred (true in this case)
", + "format": "", + "type": "boolean" + }, + "errorMessage": { + "description": "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 (../ArangoErrors/README.md) here.

", + "type": "string" + }, + "errorNum": { + "description": "the server error number
", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "error", + "code", + "errorNum", + "errorMessage" + ], + "type": "object", + "x-filename": "Cursors - arangod/RestHandler/RestCursorHandler.cpp" + }, + "JSF_post_api_explain": { + "properties": { + "bindVars": { + "description": "key/value pairs representing the bind values
", + "items": { + "additionalProperties": {}, + "type": "object" + }, + "type": "array" + }, + "options": { + "$ref": "#/definitions/explain_options" + }, + "query": { + "description": "the query which you want explained; If the query references any bind variables, these must also be passed in the attribute bindVars. Additional options for the query can be passed in the options attribute.
", + "type": "string" + } + }, + "required": [ + "query" + ], + "type": "object", + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + }, + "JSF_post_api_export": { + "properties": { + "batchSize": { + "description": "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.
", + "format": "int64", + "type": "integer" + }, + "count": { + "description": "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 so this option is turned off by default, and \"count\" is only returned when requested.
", + "format": "", + "type": "boolean" + }, + "flush": { + "description": "if set to true, a WAL flush operation will be executed prior to the export. The flush operation will start copying documents from the WAL to the collection's datafiles. There will be an additional wait time of up to flushWait seconds after the flush to allow the WAL collector to change the adjusted document meta-data to point into the datafiles, too. The default value is false (i.e. no flush) so most recently inserted or updated documents from the collection might be missing in the export.
", + "format": "", + "type": "boolean" + }, + "flushWait": { + "description": "maximum wait time in seconds after a flush operation. The default value is 10. This option only has an effect when flush is set to true.
", + "format": "int64", + "type": "integer" + }, + "limit": { + "description": "an optional limit value, determining the maximum number of documents to be included in the cursor. Omitting the limit attribute or setting it to 0 will lead to no limit being used. If a limit is used, it is undefined which documents from the collection will be included in the export and which will be excluded. This is because there is no natural order of documents in a collection.
", + "format": "int64", + "type": "integer" + }, + "restrict": { + "$ref": "#/definitions/JSF_post_api_export_restrictions" + }, + "ttl": { + "description": "an optional time-to-live for the cursor (in seconds). The cursor will be removed on the server automatically after the specified amount of time. This is useful to ensure garbage collection of cursors that are not fully fetched by clients. If not set, a server-defined value will be used.
", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "flush", + "flushWait", + "count", + "batchSize", + "limit", + "ttl" + ], + "type": "object", + "x-filename": "Bulk - arangod/RestHandler/RestExportHandler.cpp, arangod/RestHandler/RestImportHandler.cpp, arangod/RestHandler/RestBatchHandler.cpp" + }, + "JSF_post_api_export_restrictions": { + "description": "an object containing an array of attribute names that will be included or excluded when returning result documents.
Not specifying restrict will by default return all attributes of each document.
", + "properties": { + "fields": { + "description": "Contains an array of attribute names to include or exclude. Matching of attribute names for inclusion or exclusion will be done on the top level only. Specifying names of nested attributes is not supported at the moment.

", + "format": "string", + "items": { + "type": "string" + }, + "type": "array" + }, + "type": { + "description": "has to be be set to either include or exclude depending on which you want to use
", + "type": "string" + } + }, + "type": "object", + "x-filename": "Bulk - arangod/RestHandler/RestExportHandler.cpp, arangod/RestHandler/RestImportHandler.cpp, arangod/RestHandler/RestBatchHandler.cpp" + }, + "JSF_post_api_index_cap": { + "properties": { + "byteSize": { + "description": "The maximal size of the active document data in the collection (in bytes). If specified, the value must be at least 16384.

", + "format": "int64", + "type": "integer" + }, + "size": { + "description": "The maximal number of documents for the collection. If specified, the value must be greater than zero.
", + "format": "int64", + "type": "integer" + }, + "type": { + "description": "must be equal to \"cap\".
", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object", + "x-filename": "Indexes - js/actions/api-index.js" + }, + "JSF_post_api_index_fulltext": { + "properties": { + "fields": { + "description": "an array of attribute names. Currently, the array is limited to exactly one attribute.
", + "items": { + "type": "string" + }, + "type": "array" + }, + "minLength": { + "description": "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.
", + "format": "int64", + "type": "integer" + }, + "type": { + "description": "must be equal to \"fulltext\".
", + "type": "string" + } + }, + "required": [ + "type", + "fields", + "minLength" + ], + "type": "object", + "x-filename": "Indexes - js/actions/api-index.js" + }, + "JSF_post_api_index_geo": { + "properties": { + "fields": { + "description": "An array with one or two attribute paths.
If it is an array 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 an array with at least two double values. The array 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 an array 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.
", + "items": { + "type": "string" + }, + "type": "array" + }, + "geoJson": { + "description": "If a geo-spatial index on a location is constructed and geoJson is true, then the order within the array is longitude followed by latitude. This corresponds to the format described in http://geojson.org/geojson-spec.html#positions
", + "type": "string" + }, + "type": { + "description": "must be equal to \"geo\".
", + "type": "string" + } + }, + "required": [ + "type", + "fields", + "geoJson" + ], + "type": "object", + "x-filename": "Indexes - js/actions/api-index.js" + }, + "JSF_post_api_index_hash": { + "properties": { + "fields": { + "description": "an array of attribute paths.
", + "items": { + "type": "string" + }, + "type": "array" + }, + "sparse": { + "description": "if true, then create a sparse index.
", + "format": "", + "type": "boolean" + }, + "type": { + "description": "must be equal to \"hash\".
", + "type": "string" + }, + "unique": { + "description": "if true, then create a unique index.
", + "format": "", + "type": "boolean" + } + }, + "required": [ + "type", + "fields", + "unique", + "sparse" + ], + "type": "object", + "x-filename": "Indexes - js/actions/api-index.js" + }, + "JSF_post_api_index_skiplist": { + "properties": { + "fields": { + "description": "an array of attribute paths.
", + "items": { + "type": "string" + }, + "type": "array" + }, + "sparse": { + "description": "if true, then create a sparse index.
", + "format": "", + "type": "boolean" + }, + "type": { + "description": "must be equal to \"skiplist\".
", + "type": "string" + }, + "unique": { + "description": "if true, then create a unique index.
", + "format": "", + "type": "boolean" + } + }, + "required": [ + "type", + "fields", + "unique", + "sparse" + ], + "type": "object", + "x-filename": "Indexes - js/actions/api-index.js" + }, + "JSF_post_api_new_tasks": { + "properties": { + "command": { + "description": "The JavaScript code to be executed
", + "type": "string" + }, + "name": { + "description": "The name of the task
", + "type": "string" + }, + "offset": { + "description": "Number of seconds initial delay
", + "format": "int64", + "type": "integer" + }, + "params": { + "description": "The parameters to be passed into command
", + "type": "string" + }, + "period": { + "description": "number of seconds between the executions
", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "name", + "command", + "params" + ], + "type": "object", + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + }, + "JSF_post_api_transaction": { + "properties": { + "action": { + "description": "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.
", + "type": "string" + }, + "collections": { + "description": "contains the array of collections to be used in the transaction (mandatory). collections must be a JSON object that can have the optional sub-attributes read and write. read and write must each be either arrays of collections names or strings with a single collection name.
", + "type": "string" + }, + "lockTimeout": { + "description": "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.
", + "format": "int64", + "type": "integer" + }, + "params": { + "description": "optional arguments passed to action.
", + "type": "string" + }, + "waitForSync": { + "description": "an optional boolean flag that, if set, will force the transaction to write all data to disk before returning.
", + "format": "boolean", + "type": "boolean" + } + }, + "required": [ + "collections", + "action" + ], + "type": "object", + "x-filename": "Transactions - js/actions/api-transaction.js" + }, + "JSF_post_batch_replication": { + "properties": { + "ttl": { + "description": "the time-to-live for the new batch (in seconds)
A JSON object with the batch configuration.
", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "ttl" + ], + "type": "object", + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + }, + "JSF_put_api_new_tasks": { + "properties": { + "command": { + "description": "The JavaScript code to be executed
", + "type": "string" + }, + "name": { + "description": "The name of the task
", + "type": "string" + }, + "offset": { + "description": "Number of seconds initial delay
", + "format": "int64", + "type": "integer" + }, + "params": { + "description": "The parameters to be passed into command
", + "type": "string" + }, + "period": { + "description": "number of seconds between the executions
", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "name", + "command", + "params" + ], + "type": "object", + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + }, + "JSF_put_api_replication_applier_adjust": { + "properties": { + "adaptivePolling": { + "description": "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 seldom.
", + "format": "", + "type": "boolean" + }, + "autoStart": { + "description": "whether or not to auto-start the replication applier on (next and following) server starts
", + "format": "", + "type": "boolean" + }, + "chunkSize": { + "description": "the requested maximum size for log transfer packets that is used when the endpoint is contacted.
", + "format": "int64", + "type": "integer" + }, + "connectTimeout": { + "description": "the timeout (in seconds) when attempting to connect to the endpoint. This value is used for each connection attempt.
", + "format": "int64", + "type": "integer" + }, + "database": { + "description": "the name of the database on the endpoint. If not specified, defaults to the current local database name.
", + "type": "string" + }, + "endpoint": { + "description": "the logger server to connect to (e.g. \"tcp://192.168.173.13:8529\"). The endpoint must be specified.
", + "type": "string" + }, + "includeSystem": { + "description": "whether or not system collection operations will be applied
", + "format": "", + "type": "boolean" + }, + "maxConnectRetries": { + "description": "the maximum number of connection attempts the applier will make in a row. If the applier cannot establish a connection to the endpoint in this number of attempts, it will stop itself.
", + "format": "int64", + "type": "integer" + }, + "password": { + "description": "the password to use when connecting to the endpoint.
", + "type": "string" + }, + "requestTimeout": { + "description": "the timeout (in seconds) for individual requests to the endpoint.
", + "format": "int64", + "type": "integer" + }, + "requireFromPresent": { + "description": "if set to true, then the replication applier will check at start whether the start tick from which it starts or resumes replication is still present on the master. If not, then there would be data loss. If requireFromPresent is true, the replication applier will abort with an appropriate error message. If set to false, then the replication applier will still start, and ignore the data loss.
", + "format": "", + "type": "boolean" + }, + "restrictCollections": { + "description": "the array of collections to include or exclude, based on the setting of restrictType
", + "items": { + "type": "string" + }, + "type": "array" + }, + "restrictType": { + "description": "the configuration for restrictCollections; Has to be either include or exclude
", + "type": "string" + }, + "username": { + "description": "an optional ArangoDB username to use when connecting to the endpoint.
", + "type": "string" + }, + "verbose": { + "description": "if set to true, then a log line will be emitted for all operations performed by the replication applier. This should be used for debugging replication problems only.
", + "format": "", + "type": "boolean" + } + }, + "required": [ + "endpoint", + "database", + "password", + "maxConnectRetries", + "connectTimeout", + "requestTimeout", + "chunkSize", + "autoStart", + "adaptivePolling", + "includeSystem", + "requireFromPresent", + "verbose", + "restrictType" + ], + "type": "object", + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + }, + "JSF_put_api_replication_makeSlave": { + "properties": { + "adaptivePolling": { + "description": "whether or not the replication applier will use adaptive polling.
", + "format": "", + "type": "boolean" + }, + "chunkSize": { + "description": "the requested maximum size for log transfer packets that is used when the endpoint is contacted.
", + "format": "int64", + "type": "integer" + }, + "connectTimeout": { + "description": "the timeout (in seconds) when attempting to connect to the endpoint. This value is used for each connection attempt.
", + "format": "int64", + "type": "integer" + }, + "database": { + "description": "the database name on the master (if not specified, defaults to the name of the local current database).
", + "type": "string" + }, + "endpoint": { + "description": "the master endpoint to connect to (e.g. \"tcp://192.168.173.13:8529\").
", + "type": "string" + }, + "includeSystem": { + "description": "whether or not system collection operations will be applied
", + "format": "", + "type": "boolean" + }, + "maxConnectRetries": { + "description": "the maximum number of connection attempts the applier will make in a row. If the applier cannot establish a connection to the endpoint in this number of attempts, it will stop itself.
", + "format": "int64", + "type": "integer" + }, + "password": { + "description": "the password to use when connecting to the master.
", + "type": "string" + }, + "requestTimeout": { + "description": "the timeout (in seconds) for individual requests to the endpoint.
", + "format": "int64", + "type": "integer" + }, + "requireFromPresent": { + "description": "if set to true, then the replication applier will check at start of its continuous replication if the start tick from the dump phase is still present on the master. If not, then there would be data loss. If requireFromPresent is true, the replication applier will abort with an appropriate error message. If set to false, then the replication applier will still start, and ignore the data loss.
", + "format": "", + "type": "boolean" + }, + "restrictCollections": { + "description": "an optional array of collections for use with restrictType. If restrictType is include, only the specified collections will be sychronised. If restrictType is exclude, all but the specified collections will be synchronized.
", + "items": { + "type": "string" + }, + "type": "array" + }, + "restrictType": { + "description": "an optional string value for collection filtering. When specified, the allowed values are include or exclude.
", + "type": "string" + }, + "username": { + "description": "an optional ArangoDB username to use when connecting to the master.
", + "type": "string" + }, + "verbose": { + "description": "if set to true, then a log line will be emitted for all operations performed by the replication applier. This should be used for debugging replication problems only.
", + "format": "", + "type": "boolean" + } + }, + "required": [ + "endpoint", + "database", + "password", + "includeSystem", + "maxConnectRetries", + "connectTimeout", + "requestTimeout", + "chunkSize", + "adaptivePolling", + "requireFromPresent" + ], + "type": "object", + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + }, + "JSF_put_api_replication_synchronize": { + "properties": { + "database": { + "description": "the database name on the master (if not specified, defaults to the name of the local current database).
", + "type": "string" + }, + "endpoint": { + "description": "the master endpoint to connect to (e.g. \"tcp://192.168.173.13:8529\").
", + "type": "string" + }, + "includeSystem": { + "description": "whether or not system collection operations will be applied
", + "format": "", + "type": "boolean" + }, + "incremental": { + "description": "if set to true, then an incremental synchronization method will be used for synchronizing data in collections. This method is useful when collections already exist locally, and only the remaining differences need to be transferred from the remote endpoint. In this case, the incremental synchronization can be faster than a full synchronization. The default value is false, meaning that the complete data from the remote collection will be transferred.
", + "format": "", + "type": "boolean" + }, + "password": { + "description": "the password to use when connecting to the endpoint.
", + "type": "string" + }, + "restrictCollections": { + "description": "an optional array of collections for use with restrictType. If restrictType is include, only the specified collections will be sychronised. If restrictType is exclude, all but the specified collections will be synchronized.
", + "items": { + "type": "string" + }, + "type": "array" + }, + "restrictType": { + "description": "an optional string value for collection filtering. When specified, the allowed values are include or exclude.
", + "type": "string" + }, + "username": { + "description": "an optional ArangoDB username to use when connecting to the endpoint.
", + "type": "string" + } + }, + "required": [ + "endpoint", + "password" + ], + "type": "object", + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + }, + "JSF_put_batch_replication": { + "properties": { + "ttl": { + "description": "the time-to-live for the new batch (in seconds)
", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "ttl" + ], + "type": "object", + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + }, + "PostApiQueryProperties": { + "properties": { + "query": { + "description": "To validate a query string without executing it, the query string can be passed to the server via an HTTP POST request.
", + "type": "string" + } + }, + "required": [ + "query" + ], + "type": "object", + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + }, + "PutApiQueryCacheProperties": { + "properties": { + "maxResults": { + "description": "the maximum number of query results that will be stored per database-specific cache.

", + "format": "int64", + "type": "integer" + }, + "mode": { + "description": " the mode the AQL query cache should operate in. Possible values are off, on or demand.
", + "type": "string" + } + }, + "required": [ + "mode", + "maxResults" + ], + "type": "object", + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + }, + "PutApiQueryProperties": { + "properties": { + "enabled": { + "description": "If set to true, then queries will be tracked. If set to false, neither queries nor slow queries will be tracked.
", + "format": "", + "type": "boolean" + }, + "maxQueryStringLength": { + "description": "The maximum query string length to keep in the list of queries. Query strings can have arbitrary lengths, and this property can be used to save memory in case very long query strings are used. The value is specified in bytes.
", + "format": "int64", + "type": "integer" + }, + "maxSlowQueries": { + "description": "The maximum number of slow queries to keep in the list of slow queries. If the list of slow queries is full, the oldest entry in it will be discarded when additional slow queries occur.
", + "format": "int64", + "type": "integer" + }, + "slowQueryThreshold": { + "description": "The threshold value for treating a query as slow. A query with a runtime greater or equal to this threshold value will be put into the list of slow queries when slow query tracking is enabled. The value for slowQueryThreshold is specified in seconds.
", + "format": "int64", + "type": "integer" + }, + "trackSlowQueries": { + "description": "If set to true, then slow queries will be tracked in the list of slow queries if their runtime exceeds the value set in slowQueryThreshold. In order for slow queries to be tracked, the enabled property must also be set to true.
", + "format": "", + "type": "boolean" + } + }, + "required": [ + "enabled", + "trackSlowQueries", + "maxSlowQueries", + "slowQueryThreshold", + "maxQueryStringLength" + ], + "type": "object", + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + }, + "RestLookupByKeys": { + "properties": { + "collection": { + "description": "The name of the collection to look in for the documents
", + "type": "string" + }, + "keys": { + "description": "array with the _keys of documents to remove.
", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "collection", + "keys" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "RestRemoveByKeys": { + "properties": { + "collection": { + "description": "The name of the collection to look in for the documents to remove
", + "type": "string" + }, + "keys": { + "description": "array with the _keys of documents to remove.
", + "items": { + "type": "string" + }, + "type": "array" + }, + "options": { + "$ref": "#/definitions/put_api_simple_remove_by_keys_opts" + } + }, + "required": [ + "collection", + "keys" + ], + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "collection_figures": { + "description": "metrics of the collection
", + "properties": { + "alive": { + "$ref": "#/definitions/collection_figures_alive" + }, + "attributes": { + "$ref": "#/definitions/collection_figures_attributes" + }, + "compactors": { + "$ref": "#/definitions/collection_figures_compactors" + }, + "datafiles": { + "$ref": "#/definitions/collection_figures_datafiles" + }, + "dead": { + "$ref": "#/definitions/collection_figures_dead" + }, + "indexes": { + "$ref": "#/definitions/collection_figures_indexes" + }, + "journals": { + "$ref": "#/definitions/collection_figures_journals" + }, + "maxTick": { + "description": "The tick of the last marker that was stored in a journal of the collection. This might be 0 if the collection does not yet have a journal.
", + "format": "int64", + "type": "integer" + }, + "shapefiles": { + "$ref": "#/definitions/collection_figures_shapefiles" + }, + "shapes": { + "$ref": "#/definitions/collection_figures_shapes" + }, + "uncollectedLogfileEntries": { + "description": "The number of markers in the write-ahead log for this collection that have not been transferred to journals or datafiles.
", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "figures", + "alive", + "dead", + "datafiles", + "journals", + "compactors", + "shapefiles", + "shapes", + "attributes", + "indexes" + ], + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "collection_figures_alive": { + "description": "the currently active figures
", + "properties": { + "count": { + "description": "The number of currently active documents in all datafiles and journals of the collection. Documents that are contained in the write-ahead log only are not reported in this figure.
", + "format": "int64", + "type": "integer" + }, + "size": { + "description": "The total size in bytes used by all active documents of the collection. Documents that are contained in the write-ahead log only are not reported in this figure.
", + "format": "int64", + "type": "integer" + } + }, + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "collection_figures_attributes": { + "description": "", + "properties": { + "count": { + "description": "The total number of attributes used in the collection. Note: the value includes data of attributes that are not in use anymore. Attributes that are contained in the write-ahead log only are not reported in this figure.
", + "format": "int64", + "type": "integer" + }, + "size": { + "description": "The total size of the attribute data (in bytes). Note: the value includes data of attributes that are not in use anymore. Attributes that are contained in the write-ahead log only are not reported in this figure.
", + "format": "int64", + "type": "integer" + } + }, + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "collection_figures_compactors": { + "description": "
", + "properties": { + "count": { + "description": "The number of compactor files.
", + "format": "int64", + "type": "integer" + }, + "fileSize": { + "description": "The total filesize of all compactor files (in bytes).
", + "format": "int64", + "type": "integer" + } + }, + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "collection_figures_datafiles": { + "description": "Metrics regarding the datafiles
", + "properties": { + "count": { + "description": "The number of datafiles.
", + "format": "int64", + "type": "integer" + }, + "fileSize": { + "description": "The total filesize of datafiles (in bytes).
", + "format": "int64", + "type": "integer" + } + }, + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "collection_figures_dead": { + "description": "the items waiting to be swept away by the cleaner
", + "properties": { + "count": { + "description": "The number of dead documents. This includes document versions that have been deleted or replaced by a newer version. Documents deleted or replaced that are contained the write-ahead log only are not reported in this figure.
", + "format": "int64", + "type": "integer" + }, + "deletion": { + "description": "The total number of deletion markers. Deletion markers only contained in the write-ahead log are not reporting in this figure.
", + "format": "int64", + "type": "integer" + }, + "size": { + "description": "The total size in bytes used by all dead documents.
", + "format": "int64", + "type": "integer" + } + }, + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "collection_figures_indexes": { + "description": "", + "properties": { + "count": { + "description": "The total number of indexes defined for the collection, including the pre-defined indexes (e.g. primary index).
", + "format": "int64", + "type": "integer" + }, + "size": { + "description": "The total memory allocated for indexes in bytes.
", + "format": "int64", + "type": "integer" + } + }, + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "collection_figures_journals": { + "description": "Metrics regarding the journal files
", + "properties": { + "count": { + "description": "The number of journal files.
", + "format": "int64", + "type": "integer" + }, + "fileSize": { + "description": "The total filesize of all journal files (in bytes).
", + "format": "int64", + "type": "integer" + } + }, + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "collection_figures_shapefiles": { + "description": "deprecated
", + "properties": { + "count": { + "description": "The number of shape files. This value is deprecated and kept for compatibility reasons only. The value will always be 0 since ArangoDB 2.0 and higher.
", + "format": "int64", + "type": "integer" + }, + "fileSize": { + "description": "The total filesize of the shape files. This value is deprecated and kept for compatibility reasons only. The value will always be 0 in ArangoDB 2.0 and higher.
", + "format": "int64", + "type": "integer" + } + }, + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "collection_figures_shapes": { + "description": "", + "properties": { + "count": { + "description": "The total number of shapes used in the collection. This includes shapes that are not in use anymore. Shapes that are contained in the write-ahead log only are not reported in this figure.
", + "format": "int64", + "type": "integer" + }, + "size": { + "description": "The total size of all shapes (in bytes). This includes shapes that are not in use anymore. Shapes that are contained in the write-ahead log only are not reported in this figure.
", + "format": "int64", + "type": "integer" + } + }, + "type": "object", + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "explain_options": { + "description": "Options for the query
", + "properties": { + "allPlans": { + "description": "if set to true, all possible execution plans will be returned. The default is false, meaning only the optimal plan will be returned.
", + "type": "boolean" + }, + "maxNumberOfPlans": { + "description": "an optional maximum number of plans that the optimizer is allowed to generate. Setting this attribute to a low value allows to put a cap on the amount of work the optimizer does.
", + "format": "int64", + "type": "integer" + }, + "optimizer.rules": { + "description": "an array of to-be-included or to-be-excluded optimizer rules can be put into this attribute, telling the optimizer to include or exclude specific rules. To disable a rule, prefix its name with a `-`, to enable a rule, prefix it with a `+`. There is also a pseudo-rule `all`, which will match all optimizer rules.
", + "format": "string", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object", + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + }, + "put_api_simple_remove_by_example_opts": { + "description": "a json object which can contains following attributes:
", + "properties": { + "limit": { + "description": "an optional value that determines how many documents to delete at most. If limit is specified but is less than the number of documents in the collection, it is undefined which of the documents will be deleted.
", + "type": "string" + }, + "waitForSync": { + "description": "if set to true, then all removal operations will instantly be synchronized to disk. If this is not specified, then the collection's default sync behavior will be applied.
", + "type": "string" + } + }, + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "put_api_simple_remove_by_keys_opts": { + "description": "a json object which can contains following attributes:
", + "properties": { + "waitForSync": { + "description": "if set to true, then all removal operations will instantly be synchronized to disk. If this is not specified, then the collection's default sync behavior will be applied.
", + "type": "string" + } + }, + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "put_api_simple_replace_by_example_options": { + "description": "a json object which can contain following attributes
", + "properties": { + "limit": { + "description": "an optional value that determines how many documents to replace at most. If limit is specified but is less than the number of documents in the collection, it is undefined which of the documents will be replaced.

", + "type": "string" + }, + "waitForSync": { + "description": "if set to true, then all removal operations will instantly be synchronized to disk. If this is not specified, then the collection's default sync behavior will be applied.
", + "type": "boolean" + } + }, + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + }, + "put_api_simple_update_by_example_options": { + "description": "a json object which can contains following attributes:
", + "properties": { + "keepNull": { + "description": "This parameter can be used to modify the behavior when handling null values. Normally, null values are stored in the database. By setting the keepNull parameter to false, this behavior can be changed so that all attributes in data with null values will be removed from the updated document.
", + "type": "string" + }, + "limit": { + "description": "an optional value that determines how many documents to update at most. If limit is specified but is less than the number of documents in the collection, it is undefined which of the documents will be updated.
", + "format": "int64", + "type": "integer" + }, + "waitForSync": { + "description": "if set to true, then all removal operations will instantly be synchronized to disk. If this is not specified, then the collection's default sync behavior will be applied.
", + "type": "boolean" + } + }, + "type": "object", + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "info": { + "description": "ArangoDB REST API Interface", + "license": { + "name": "Apache License, Version 2.0" + }, + "title": "ArangoDB", + "version": "1.0" + }, + "paths": { + "/_admin/cluster-test": { + "delete": { + "description": "\n\nSee GET method.
", + "parameters": [], + "summary": " Delete cluster roundtrip", + "tags": [ + "Cluster" + ], + "x-examples": [], + "x-filename": "Cluster - js/actions/api-cluster.js" + }, + "get": { + "description": "\n\n
Executes a cluster roundtrip from a coordinator to a DB server and back. This call only works in a coordinator node in a cluster. One can and should append an arbitrary path to the URL and the part after /_admin/cluster-test is used as the path of the HTTP request which is sent from the coordinator to a DB node. Likewise, any form data appended to the URL is forwarded in the request to the DB node. This handler takes care of all request types (see below) and uses the same request type in its request to the DB node.
The following HTTP headers are interpreted in a special way:
- X-Shard-ID: This specifies the ID of the shard to which the cluster request is sent and thus tells the system to which DB server to send the cluster request. Note that the mapping from the shard ID to the responsible server has to be defined in the agency under Current/ShardLocation/. One has to give this header, otherwise the system does not know where to send the request. - X-Client-Transaction-ID: the value of this header is taken as the client transaction ID for the request - X-Timeout: specifies a timeout in seconds for the cluster operation. If the answer does not arrive within the specified timeout, an corresponding error is returned and any subsequent real answer is ignored. The default if not given is 24 hours. - X-Synchronous-Mode: If set to true the test function uses synchronous mode, otherwise the default asynchronous operation mode is used. This is mainly for debugging purposes. - Host: This header is ignored and not forwarded to the DB server. - User-Agent: This header is ignored and not forwarded to the DB server.
All other HTTP headers and the body of the request (if present, see other HTTP methods below) are forwarded as given in the original request.
In asynchronous mode the DB server answers with an HTTP request of its own, in synchronous mode it sends a HTTP response. In both cases the headers and the body are used to produce the HTTP response of this API call.
", + "parameters": [], + "responses": { + "200": { + "description": "is returned when everything went well, or if a timeout occurred. In the latter case a body of type application/json indicating the timeout is returned.
" + }, + "403": { + "description": "is returned if ArangoDB is not running in cluster mode.
" + }, + "404": { + "description": "is returned if ArangoDB was not compiled for cluster operation.
" + } + }, + "summary": " Execute cluster roundtrip", + "tags": [ + "Cluster" + ], + "x-examples": [], + "x-filename": "Cluster - js/actions/api-cluster.js" + }, + "head": { + "description": "\n\nSee GET method.
", + "parameters": [], + "summary": " Execute cluster roundtrip", + "tags": [ + "Cluster" + ], + "x-examples": [], + "x-filename": "Cluster - js/actions/api-cluster.js" + }, + "patch": { + "description": "free style json body\n\nSee GET method. The body can be any type and is simply forwarded.
", + "parameters": [ + { + "description": "
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + } + ], + "summary": " Update cluster roundtrip", + "tags": [ + "Cluster" + ], + "x-examples": [], + "x-filename": "Cluster - js/actions/api-cluster.js" + }, + "post": { + "description": "free style json body\n\nSee GET method.
", + "parameters": [ + { + "description": "The body can be any type and is simply forwarded.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + } + ], + "summary": " Execute cluster roundtrip", + "tags": [ + "Cluster" + ], + "x-examples": [], + "x-filename": "Cluster - js/actions/api-cluster.js" + }, + "put": { + "description": "free style json body\n\nSee GET method. The body can be any type and is simply forwarded.
", + "parameters": [ + { + "description": "
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + } + ], + "summary": " Execute cluster roundtrip", + "tags": [ + "Cluster" + ], + "x-examples": [], + "x-filename": "Cluster - js/actions/api-cluster.js" + } + }, + "/_admin/clusterCheckPort": { + "get": { + "description": "\n\n
", + "parameters": [ + { + "description": "
", + "in": "query", + "name": "port", + "required": true, + "type": "integer" + } + ], + "responses": { + "200": { + "description": "
" + }, + "400": { + "description": "
" + } + }, + "summary": " Check port", + "tags": [ + "Cluster" + ], + "x-examples": [], + "x-filename": "Cluster - js/actions/api-cluster.js" + } + }, + "/_admin/clusterDispatch": { + "post": { + "description": "**A json post document with these Properties is required:**
  • clusterPlan: is a cluster plan (see JSF_cluster_planner_POST),
  • action: can be one of the following: - \"launch\": the cluster is launched for the first time, all data directories and log files are cleaned and created - \"shutdown\": the cluster is shut down, the additional property runInfo (see below) must be bound as well - \"relaunch\": the cluster is launched again, all data directories and log files are untouched and need to be there already - \"cleanup\": use this after a shutdown to remove all data in the data directories and all log files, use with caution - \"isHealthy\": checks whether or not the processes involved in the cluster are running or not. The additional property runInfo (see above) must be bound as well - \"upgrade\": performs an upgrade of a cluster, to this end, the agency is started, and then every server is once started with the \"--upgrade\" option, and then normally. Finally, the script \"verion-check.js\" is run on one of the coordinators for the cluster.
  • runInfo: this is needed for the \"shutdown\" and \"isHealthy\" actions only and should be the structure that \"launch\", \"relaunch\" or \"upgrade\" returned. It contains runtime information like process IDs.
  • myname: is the ID of this dispatcher, this is used to decide which commands are executed locally and which are forwarded to other dispatchers
\n\nThe body must be an object with the following properties:
This call executes the plan by either doing the work personally or by delegating to other dispatchers.
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_cluster_dispatcher_POST" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "
" + }, + "400": { + "description": "went wrong with the startup.
" + } + }, + "summary": "execute startup commands", + "tags": [ + "Cluster" + ], + "x-examples": [], + "x-filename": "Cluster - js/actions/api-cluster.js" + } + }, + "/_admin/clusterPlanner": { + "post": { + "description": "free style json body\n\nof a cluster and returns a JSON description of a plan to start up this cluster.
", + "parameters": [ + { + "description": "A cluster plan object
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + } + ], + "responses": { + "200": { + "description": "
" + }, + "400": { + "description": "
" + } + }, + "summary": " Produce cluster startup plan", + "tags": [ + "Cluster" + ], + "x-examples": [], + "x-filename": "Cluster - js/actions/api-cluster.js" + } + }, + "/_admin/clusterStatistics": { + "get": { + "description": "\n\n
", + "parameters": [ + { + "description": "
", + "in": "query", + "name": "DBserver", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "
" + }, + "400": { + "description": "ID of a DBserver
" + }, + "403": { + "description": "
" + } + }, + "summary": " Queries statistics of DBserver", + "tags": [ + "Cluster" + ], + "x-examples": [], + "x-filename": "Cluster - js/actions/api-cluster.js" + } + }, + "/_admin/database/target-version": { + "get": { + "description": "\n\n
Returns the database-version that this server requires. The version is returned in the version attribute of the result.
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned in all cases.
" + } + }, + "summary": " Return the required version of the database", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/echo": { + "get": { + "description": "\n\n
The call returns an object with the following attributes:
  • headers: object with HTTP headers received
  • requestType: the HTTP request method (e.g. GET)
  • parameters: object with URL parameters received
", + "parameters": [], + "responses": { + "200": { + "description": "Echo was returned successfully.
" + } + }, + "summary": " Return current request", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/execute": { + "post": { + "description": "free style json body\n\n
Executes the javascript code in the body on the server as the body of a function with no arguments. If you have a return statement then the return value you produce will be returned as content type application/json. If the parameter returnAsJSON is set to true, the result will be a JSON object describing the return value directly, otherwise a string produced by JSON.stringify will be returned.
", + "parameters": [ + { + "description": "The body to be executed.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + } + ], + "summary": " Execute program", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/log": { + "get": { + "description": "\n\nReturns fatal, error, warning or info log messages from the server's global log. The result is a JSON object with the following attributes:
  • lid: a list of log entry identifiers. Each log message is uniquely identified by its lid and the identifiers are in ascending order.
  • level: a list of the log-levels for all log entries.
  • timestamp: a list of the timestamps as seconds since 1970-01-01 for all log entries.
  • text a list of the texts of all log entries
  • totalAmount: the total amount of log entries before pagination.
", + "parameters": [ + { + "description": "Returns all log entries up to log level upto. Note that upto must be:
  • fatal or 0
  • error or 1
  • warning or 2
  • info or 3
  • debug or 4 The default value is info.
", + "in": "query", + "name": "upto", + "required": false, + "type": "string" + }, + { + "description": "Returns all log entries of log level level. Note that the URL parameters upto and level are mutually exclusive.
", + "in": "query", + "name": "level", + "required": false, + "type": "string" + }, + { + "description": "Returns all log entries such that their log entry identifier (lid value) is greater or equal to start.
", + "in": "query", + "name": "start", + "required": false, + "type": "number" + }, + { + "description": "Restricts the result to at most size log entries.
", + "in": "query", + "name": "size", + "required": false, + "type": "number" + }, + { + "description": "Starts to return log entries skipping the first offset log entries. offset and size can be used for pagination.
", + "in": "query", + "name": "offset", + "required": false, + "type": "number" + }, + { + "description": "Only return the log entries containing the text specified in search.
", + "in": "query", + "name": "search", + "required": false, + "type": "string" + }, + { + "description": "Sort the log entries either ascending (if sort is asc) or descending (if sort is desc) according to their lid values. Note that the lid imposes a chronological order. The default value is asc.
", + "in": "query", + "name": "sort", + "required": false, + "type": "string" + } + ], + "responses": { + "400": { + "description": "is returned if invalid values are specified for upto or level.
" + }, + "403": { + "description": "is returned if the log is requested for any database other than _system.
" + }, + "500": { + "description": "is returned if the server cannot generate the result due to an out-of-memory error.
" + } + }, + "summary": " Read global log from the server", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/long_echo": { + "get": { + "description": "\n\n
The call returns an object with the following attributes:
  • headers: object with HTTP headers received
  • requestType: the HTTP request method (e.g. GET)
  • parameters: object with URL parameters received
", + "parameters": [], + "responses": { + "200": { + "description": "Echo was returned successfully.
" + } + }, + "summary": " Return current request and continues", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/routing/reload": { + "post": { + "description": "\n\n
Reloads the routing information from the collection routing.
", + "parameters": [], + "responses": { + "200": { + "description": "Routing information was reloaded successfully.
" + } + }, + "summary": " Reloads the routing information", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/server/role": { + "get": { + "description": "\n\n
Returns the role of a server in a cluster. The role is returned in the role attribute of the result. Possible return values for role are:
  • COORDINATOR: the server is a coordinator in a cluster
  • PRIMARY: the server is a primary database server in a cluster
  • SECONDARY: the server is a secondary database server in a cluster
  • UNDEFINED: in a cluster, UNDEFINED is returned if the server role cannot be determined. On a single server, UNDEFINED is the only possible return value.
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned in all cases.
" + } + }, + "summary": " Return role of a server in a cluster", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/shutdown": { + "get": { + "description": "\n\nThis call initiates a clean shutdown sequence.
", + "parameters": [], + "responses": { + "200": { + "description": "is returned in all cases.
" + } + }, + "summary": " Initiate shutdown sequence", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/sleep": { + "get": { + "description": "\n\n
The call returns an object with the attribute duration. This takes as many seconds as the duration argument says.
", + "parameters": [ + { + "description": "wait `duration` seconds until the reply is sent.
", + "format": "integer", + "in": "path", + "name": "duration", + "required": true, + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Sleep was conducted successfully.
" + } + }, + "summary": " Sleep for a specified amount of seconds", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/statistics": { + "get": { + "description": "\n\n
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.

Example:

shell> curl --dump - http://localhost:8529/_admin/statistics\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"time\" : 1443627584.140516, \n  \"system\" : { \n    \"minorPageFaults\" : 137584, \n    \"majorPageFaults\" : 5, \n    \"userTime\" : 36.03, \n    \"systemTime\" : 1.34, \n    \"numberOfThreads\" : 23, \n    \"residentSize\" : 192217088, \n    \"residentSizePercent\" : 0.022905696552235805, \n    \"virtualSize\" : 3688673280 \n  }, \n  \"client\" : { \n    \"httpConnections\" : 1, \n    \"connectionTime\" : { \n      \"sum\" : 0.00033211708068847656, \n      \"count\" : 1, \n      \"counts\" : [ \n        1, \n        0, \n        0, \n        0 \n      ] \n    }, \n    \"totalTime\" : { \n      \"sum\" : 26.437366724014282, \n      \"count\" : 3555, \n      \"counts\" : [ \n        3204, \n        267, \n        60, \n        16, \n        3, \n        1, \n        4 \n      ] \n    }, \n    \"requestTime\" : { \n      \"sum\" : 14.136068344116211, \n      \"count\" : 3555, \n      \"counts\" : [ \n        3297, \n        219, \n        26, \n        8, \n        3, \n        2, \n        0 \n      ] \n    }, \n    \"queueTime\" : { \n      \"sum\" : 0.09597921371459961, \n      \"count\" : 3526, \n      \"counts\" : [ \n        3526, \n        0, \n        0, \n        0, \n        0, \n        0, \n        0 \n      ] \n    }, \n    \"ioTime\" : { \n      \"sum\" : 12.205319166183472, \n      \"count\" : 3555, \n      \"counts\" : [ \n        3438, \n        98, \n        12, \n        4, \n        0, \n        0, \n        3 \n      ] \n    }, \n    \"bytesSent\" : { \n      \"sum\" : 1578763, \n      \"count\" : 3555, \n      \"counts\" : [ \n        389, \n        2939, \n        15, \n        212, \n        0, \n        0 \n      ] \n    }, \n    \"bytesReceived\" : { \n      \"sum\" : 796270, \n      \"count\" : 3555, \n      \"counts\" : [ \n        3344, \n        211, \n        0, \n        0, \n        0, \n        0 \n      ] \n    } \n  }, \n  \"http\" : { \n    \"requestsTotal\" : 3567, \n    \"requestsAsync\" : 0, \n    \"requestsGet\" : 597, \n    \"requestsHead\" : 65, \n    \"requestsPost\" : 2652, \n    \"requestsPut\" : 110, \n    \"requestsPatch\" : 3, \n    \"requestsDelete\" : 139, \n    \"requestsOptions\" : 0, \n    \"requestsOther\" : 1 \n  }, \n  \"server\" : { \n    \"uptime\" : 47.32217192649841, \n    \"physicalMemory\" : 8391671808 \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Statistics were returned successfully.
" + } + }, + "summary": " Read the statistics", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/statistics-description": { + "get": { + "description": "\n\n
Returns a description of the statistics returned by /_admin/statistics. The returned objects contains an array of statistics groups in the attribute groups and an array 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 figure.
  • type: Either current, accumulated, or distribution.
  • cuts: The distribution vector.
  • units: Units in which the figure is measured.

Example:

shell> 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 Connection Statistics\", \n      \"description\" : \"Statistics about the connections.\" \n    }, \n    { \n      \"group\" : \"http\", \n      \"name\" : \"HTTP Request Statistics\", \n      \"description\" : \"Statistics about the HTTP requests.\" \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 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 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 the arangod 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\" : \"residentSizePercent\", \n      \"name\" : \"Resident Set Size\", \n      \"description\" : \"The percentage of physical memory used by the process as resident set size.\", \n      \"type\" : \"current\", \n      \"units\" : \"percent\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"virtualSize\", \n      \"name\" : \"Virtual Memory Size\", \n      \"description\" : \"On Windows, this figure contains the total amount of memory that the memory manager has committed for the arangod process. On other systems, this figure contains 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. This figure is not reported on Windows.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"system\", \n      \"identifier\" : \"majorPageFaults\", \n      \"name\" : \"Major Page Faults\", \n      \"description\" : \"On Windows, this figure contains the total number of page faults. On other system, this figure contains 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\" : \"Client Connections\", \n      \"description\" : \"The number of 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\" : \"http\", \n      \"identifier\" : \"requestsTotal\", \n      \"name\" : \"Total requests\", \n      \"description\" : \"Total number of HTTP requests.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"http\", \n      \"identifier\" : \"requestsAsync\", \n      \"name\" : \"Async requests\", \n      \"description\" : \"Number of asynchronously executed HTTP requests.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"http\", \n      \"identifier\" : \"requestsGet\", \n      \"name\" : \"HTTP GET requests\", \n      \"description\" : \"Number of HTTP GET requests.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"http\", \n      \"identifier\" : \"requestsHead\", \n      \"name\" : \"HTTP HEAD requests\", \n      \"description\" : \"Number of HTTP HEAD requests.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"http\", \n      \"identifier\" : \"requestsPost\", \n      \"name\" : \"HTTP POST requests\", \n      \"description\" : \"Number of HTTP POST requests.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"http\", \n      \"identifier\" : \"requestsPut\", \n      \"name\" : \"HTTP PUT requests\", \n      \"description\" : \"Number of HTTP PUT requests.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"http\", \n      \"identifier\" : \"requestsPatch\", \n      \"name\" : \"HTTP PATCH requests\", \n      \"description\" : \"Number of HTTP PATCH requests.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"http\", \n      \"identifier\" : \"requestsDelete\", \n      \"name\" : \"HTTP DELETE requests\", \n      \"description\" : \"Number of HTTP DELETE requests.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"http\", \n      \"identifier\" : \"requestsOptions\", \n      \"name\" : \"HTTP OPTIONS requests\", \n      \"description\" : \"Number of HTTP OPTIONS requests.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \n    }, \n    { \n      \"group\" : \"http\", \n      \"identifier\" : \"requestsOther\", \n      \"name\" : \"other HTTP requests\", \n      \"description\" : \"Number of other HTTP requests.\", \n      \"type\" : \"accumulated\", \n      \"units\" : \"number\" \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      \"group\" : \"server\", \n      \"identifier\" : \"physicalMemory\", \n      \"name\" : \"Physical Memory\", \n      \"description\" : \"Physical memory in bytes.\", \n      \"type\" : \"current\", \n      \"units\" : \"bytes\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Description was returned successfully.
" + } + }, + "summary": " Statistics description", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/test": { + "post": { + "description": "free style json body\n\n
Executes the specified tests on the server and returns an object with the test results. The object has an attribute \"error\" which states whether any error occurred. The object also has an attribute \"passed\" which indicates which tests passed and which did not.
", + "parameters": [ + { + "description": "A JSON object containing an attribute tests which lists the files containing the test suites.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + } + ], + "summary": " Runs tests on server", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/time": { + "get": { + "description": "\n\n
The call returns an object with the attribute time. This contains the current system time as a Unix timestamp with microsecond precision.
", + "parameters": [], + "responses": { + "200": { + "description": "Time was returned successfully.
" + } + }, + "summary": " Return system time", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_admin/wal/flush": { + "put": { + "description": "\n\n
Flushes the write-ahead log. By flushing the currently active write-ahead logfile, the data in it can be transferred to collection journals and datafiles. This is useful to ensure that all data for a collection is present in the collection journals and datafiles, for example, when dumping the data of a collection.
", + "parameters": [ + { + "description": "Whether or not the operation should block until the not-yet synchronized data in the write-ahead log was synchronized to disk.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + }, + { + "description": "Whether or not the operation should block until the data in the flushed log has been collected by the write-ahead log garbage collector. Note that setting this option to true might block for a long time if there are long-running transactions and the write-ahead log garbage collector cannot finish garbage collection.
", + "in": "query", + "name": "waitForCollector", + "required": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "Is returned if the operation succeeds.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + } + }, + "summary": " Flushes the write-ahead log", + "tags": [ + "wal" + ], + "x-examples": [], + "x-filename": "wal - js/actions/_admin/wal/app.js" + } + }, + "/_admin/wal/properties": { + "get": { + "description": "\n\n
Retrieves the configuration of the write-ahead log. The result is a JSON object with the following attributes:
  • allowOversizeEntries: whether or not operations that are bigger than a single logfile can be executed and stored
  • logfileSize: the size of each write-ahead logfile
  • historicLogfiles: the maximum number of historic logfiles to keep
  • reserveLogfiles: the maximum number of reserve logfiles that ArangoDB allocates in the background
  • syncInterval: the interval for automatic synchronization of not-yet synchronized write-ahead log data (in milliseconds)
  • throttleWait: the maximum wait time that operations will wait before they get aborted if case of write-throttling (in milliseconds)
  • throttleWhenPending: the number of unprocessed garbage-collection operations that, when reached, will activate write-throttling. A value of 0 means that write-throttling will not be triggered.

Example:

shell> curl --dump - http://localhost:8529/_admin/wal/properties\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"allowOversizeEntries\" : true, \n  \"logfileSize\" : 33554432, \n  \"historicLogfiles\" : 10, \n  \"reserveLogfiles\" : 1, \n  \"syncInterval\" : 100, \n  \"throttleWait\" : 15000, \n  \"throttleWhenPending\" : 0, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned if the operation succeeds.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.

" + } + }, + "summary": " Retrieves the configuration of the write-ahead log", + "tags": [ + "wal" + ], + "x-examples": [], + "x-filename": "wal - js/actions/_admin/wal/app.js" + }, + "put": { + "description": "\n\n
Configures the behavior of the write-ahead log. The body of the request must be a JSON object with the following attributes:
  • allowOversizeEntries: whether or not operations that are bigger than a single logfile can be executed and stored
  • logfileSize: the size of each write-ahead logfile
  • historicLogfiles: the maximum number of historic logfiles to keep
  • reserveLogfiles: the maximum number of reserve logfiles that ArangoDB allocates in the background
  • throttleWait: the maximum wait time that operations will wait before they get aborted if case of write-throttling (in milliseconds)
  • throttleWhenPending: the number of unprocessed garbage-collection operations that, when reached, will activate write-throttling. A value of 0 means that write-throttling will not be triggered.
Specifying any of the above attributes is optional. Not specified attributes will be ignored and the configuration for them will not be modified.

Example:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_admin/wal/properties <<EOF\n{ \n  \"logfileSize\" : 33554432, \n  \"allowOversizeEntries\" : true \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"allowOversizeEntries\" : true, \n  \"logfileSize\" : 33554432, \n  \"historicLogfiles\" : 10, \n  \"reserveLogfiles\" : 1, \n  \"syncInterval\" : 100, \n  \"throttleWait\" : 15000, \n  \"throttleWhenPending\" : 0, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned if the operation succeeds.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.

" + } + }, + "summary": " Configures the write-ahead log", + "tags": [ + "wal" + ], + "x-examples": [], + "x-filename": "wal - js/actions/_admin/wal/app.js" + } + }, + "/_admin/wal/transactions": { + "get": { + "description": "\n\n
Returns information about the currently running transactions. The result is a JSON object with the following attributes:
  • runningTransactions: number of currently running transactions
  • minLastCollected: minimum id of the last collected logfile (at the start of each running transaction). This is null if no transaction is running.
  • minLastSealed: minimum id of the last sealed logfile (at the start of each running transaction). This is null if no transaction is running.

Example:

shell> curl --dump - http://localhost:8529/_admin/wal/transactions\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"runningTransactions\" : 0, \n  \"minLastCollected\" : null, \n  \"minLastSealed\" : null, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned if the operation succeeds.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.

" + } + }, + "summary": " Returns information about the currently running transactions", + "tags": [ + "wal" + ], + "x-examples": [], + "x-filename": "wal - js/actions/_admin/wal/app.js" + } + }, + "/_api/aqlfunction": { + "get": { + "description": "\n\nReturns all registered AQL user functions.
The call will return a JSON array with all user functions found. Each user function will at least have the following attributes:
  • name: The fully qualified name of the user function
  • code: A string representation of the function body

Example:

shell> curl --dump - http://localhost:8529/_api/aqlfunction\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n  { \n    \"name\" : \"myfunctions::temperature::celsiustofahrenheit\", \n    \"code\" : \"function (celsius) { return celsius * 1.8 + 32; }\" \n  } \n]\n

\n
", + "parameters": [ + { + "description": "Returns all registered AQL user functions from namespace namespace.
", + "in": "query", + "name": "namespace", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "if success HTTP 200 is returned.
" + } + }, + "summary": " Return registered AQL user functions", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + }, + "post": { + "description": "**A json post document with these Properties is required:**
  • isDeterministic: an optional boolean value to indicate that the function results are fully deterministic (function return value solely depends on the input value and return value is the same for repeated calls with same input). The isDeterministic attribute is currently not used but may be used later for optimisations.
  • code: a string representation of the function body.
  • name: the fully qualified name of the user functions.
\n\n
In case of success, the returned JSON object has the following properties:
  • error: boolean flag to indicate that an error occurred (false in this case)
  • code: the HTTP status code
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

Example:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/aqlfunction <<EOF\n{ \n  \"name\" : \"myfunctions::temperature::celsiustofahrenheit\", \n  \"code\" : \"function (celsius) { return celsius * 1.8 + 32; }\" \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"code\" : 201 \n}\n

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_aqlfunction" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "If the function already existed and was replaced by the call, the server will respond with HTTP 200.
" + }, + "201": { + "description": "If the function can be registered by the server, the server will respond with HTTP 201.
" + }, + "400": { + "description": "If the JSON representation is malformed or mandatory data is missing from the request, the server will respond with HTTP 400.
" + } + }, + "summary": " Create AQL user function", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + } + }, + "/_api/aqlfunction/{name}": { + "delete": { + "description": "\n\n
Removes an existing AQL user function, identified by name.
In case of success, the returned JSON object has the following properties:
  • error: boolean flag to indicate that an error occurred (false in this case)
  • code: the HTTP status code
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

Example: deletes a function:

shell> curl -X DELETE --dump - http://localhost:8529/_api/aqlfunction/square::x::y\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: function not found:

shell> curl -X DELETE --dump - http://localhost:8529/_api/aqlfunction/myfunction::x::y\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 404, \n  \"errorNum\" : 1582, \n  \"errorMessage\" : \"user function '%s()' not found\" \n}\n

\n
", + "parameters": [ + { + "description": "the name of the AQL user function.
", + "format": "string", + "in": "path", + "name": "name", + "required": true, + "type": "string" + }, + { + "description": "If set to true, then the function name provided in name is treated as a namespace prefix, and all functions in the specified namespace will be deleted. If set to false, the function name provided in name must be fully qualified, including any namespaces.
", + "in": "query", + "name": "group", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "If the function can be removed by the server, the server will respond with HTTP 200.
" + }, + "400": { + "description": "If the user function name is malformed, the server will respond with HTTP 400.
" + }, + "404": { + "description": "If the specified user user function does not exist, the server will respond with HTTP 404.
" + } + }, + "summary": " Remove existing AQL user function", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + } + }, + "/_api/batch": { + "post": { + "description": "free style json body\n\nExecutes a batch request. A batch request can contain any number of other requests that can be sent to ArangoDB in isolation. The benefit of using batch requests is that batching requests requires less client/server roundtrips than when sending isolated requests.
All parts of a batch request are executed serially on the server. The server will return the results of all parts in a single response when all parts are finished.
Technically, a batch request is a multipart HTTP request, with content-type `multipart/form-data`. A batch request consists of an envelope and the individual batch part actions. Batch part actions are \"regular\" HTTP requests, including full header and an optional body. Multiple batch parts are separated by a boundary identifier. The boundary identifier is declared in the batch envelope. The MIME content-type for each individual batch part must be `application/x-arango-batchpart`.
Please note that when constructing the individual batch parts, you must use CRLF (`\\r\\n`) as the line terminator as in regular HTTP messages.
The response sent by the server will be an `HTTP 200` response, with an optional error summary header `x-arango-errors`. This header contains the number of batch part operations that failed with an HTTP error code of at least 400. This header is only present in the response if the number of errors is greater than zero.
The response sent by the server is a multipart response, too. It contains the individual HTTP responses for all batch parts, including the full HTTP result header (with status code and other potential headers) and an optional result body. The individual batch parts in the result are seperated using the same boundary value as specified in the request.
The order of batch parts in the response will be the same as in the original client request. Client can additionally use the `Content-Id` MIME header in a batch part to define an individual id for each batch part. The server will return this id is the batch part responses, too.

Example: Sending a batch request with five batch parts:
  • GET /_api/version
  • DELETE /_api/collection/products
  • POST /_api/collection/products
  • GET /_api/collection/products/figures
  • DELETE /_api/collection/products
The boundary (`SomeBoundaryValue`) is passed to the server in the HTTP `Content-Type` HTTP header. Please note the reply is not displayed all accurate.


shell> curl -X POST --header 'Content-Type: multipart/form-data; boundary=SomeBoundaryValue' --data-binary @- --dump - http://localhost:8529/_api/batch <<EOF\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId1\r\n\r\nGET /_api/version HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId2\r\n\r\nDELETE /_api/collection/products HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: someId\r\n\r\nPOST /_api/collection/products HTTP/1.1\r\n\r\n{ \"name\": \"products\" }\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: nextId\r\n\r\nGET /_api/collection/products/figures HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: otherId\r\n\r\nDELETE /_api/collection/products HTTP/1.1\r\n--SomeBoundaryValue--\r\n\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: multipart/form-data; boundary=SomeBoundaryValue\nx-arango-errors: 1\n\n\"--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\nContent-Id: myId1\\r\\n\\r\\nHTTP/1.1 200 OK\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 43\\r\\n\\r\\n{\\\"server\\\":\\\"arango\\\",\\\"version\\\":\\\"2.7.0-devel\\\"}\\r\\n--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\nContent-Id: myId2\\r\\n\\r\\nHTTP/1.1 404 Not Found\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 88\\r\\n\\r\\n{\\\"error\\\":true,\\\"code\\\":404,\\\"errorNum\\\":1203,\\\"errorMessage\\\":\\\"unknown collection 'products'\\\"}\\r\\n--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\nContent-Id: someId\\r\\n\\r\\nHTTP/1.1 200 OK\\r\\nLocation: /_db/_system/_api/collection/products\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 137\\r\\n\\r\\n{\\\"id\\\":\\\"619502023\\\",\\\"name\\\":\\\"products\\\",\\\"waitForSync\\\":false,\\\"isVolatile\\\":false,\\\"isSystem\\\":false,\\\"status\\\":3,\\\"type\\\":2,\\\"error\\\":false,\\\"code\\\":200}\\r\\n--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\nContent-Id: nextId\\r\\n\\r\\nHTTP/1.1 200 OK\\r\\nLocation: /_db/_system/_api/collection/products/figures\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 635\\r\\n\\r\\n{\\\"id\\\":\\\"619502023\\\",\\\"name\\\":\\\"products\\\",\\\"isSystem\\\":false,\\\"doCompact\\\":true,\\\"isVolatile\\\":false,\\\"journalSize\\\":1048576,\\\"keyOptions\\\":{\\\"type\\\":\\\"traditional\\\",\\\"allowUserKeys\\\":true},\\\"waitForSync\\\":false,\\\"indexBuckets\\\":8,\\\"count\\\":0,\\\"figures\\\":{\\\"alive\\\":{\\\"count\\\":0,\\\"size\\\":0},\\\"dead\\\":{\\\"count\\\":0,\\\"size\\\":0,\\\"deletion\\\":0},\\\"datafiles\\\":{\\\"count\\\":0,\\\"fileSize\\\":0},\\\"journals\\\":{\\\"count\\\":0,\\\"fileSize\\\":0},\\\"compactors\\\":{\\\"count\\\":0,\\\"fileSize\\\":0},\\\"shapefiles\\\":{\\\"count\\\":0,\\\"fileSize\\\":0},\\\"shapes\\\":{\\\"count\\\":0,\\\"size\\\":0},\\\"attributes\\\":{\\\"count\\\":0,\\\"size\\\":0},\\\"indexes\\\":{\\\"count\\\":1,\\\"size\\\":16064},\\\"lastTick\\\":\\\"0\\\",\\\"uncollectedLogfileEntries\\\":0},\\\"status\\\":3,\\\"type\\\":2,\\\"error\\\":false,\\\"code\\\":200}\\r\\n--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\nContent-Id: otherId\\r\\n\\r\\nHTTP/1.1 200 OK\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 43\\r\\n\\r\\n{\\\"id\\\":\\\"619502023\\\",\\\"error\\\":false,\\\"code\\\":200}\\r\\n--SomeBoundaryValue--\"\n

\n
Example: Sending a batch request, setting the boundary implicitly (the server will in this case try to find the boundary at the beginning of the request body).

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/batch <<EOF\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nDELETE /_api/collection/notexisting1 HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nDELETE /_api/collection/notexisting2 HTTP/1.1\r\n--SomeBoundaryValue--\r\n\nEOF\n\nHTTP/1.1 200 OK\nx-arango-errors: 2\n\n\"--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\n\\r\\nHTTP/1.1 404 Not Found\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 92\\r\\n\\r\\n{\\\"error\\\":true,\\\"code\\\":404,\\\"errorNum\\\":1203,\\\"errorMessage\\\":\\\"unknown collection 'notexisting1'\\\"}\\r\\n--SomeBoundaryValue\\r\\nContent-Type: application/x-arango-batchpart\\r\\n\\r\\nHTTP/1.1 404 Not Found\\r\\nContent-Type: application/json; charset=utf-8\\r\\nContent-Length: 92\\r\\n\\r\\n{\\\"error\\\":true,\\\"code\\\":404,\\\"errorNum\\\":1203,\\\"errorMessage\\\":\\\"unknown collection 'notexisting2'\\\"}\\r\\n--SomeBoundaryValue--\"\n

\n
", + "parameters": [ + { + "description": "The multipart batch request, consisting of the envelope and the individual batch parts.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + } + ], + "responses": { + "200": { + "description": "is returned if the batch was received successfully. HTTP 200 is returned even if one or multiple batch part actions failed.
" + }, + "400": { + "description": "is returned if the batch envelope is malformed or incorrectly formatted. This code will also be returned if the content-type of the overall batch request or the individual MIME parts is not as expected.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + } + }, + "summary": "executes a batch request", + "tags": [ + "Bulk" + ], + "x-examples": [], + "x-filename": "Bulk - arangod/RestHandler/RestExportHandler.cpp, arangod/RestHandler/RestImportHandler.cpp, arangod/RestHandler/RestBatchHandler.cpp" + } + }, + "/_api/collection": { + "get": { + "description": "\n\nReturns an object with an attribute collections containing an array of all collection descriptions. The same information is also available in the names as an object 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.

Example: Return information about all collections:

shell> 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\" : \"6216135\", \n      \"name\" : \"_queues\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"5757383\", \n      \"name\" : \"_configuration\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"22206919\", \n      \"name\" : \"animals\", \n      \"isSystem\" : false, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"14145991\", \n      \"name\" : \"_sessions\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"2087367\", \n      \"name\" : \"_graphs\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"2480583\", \n      \"name\" : \"_cluster_kickstarter_plans\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"252359\", \n      \"name\" : \"_users\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"14866887\", \n      \"name\" : \"_system_users_users\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"4577735\", \n      \"name\" : \"_statisticsRaw\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"2349511\", \n      \"name\" : \"_routing\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"6347207\", \n      \"name\" : \"_jobs\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"7199175\", \n      \"name\" : \"_apps\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"4970951\", \n      \"name\" : \"_statistics\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"5364167\", \n      \"name\" : \"_statistics15\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"21354951\", \n      \"name\" : \"demo\", \n      \"isSystem\" : false, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"4446663\", \n      \"name\" : \"_aqlfunctions\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    { \n      \"id\" : \"2218439\", \n      \"name\" : \"_modules\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    } \n  ], \n  \"names\" : { \n    \"_queues\" : { \n      \"id\" : \"6216135\", \n      \"name\" : \"_queues\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_configuration\" : { \n      \"id\" : \"5757383\", \n      \"name\" : \"_configuration\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"animals\" : { \n      \"id\" : \"22206919\", \n      \"name\" : \"animals\", \n      \"isSystem\" : false, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_sessions\" : { \n      \"id\" : \"14145991\", \n      \"name\" : \"_sessions\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_graphs\" : { \n      \"id\" : \"2087367\", \n      \"name\" : \"_graphs\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_cluster_kickstarter_plans\" : { \n      \"id\" : \"2480583\", \n      \"name\" : \"_cluster_kickstarter_plans\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_users\" : { \n      \"id\" : \"252359\", \n      \"name\" : \"_users\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_system_users_users\" : { \n      \"id\" : \"14866887\", \n      \"name\" : \"_system_users_users\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_statisticsRaw\" : { \n      \"id\" : \"4577735\", \n      \"name\" : \"_statisticsRaw\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_routing\" : { \n      \"id\" : \"2349511\", \n      \"name\" : \"_routing\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_jobs\" : { \n      \"id\" : \"6347207\", \n      \"name\" : \"_jobs\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_apps\" : { \n      \"id\" : \"7199175\", \n      \"name\" : \"_apps\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_statistics\" : { \n      \"id\" : \"4970951\", \n      \"name\" : \"_statistics\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_statistics15\" : { \n      \"id\" : \"5364167\", \n      \"name\" : \"_statistics15\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"demo\" : { \n      \"id\" : \"21354951\", \n      \"name\" : \"demo\", \n      \"isSystem\" : false, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_aqlfunctions\" : { \n      \"id\" : \"4446663\", \n      \"name\" : \"_aqlfunctions\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    }, \n    \"_modules\" : { \n      \"id\" : \"2218439\", \n      \"name\" : \"_modules\", \n      \"isSystem\" : true, \n      \"status\" : 3, \n      \"type\" : 2 \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [ + { + "description": "Whether or not system collections should be excluded from the result.
", + "in": "query", + "name": "excludeSystem", + "required": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "The list of collections
" + } + }, + "summary": "reads all collections", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "post": { + "description": "**A json post document with these Properties is required:**
  • journalSize: The maximal size of a journal or datafile in bytes. The value must be at least `1048576` (1 MiB). (The default is a configuration parameter)
  • keyOptions: additional options for key generation. If specified, then keyOptions should be a JSON array containing the following attributes:
    • 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.
    • type: specifies the type of the key generator. The currently available generators are traditional and autoincrement.
    • 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.
  • name: The name of the collection.
  • waitForSync: If true then the data is synchronized to disk before returning from a document create, update, replace or removal operation. (default: false)
  • doCompact: whether or not the collection will be compacted (default is true)
  • isVolatile: 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 synchronization to disk and does not calculate any CRC checksums for datafiles (as there are no datafiles). This option should therefore be used for cache-type collections only, and not for data that cannot be re-created otherwise. (The default is false)
  • shardKeys: (The default is [ \"_key\" ]): in a cluster, this attribute determines which document attributes are used to determine the target shard for documents. Documents are sent to shards based on the values of their shard key attributes. The values of all shard key attributes in a document are hashed, and the hash value is used to determine the target shard. Note: Values of shard key attributes cannot be changed once set. This option is meaningless in a single server setup.
  • numberOfShards: (The default is 1): in a cluster, this value determines the number of shards to create for the collection. In a single server setup, this option is meaningless.
  • isSystem: 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. (The default is false)
  • type: (The default is 2): the type of the collection to create. The following values for type are valid:
    • 2: document collection
    • 3: edges collection
  • indexBuckets: The: number of buckets into which indexes using a hash table are split. The default is 16 and this number has to be a power of 2 and less than or equal to 1024.
    For very large collections one should increase this to avoid long pauses when the hash table has to be initially built or resized, since buckets are resized individually and can be initially built in parallel. For example, 64 might be a sensible value for a collection with 100 000 000 documents. Currently, only the edge index respects this value, but other index types might follow in future ArangoDB versions. Changes (see below) are applied when the collection is loaded the next time.
\n\nCreates an new collection with a given name. The request must contain an object with the following attributes.


Example:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/collection <<EOF\n{ \n  \"name\" : \"testCollectionBasics\" \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_db/_system/_api/collection/testCollectionBasics\n\n{ \n  \"id\" : \"619895239\", \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}\nshell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/collection <<EOF\n{ \n  \"name\" : \"testCollectionEdges\", \n  \"type\" : 3 \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_db/_system/_api/collection/testCollectionEdges\n\n{ \n  \"id\" : \"620026311\", \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
Example:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/collection <<EOF\n{ \n  \"name\" : \"testCollectionUsers\", \n  \"keyOptions\" : { \n    \"type\" : \"autoincrement\", \n    \"increment\" : 5, \n    \"allowUserKeys\" : true \n  } \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_db/_system/_api/collection/testCollectionUsers\n\n{ \n  \"id\" : \"620288455\", \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
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_collection" + }, + "x-description-offset": 59 + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.

" + } + }, + "summary": " Create collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}": { + "delete": { + "description": "\n\nDrops the collection identified by collection-name.
If the collection was successfully dropped, an object is returned with the following attributes:
  • error: false
  • id: The identifier of the dropped collection.

Example: Using an identifier:

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

\n
Example: Using a name:

shell> 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\" : \"620681671\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [ + { + "description": "The name of the collection to drop.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Drops collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "get": { + "description": "\n\nThe result is an object describing the collection with the following attributes:
  • id: The identifier of the collection.
  • name: The name of the collection.
  • status: The status of the collection as number. - 1: new born collection - 2: unloaded - 3: loaded - 4: in the process of being unloaded - 5: deleted - 6: loading
Every other status indicates a corrupted collection.
  • type: The type of the collection as number. - 2: document collection (normal case) - 3: edges collection
  • isSystem: If true then the collection is a system collection.
", + "parameters": [ + { + "description": "The name of the collection.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Return information about a collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}/checksum": { + "get": { + "description": "\n\nWill calculate a checksum of the meta-data (keys and optionally revision ids) and optionally the 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 system attribute of the documents contained in the collection. For edge collections, the system attributes _from and _to will also be included in the calculation.
By setting the optional URL parameter withRevisions to true, then revision ids (_rev system attributes) are included in the checksumming.
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: Including user-defined attributes will make the checksumming slower.
The response is a JSON object with the following attributes:
  • checksum: The calculated checksum as a number.
  • revision: The collection revision id as a string.
Note: this method is not available in a cluster.

Example: Retrieving the checksum of a collection:

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

\n
Example: Retrieving the checksum of a collection including the collection data, but not the revisions:

shell> curl --dump - http://localhost:8529/_api/collection/products/checksum?withRevisions=false&withData=true\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"621468103\", \n  \"name\" : \"products\", \n  \"isSystem\" : false, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"checksum\" : 1042110547, \n  \"revision\" : \"621795783\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [ + { + "description": "The name of the collection.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + }, + { + "description": "Whether or not to include document revision ids in the checksum calculation.
", + "in": "query", + "name": "withRevisions", + "required": false, + "type": "boolean" + }, + { + "description": "Whether or not to include document body data in the checksum calculation.
", + "in": "query", + "name": "withData", + "required": false, + "type": "boolean" + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Return checksum for the collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}/count": { + "get": { + "description": "\n\nIn 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.

Example: Requesting the number of documents:

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

\n
", + "parameters": [ + { + "description": "The name of the collection.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Return number of documents in a collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}/figures": { + "get": { + "description": "\n\nIn addition to the above, the result also contains the number of documents and additional statistical information about the collection. Note : This will always load the collection into memory.
Note: collection data that are stored in the write-ahead log only are not reported in the results. When the write-ahead log is collected, documents might be added to journals and datafiles of the collection, which may modify the figures of the collection.
Additionally, the filesizes of collection and index parameter JSON files are not reported. These files should normally have a size of a few bytes each. Please also note that the fileSize values are reported in bytes and reflect the logical file sizes. Some filesystems may use optimisations (e.g. sparse files) so that the actual physical file size is somewhat different. Directories and sub-directories may also require space in the file system, but this space is not reported in the fileSize results.
That means that the figures reported do not reflect the actual disk usage of the collection with 100% accuracy. The actual disk usage of a collection is normally slightly higher than the sum of the reported fileSize values. Still the sum of the fileSize values can still be used as a lower bound approximation of the disk usage.
**A json document with these Properties is returned:**
  • count: The number of documents currently present in the collection.
  • journalSize: The maximal size of a journal or datafile in bytes.
  • figures: metrics of the collection
    • datafiles: Metrics regarding the datafiles
      • count: The number of datafiles.
      • fileSize: The total filesize of datafiles (in bytes).
    • uncollectedLogfileEntries: The number of markers in the write-ahead log for this collection that have not been transferred to journals or datafiles.
    • compactors:
      • count: The number of compactor files.
      • fileSize: The total filesize of all compactor files (in bytes).
    • dead: the items waiting to be swept away by the cleaner
      • count: The number of dead documents. This includes document versions that have been deleted or replaced by a newer version. Documents deleted or replaced that are contained the write-ahead log only are not reported in this figure.
      • deletion: The total number of deletion markers. Deletion markers only contained in the write-ahead log are not reporting in this figure.
      • size: The total size in bytes used by all dead documents.
    • indexes:
      • count: The total number of indexes defined for the collection, including the pre-defined indexes (e.g. primary index).
      • size: The total memory allocated for indexes in bytes.
    • shapes:
      • count: The total number of shapes used in the collection. This includes shapes that are not in use anymore. Shapes that are contained in the write-ahead log only are not reported in this figure.
      • size: The total size of all shapes (in bytes). This includes shapes that are not in use anymore. Shapes that are contained in the write-ahead log only are not reported in this figure.
    • alive: the currently active figures
      • count: The number of currently active documents in all datafiles and journals of the collection. Documents that are contained in the write-ahead log only are not reported in this figure.
      • size: The total size in bytes used by all active documents of the collection. Documents that are contained in the write-ahead log only are not reported in this figure.
    • attributes:
      • count: The total number of attributes used in the collection. Note: the value includes data of attributes that are not in use anymore. Attributes that are contained in the write-ahead log only are not reported in this figure.
      • size: The total size of the attribute data (in bytes). Note: the value includes data of attributes that are not in use anymore. Attributes that are contained in the write-ahead log only are not reported in this figure.
    • shapefiles: deprecated
      • count: The number of shape files. This value is deprecated and kept for compatibility reasons only. The value will always be 0 since ArangoDB 2.0 and higher.
      • fileSize: The total filesize of the shape files. This value is deprecated and kept for compatibility reasons only. The value will always be 0 in ArangoDB 2.0 and higher.
    • journals: Metrics regarding the journal files
      • count: The number of journal files.
      • fileSize: The total filesize of all journal files (in bytes).
    • maxTick: The tick of the last marker that was stored in a journal of the collection. This might be 0 if the collection does not yet have a journal.

Example: Using an identifier and requesting the figures of the collection:

shell> curl --dump - http://localhost:8529/_api/collection/products/figures\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_db/_system/_api/collection/products/figures\n\n{ \n  \"id\" : \"642111943\", \n  \"name\" : \"products\", \n  \"isSystem\" : false, \n  \"doCompact\" : true, \n  \"isVolatile\" : false, \n  \"journalSize\" : 1048576, \n  \"keyOptions\" : { \n    \"type\" : \"traditional\", \n    \"allowUserKeys\" : true \n  }, \n  \"waitForSync\" : false, \n  \"indexBuckets\" : 8, \n  \"count\" : 1, \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\" : 1, \n      \"fileSize\" : 1048576 \n    }, \n    \"compactors\" : { \n      \"count\" : 0, \n      \"fileSize\" : 0 \n    }, \n    \"shapefiles\" : { \n      \"count\" : 0, \n      \"fileSize\" : 0 \n    }, \n    \"shapes\" : { \n      \"count\" : 0, \n      \"size\" : 0 \n    }, \n    \"attributes\" : { \n      \"count\" : 0, \n      \"size\" : 0 \n    }, \n    \"indexes\" : { \n      \"count\" : 1, \n      \"size\" : 16120 \n    }, \n    \"lastTick\" : \"642505159\", \n    \"uncollectedLogfileEntries\" : 1 \n  }, \n  \"status\" : 3, \n  \"type\" : 2, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [ + { + "description": "The name of the collection.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Returns information about the collection:
", + "schema": { + "$ref": "#/definitions/JSA_get_api_collection_figures_rc_200" + }, + "x-description-offset": 1458 + }, + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Return statistics for a collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}/load": { + "put": { + "description": "\n\nLoads a collection into memory. Returns the collection on success.
The request body object 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
  • isSystem: If true then the collection is a system collection.

Example:

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

\n
", + "parameters": [ + { + "description": "The name of the collection.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Load collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}/properties": { + "get": { + "description": "\n\nIn addition to the above, the result will always contain the waitForSync, doCompact, journalSize, and isVolatile attributes. This is achieved by forcing a load of the underlying collection.
  • waitForSync: If true then creating, changing or removing documents will wait until the data has been synchronized to disk.
  • doCompact: Whether or not the collection will be compacted.
  • journalSize: The maximal size setting for journals / datafiles in bytes.
  • keyOptions: JSON object which contains key generation options: - 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 is solely responsible for generating keys and supplying own key values in the _key attribute of documents is considered an error.
  • isVolatile: If true then the collection data will be kept in memory only and ArangoDB will not write or sync the data to disk.
In a cluster setup, the result will also contain the following attributes:
  • numberOfShards: the number of shards of the collection.
  • shardKeys: contains the names of document attributes that are used to determine the target shard for documents.

Example: Using an identifier:

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

\n
Example: Using a name:

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

\n
", + "parameters": [ + { + "description": "The name of the collection.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Read properties of a collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + }, + "put": { + "description": "\n\nChanges 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 synchronized to disk.
  • journalSize: The maximal size of a journal or datafile in bytes. The value must be at least `1048576` (1 MB). Note that when changing the journalSize value, it will only have an effect for additional journals or datafiles that are created. Already existing journals or datafiles will not be affected.
On success an object with the following attributes is returned:
  • 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
  • isSystem: If true then the collection is a system collection.
  • isVolatile: If true then the collection data will be kept in memory only and ArangoDB will not write or sync the data to disk.
  • doCompact: Whether or not the collection will be compacted.
  • keyOptions: JSON object which contains key generation options: - 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 is solely responsible for generating keys and supplying own key values in the _key attribute of documents is considered an error.
Note: some other collection properties, such as type, isVolatile, numberOfShards or shardKeys cannot be changed once a collection is created.

Example:

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

\n
", + "parameters": [ + { + "description": "The name of the collection.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Change properties of a collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}/rename": { + "put": { + "description": "\n\nRenames 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
  • isSystem: If true then the collection is a system collection.

Example:

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

\n
", + "parameters": [ + { + "description": "The name of the collection to rename.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned." + } + }, + "summary": " Rename collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}/revision": { + "get": { + "description": "\n\nIn 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.

Example: Retrieving the revision of a collection

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

\n
", + "parameters": [ + { + "description": "The name of the collection.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Return collection revision id", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}/rotate": { + "put": { + "description": "\n\nRotates the journal of a collection. The current journal of the collection will be closed and made a read-only datafile. The purpose of the rotate method is to make the data in the file available for compaction (compaction is only performed for read-only datafiles, and not for journals).
Saving new data in the collection subsequently will create a new journal file automatically if there is no current journal.
If returns an object with the attributes
  • result: will be true if rotation succeeded
Note: This method is not available in a cluster.

Example: Rotating the journal:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/collection/products/rotate <<EOF\n{ \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : true, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Rotating if no journal exists:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/collection/products/rotate <<EOF\n{ \n}\nEOF\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 400, \n  \"errorNum\" : 1105, \n  \"errorMessage\" : \"could not rotate journal: no journal\" \n}\n

\n
", + "parameters": [ + { + "description": "The name of the collection.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "400": { + "description": "If the collection currently has no journal, HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Rotate journal of a collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}/truncate": { + "put": { + "description": "\n\nRemoves all documents from the collection, but leaves the indexes intact.

Example:

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

\n
", + "parameters": [ + { + "description": "The name of the collection.
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Truncate collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/collection/{collection-name}/unload": { + "put": { + "description": "\n\nRemoves 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
  • isSystem: If true then the collection is a system collection.

Example:

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

\n
", + "parameters": [ + { + "description": "
", + "format": "string", + "in": "path", + "name": "collection-name", + "required": true, + "type": "string" + } + ], + "responses": { + "400": { + "description": "If the collection-name is missing, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Unload collection", + "tags": [ + "Collections" + ], + "x-examples": [], + "x-filename": "Collections - js/actions/_api/collection/app.js" + } + }, + "/_api/cursor": { + "post": { + "description": "**A json post document with these Properties is required:**
  • count: indicates whether the number of documents in the result set should be returned in the \"count\" attribute of the result. 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.
  • ttl: The time-to-live for the cursor (in seconds). The cursor will be removed on the server automatically after the specified amount of time. This is useful to ensure garbage collection of cursors that are not fully fetched by clients. If not set, a server-defined value will be used.
  • batchSize: maximum number of result documents to be transferred from the server to the client in one roundtrip. If this attribute is not set, a server-controlled default value will be used. A batchSize value of 0 is disallowed.
  • cache: flag to determine whether the AQL query cache shall be used. If set to false, then any query cache lookup will be skipped for the query. If set to true, it will lead to the query cache being checked for the query if the query cache mode is either on or demand.
  • bindVars: list of bind parameter objects. of type object
  • query: contains the query string to be executed
  • options: key/value object with extra options for the query.
    • profile: if set to true, then the additional query profiling information will be returned in the extra.stats return attribute if the query result is not served from the query cache.
    • optimizer.rules: a list of to-be-included or to-be-excluded optimizer rules can be put into this attribute, telling the optimizer to include or exclude specific rules. To disable a rule, prefix its name with a `-`, to enable a rule, prefix it with a `+`. There is also a pseudo-rule `all`, which will match all optimizer rules. of type string
    • fullCount: if set to true and the query contains a LIMIT clause, then the result will contain an extra attribute extra with a sub-attribute fullCount. This sub-attribute will contain the number of documents in the result before the last LIMIT in the query was applied. It can be used to count the number of documents that match certain filter criteria, but only return a subset of them, in one go. It is thus similar to MySQL's SQL_CALC_FOUND_ROWS hint. Note that setting the option will disable a few LIMIT optimizations and may lead to more documents being processed, and thus make queries run longer. Note that the fullCount sub-attribute will only be present in the result if the query has a LIMIT clause and the LIMIT clause is actually used in the query.
    • maxPlans: limits the maximum number of plans that are created by the AQL query optimizer.
\n\nThe 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.
**A json document with these Properties is returned:**
  • count: the total number of result documents available (only available if the query was executed with the count attribute set)
  • code: the HTTP status code
  • extra: an optional JSON object with extra information about the query result contained in its stats sub-attribute. For data-modification queries, the extra.stats sub-attribute will contain the number of modified documents and the number of documents that could not be modified due to an error (if ignoreErrors query option is specified)
  • cached: a boolean flag indicating whether the query result was served from the query cache or not. If the query result is served from the query cache, the extra return attribute will not contain any stats sub-attribute and no profile sub-attribute.
  • hasMore: A boolean indicator whether there are more results available for the cursor on the server
  • result: an array of result documents (might be empty if query has no results) anonymous json object
  • error: A flag to indicate that an error occurred (false in this case)
  • id: id of temporary cursor created on the server (optional, see above)
  • 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 (../ArangoErrors/README.md) here.

  • errorNum: the server error number
  • code: the HTTP status code
  • error: boolean flag to indicate that an error occurred (true in this case)

Example: Execute a query and extract the result in a single go

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor <<EOF\n{ \n  \"query\" : \"FOR p IN products LIMIT 2 RETURN p\", \n  \"count\" : true, \n  \"batchSize\" : 2 \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"hello2\" : \"world1\", \n      \"_id\" : \"products/648862151\", \n      \"_rev\" : \"648862151\", \n      \"_key\" : \"648862151\" \n    }, \n    { \n      \"hello1\" : \"world1\", \n      \"_id\" : \"products/648534471\", \n      \"_rev\" : \"648534471\", \n      \"_key\" : \"648534471\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"cached\" : false, \n  \"extra\" : { \n    \"stats\" : { \n      \"writesExecuted\" : 0, \n      \"writesIgnored\" : 0, \n      \"scannedFull\" : 2, \n      \"scannedIndex\" : 0, \n      \"filtered\" : 0 \n    }, \n    \"warnings\" : [ ] \n  }, \n  \"error\" : false, \n  \"code\" : 201 \n}\n

\n
Example: Execute a query and extract a part of the result

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor <<EOF\n{ \n  \"query\" : \"FOR p IN products LIMIT 5 RETURN p\", \n  \"count\" : true, \n  \"batchSize\" : 2 \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"hello3\" : \"world1\", \n      \"_id\" : \"products/647223751\", \n      \"_rev\" : \"647223751\", \n      \"_key\" : \"647223751\" \n    }, \n    { \n      \"hello5\" : \"world1\", \n      \"_id\" : \"products/647879111\", \n      \"_rev\" : \"647879111\", \n      \"_key\" : \"647879111\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"648075719\", \n  \"count\" : 5, \n  \"extra\" : { \n    \"stats\" : { \n      \"writesExecuted\" : 0, \n      \"writesIgnored\" : 0, \n      \"scannedFull\" : 5, \n      \"scannedIndex\" : 0, \n      \"filtered\" : 0 \n    }, \n    \"warnings\" : [ ] \n  }, \n  \"cached\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n

\n
Example: Using the query option \"fullCount\"

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

\n
Example: Enabling and disabling optimizer rules

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor <<EOF\n{ \n  \"query\" : \"FOR i IN 1..10 LET a = 1 LET b = 2 FILTER a + b == 3 RETURN i\", \n  \"count\" : true, \n  \"options\" : { \n    \"maxPlans\" : 1, \n    \"optimizer\" : { \n      \"rules\" : [ \n        \"-all\", \n        \"+remove-unnecessary-filters\" \n      ] \n    } \n  } \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    1, \n    2, \n    3, \n    4, \n    5, \n    6, \n    7, \n    8, \n    9, \n    10 \n  ], \n  \"hasMore\" : false, \n  \"count\" : 10, \n  \"cached\" : false, \n  \"extra\" : { \n    \"stats\" : { \n      \"writesExecuted\" : 0, \n      \"writesIgnored\" : 0, \n      \"scannedFull\" : 0, \n      \"scannedIndex\" : 0, \n      \"filtered\" : 0 \n    }, \n    \"warnings\" : [ ] \n  }, \n  \"error\" : false, \n  \"code\" : 201 \n}\n

\n
Example: Execute a data-modification query and retrieve the number of modified documents

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor <<EOF\n{ \n  \"query\" : \"FOR p IN products REMOVE p IN products\" \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ ], \n  \"hasMore\" : false, \n  \"cached\" : false, \n  \"extra\" : { \n    \"stats\" : { \n      \"writesExecuted\" : 2, \n      \"writesIgnored\" : 0, \n      \"scannedFull\" : 2, \n      \"scannedIndex\" : 0, \n      \"filtered\" : 0 \n    }, \n    \"warnings\" : [ ] \n  }, \n  \"error\" : false, \n  \"code\" : 201 \n}\n

\n
Example: Execute a data-modification query with option ignoreErrors

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor <<EOF\n{ \n  \"query\" : \"REMOVE 'bar' IN products OPTIONS { ignoreErrors: true }\" \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ ], \n  \"hasMore\" : false, \n  \"cached\" : false, \n  \"extra\" : { \n    \"stats\" : { \n      \"writesExecuted\" : 0, \n      \"writesIgnored\" : 1, \n      \"scannedFull\" : 0, \n      \"scannedIndex\" : 0, \n      \"filtered\" : 0 \n    }, \n    \"warnings\" : [ ] \n  }, \n  \"error\" : false, \n  \"code\" : 201 \n}\n

\n
Example: Bad query - Missing body

shell> curl -X POST --dump - http://localhost:8529/_api/cursor\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"expecting atom, got end-of-file\", \n  \"code\" : 400, \n  \"errorNum\" : 600 \n}\n

\n
Example: Bad query - Unknown collection

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

\n
Example: Bad query - Execute a data-modification query that attempts to remove a non-existing document

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

\n

", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_cursor" + }, + "x-description-offset": 59 + } + ], + "produces": [ + "application/json" + ], + "responses": { + "201": { + "description": "is returned if the result set can be created by the server.
", + "schema": { + "$ref": "#/definitions/JSF_post_api_cursor_rc_201" + }, + "x-description-offset": 300 + }, + "400": { + "description": "is returned if the JSON representation is malformed or the query specification is missing from the request.
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:
", + "schema": { + "$ref": "#/definitions/JSF_post_api_cursor_rc_400" + }, + "x-description-offset": 354 + }, + "404": { + "description": "The server will respond with HTTP 404 in case a non-existing collection is accessed in the query.
" + }, + "405": { + "description": "The server will respond with HTTP 405 if an unsupported HTTP method is used.
" + } + }, + "summary": " Create cursor", + "tags": [ + "Cursors" + ], + "x-examples": [], + "x-filename": "Cursors - arangod/RestHandler/RestCursorHandler.cpp" + } + }, + "/_api/cursor/{cursor-identifier}": { + "delete": { + "description": "\n\nDeletes 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.

Example:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor <<EOF\n{ \n  \"query\" : \"FOR p IN products LIMIT 5 RETURN p\", \n  \"count\" : true, \n  \"batchSize\" : 2 \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"hello3\" : \"world1\", \n      \"_id\" : \"products/650172871\", \n      \"_rev\" : \"650172871\", \n      \"_key\" : \"650172871\" \n    }, \n    { \n      \"hello1\" : \"world1\", \n      \"_id\" : \"products/649517511\", \n      \"_rev\" : \"649517511\", \n      \"_key\" : \"649517511\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"651024839\", \n  \"count\" : 5, \n  \"extra\" : { \n    \"stats\" : { \n      \"writesExecuted\" : 0, \n      \"writesIgnored\" : 0, \n      \"scannedFull\" : 5, \n      \"scannedIndex\" : 0, \n      \"filtered\" : 0 \n    }, \n    \"warnings\" : [ ] \n  }, \n  \"cached\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\nshell> curl -X DELETE --dump - http://localhost:8529/_api/cursor/651024839\n\n

\n
", + "parameters": [ + { + "description": "The id of the cursor
", + "format": "string", + "in": "path", + "name": "cursor-identifier", + "required": true, + "type": "string" + } + ], + "responses": { + "202": { + "description": "is returned if the server is aware of the cursor.
" + }, + "404": { + "description": "is returned if the server is not aware of the cursor. It is also returned if a cursor is used after it has been destroyed.
" + } + }, + "summary": " Delete cursor", + "tags": [ + "Cursors" + ], + "x-examples": [], + "x-filename": "Cursors - arangod/RestHandler/RestCursorHandler.cpp" + }, + "put": { + "description": "\n\n
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.

Example: Valid request for next batch

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor <<EOF\n{ \n  \"query\" : \"FOR p IN products LIMIT 5 RETURN p\", \n  \"count\" : true, \n  \"batchSize\" : 2 \n}\nEOF\n\nshell> curl -X PUT --dump - http://localhost:8529/_api/cursor/655481287\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"hello1\" : \"world1\", \n      \"_id\" : \"products/653973959\", \n      \"_rev\" : \"653973959\", \n      \"_key\" : \"653973959\" \n    }, \n    { \n      \"hello3\" : \"world1\", \n      \"_id\" : \"products/654629319\", \n      \"_rev\" : \"654629319\", \n      \"_key\" : \"654629319\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"655481287\", \n  \"count\" : 5, \n  \"extra\" : { \n    \"stats\" : { \n      \"writesExecuted\" : 0, \n      \"writesIgnored\" : 0, \n      \"scannedFull\" : 5, \n      \"scannedIndex\" : 0, \n      \"filtered\" : 0 \n    }, \n    \"warnings\" : [ ] \n  }, \n  \"cached\" : false, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Missing identifier

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

\n
Example: Unknown identifier

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

\n
", + "parameters": [ + { + "description": "The name of the cursor
", + "format": "string", + "in": "path", + "name": "cursor-identifier", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The server will respond with HTTP 200 in case of success.
" + }, + "400": { + "description": "If the cursor identifier is omitted, the server will respond with HTTP 404.
" + }, + "404": { + "description": "If no cursor with the specified identifier can be found, the server will respond with HTTP 404.
" + } + }, + "summary": " Read next batch from cursor", + "tags": [ + "Cursors" + ], + "x-examples": [], + "x-filename": "Cursors - arangod/RestHandler/RestCursorHandler.cpp" + } + }, + "/_api/database": { + "get": { + "description": "\n\nRetrieves the list of all existing databases
Note: retrieving the list of databases is only possible from within the _system database.

Example:

shell> curl --dump - http://localhost:8529/_api/database\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    \"_system\" \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned if the list of database was compiled successfully.
" + }, + "400": { + "description": "is returned if the request is invalid.
" + }, + "403": { + "description": "is returned if the request was not executed in the _system database.
" + } + }, + "summary": " List of databases", + "tags": [ + "Database" + ], + "x-examples": [], + "x-filename": "Database - js/actions/api-database.js" + }, + "post": { + "description": "**A json post document with these Properties is required:**
  • username: The user name as a string. If users is not specified or does not contain any users, a default user root will be created with an empty string password. This ensures that the new database will be accessible after it is created.
  • users: Has to be a list of user objects to initially create for the new database. Each user object can contain the following attributes: \n
    • username: Loginname of the user to be created
    • passwd: Password for the user
    • active: if False the user won't be able to log into the database.
  • extra: A JSON object with extra user information. The data contained in extra will be stored for the user but not be interpreted further by ArangoDB.
  • passwd: The user password as a string. If not specified, it will default to an empty string.
  • active: A Flag indicating whether the user account should be activated or not. The default value is true.
  • name: Has to contain a valid database name.
\n\nCreates a new database
The response is a JSON object with the attribute result set to true.
Note: creating a new database is only possible from within the _system database.

Example: Creating a database named example.

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/database <<EOF\n{ \n  \"name\" : \"example\" \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n

\n
Example: Creating a database named mydb with two users.

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/database <<EOF\n{ \n  \"name\" : \"mydb\", \n  \"users\" : [ \n    { \n      \"username\" : \"admin\", \n      \"passwd\" : \"secret\", \n      \"active\" : true \n    }, \n    { \n      \"username\" : \"tester\", \n      \"passwd\" : \"test001\", \n      \"active\" : false \n    } \n  ] \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_get_api_database_new" + }, + "x-description-offset": 59 + } + ], + "responses": { + "201": { + "description": "is returned if the database was created successfully.
" + }, + "400": { + "description": "is returned if the request parameters are invalid or if a database with the specified name already exists.
" + }, + "403": { + "description": "is returned if the request was not executed in the _system database.
" + }, + "409": { + "description": "is returned if a database with the specified name already exists.
" + } + }, + "summary": " Create database", + "tags": [ + "Database" + ], + "x-examples": [], + "x-filename": "Database - js/actions/api-database.js" + } + }, + "/_api/database/current": { + "get": { + "description": "\n\nRetrieves information about the current database
The response is a JSON object with the following attributes:
  • name: the name of the current database
  • id: the id of the current database
  • path: the filesystem path of the current database
  • isSystem: whether or not the current database is the _system database

Example:

shell> curl --dump - http://localhost:8529/_api/database/current\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"name\" : \"_system\", \n    \"id\" : \"121287\", \n    \"path\" : \"/tmp/vocdir.2239/databases/database-121287\", \n    \"isSystem\" : true \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned if the information was retrieved successfully.
" + }, + "400": { + "description": "is returned if the request is invalid.
" + }, + "404": { + "description": "is returned if the database could not be found.
" + } + }, + "summary": " Information of the database", + "tags": [ + "Database" + ], + "x-examples": [], + "x-filename": "Database - js/actions/api-database.js" + } + }, + "/_api/database/user": { + "get": { + "description": "\n\nRetrieves the list of all databases the current user can access without specifying a different username or password.

Example:

shell> curl --dump - http://localhost:8529/_api/database/user\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    \"_system\" \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned if the list of database was compiled successfully.
" + }, + "400": { + "description": "is returned if the request is invalid.
" + } + }, + "summary": " List of accessible databases ", + "tags": [ + "Database" + ], + "x-examples": [], + "x-filename": "Database - js/actions/api-database.js" + } + }, + "/_api/database/{database-name}": { + "delete": { + "description": "\n\nDrops the database along with all data stored in it.
Note: dropping a database is only possible from within the _system database. The _system database itself cannot be dropped.

Example:

shell> curl -X DELETE --dump - http://localhost:8529/_api/database/example\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : true, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [ + { + "description": "The name of the database
", + "format": "string", + "in": "path", + "name": "database-name", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the database was dropped successfully.
" + }, + "400": { + "description": "is returned if the request is malformed.
" + }, + "403": { + "description": "is returned if the request was not executed in the _system database.
" + }, + "404": { + "description": "is returned if the database could not be found.
" + } + }, + "summary": " Drop database", + "tags": [ + "Database" + ], + "x-examples": [], + "x-filename": "Database - js/actions/api-database.js" + } + }, + "/_api/document": { + "get": { + "description": "\n\nReturns an array of all keys, ids, or URI paths for all documents in the collection identified by collection. The type of the result array is determined by the type attribute.
Note that the results have no defined order and thus the order should not be relied on.

Example: Return all document paths

shell> 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    \"/_db/_system/_api/document/products/711580103\", \n    \"/_db/_system/_api/document/products/712235463\", \n    \"/_db/_system/_api/document/products/711907783\" \n  ] \n}\n

\n
Example: Return all document keys

shell> curl --dump - http://localhost:8529/_api/document/?collection=products&type=key\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"documents\" : [ \n    \"710662599\", \n    \"710334919\", \n    \"710990279\" \n  ] \n}\n

\n
Example: Collection does not exist

shell> 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 'doesnotexist' not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1203 \n}\n

\n
", + "parameters": [ + { + "description": "The name of the collection.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + }, + { + "description": "The type of the result. The following values are allowed:
  • id: returns an array of document ids (_id attributes)
  • key: returns an array of document keys (_key attributes)
  • path: returns an array of document URI paths. This is the default.
", + "in": "query", + "name": "type", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "All went good.
" + }, + "404": { + "description": "The collection does not exist.
" + } + }, + "summary": "Read all documents", + "tags": [ + "Documents" + ], + "x-examples": [], + "x-filename": "Documents - arangod/RestHandler/RestDocumentHandler.cpp" + }, + "post": { + "description": "free style json body\n\nCreates 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 synchronization 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 synchronization 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 synchronization for collections that have a default waitForSync value of true.

Example: Create a document in a collection named products. Note that the revision identifier might or might not by equal to the auto-generated key.

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

\n
Example: Create a document in a collection named products with a collection-level waitForSync value of false.

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

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

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

\n
Example: Create a document in a new, named collection

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

\n
Example: Unknown collection name

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

\n
Example: Illegal document

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/document?collection=products <<EOF\n{ 1: \"World\" }\nEOF\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
", + "parameters": [ + { + "description": "A JSON representation of the document.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + }, + { + "description": "The collection name.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + }, + { + "description": "If this parameter has a value of true or yes, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed.
Note: this flag is not supported in a cluster. Using it will result in an error.
", + "in": "query", + "name": "createCollection", + "required": false, + "type": "boolean" + }, + { + "description": "Wait until document has been synced to disk.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + } + ], + "responses": { + "201": { + "description": "is returned if the document was created successfully and waitForSync was true.
" + }, + "202": { + "description": "is returned if the document was created successfully and waitForSync was false.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a document. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": "Create document", + "tags": [ + "Documents" + ], + "x-examples": [], + "x-filename": "Documents - arangod/RestHandler/RestDocumentHandler.cpp" + } + }, + "/_api/document/{document-handle}": { + "delete": { + "description": "\n\nThe 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 removed document, _key contains the key which uniquely identifies a document in a given collection, and the attribute _rev contains the new 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 synchronization for collections that have a default waitForSync value of true.

Example: Using document handle:

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

\n
Example: Unknown document handle:

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

\n
Example: Revision conflict:

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

\n
", + "parameters": [ + { + "description": "Removes the document identified by document-handle.
", + "format": "string", + "in": "path", + "name": "document-handle", + "required": true, + "type": "string" + }, + { + "description": "You can conditionally remove a document based on a target revision id by using the rev URL parameter.
", + "in": "query", + "name": "rev", + "required": false, + "type": "string" + }, + { + "description": "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 more details).
", + "in": "query", + "name": "policy", + "required": false, + "type": "string" + }, + { + "description": "Wait until deletion operation has been synced to disk.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + }, + { + "description": "You can conditionally remove a document based on a target revision id by using the if-match HTTP header.
", + "in": "header", + "name": "If-Match", + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the document was removed successfully and waitForSync was true.
" + }, + "202": { + "description": "is returned if the document was removed successfully and waitForSync was false.
" + }, + "404": { + "description": "is returned if the collection or the document was not found. The response body contains an error document in this case.
" + }, + "412": { + "description": "is returned if a \"If-Match\" header or rev is given and the found document has a different version. The response will also contain the found document's current revision in the _rev attribute. Additionally, the attributes _id and _key will be returned.
" + } + }, + "summary": " Removes a document", + "tags": [ + "Documents" + ], + "x-examples": [], + "x-filename": "Documents - arangod/RestHandler/RestDocumentHandler.cpp" + }, + "get": { + "description": "\n\nReturns the document identified by document-handle. The returned document contains three special attributes: _id containing the document handle, _key containing key which uniquely identifies a document in a given collection and _rev containing the revision.

Example: Use a document handle:

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

\n
Example: Use a document handle and an etag:

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

\n
Example: Unknown document handle:

shell> 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\" : \"collection 'products' not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1203 \n}\n

\n
", + "parameters": [ + { + "description": "The handle of the document.
", + "format": "string", + "in": "path", + "name": "document-handle", + "required": true, + "type": "string" + }, + { + "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 an HTTP 304 is returned.
", + "in": "header", + "name": "If-None-Match", + "type": "string" + }, + { + "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 as the given etag. Otherwise a HTTP 412 is returned. As an alternative you can supply the etag in an attribute rev in the URL.
", + "in": "header", + "name": "If-Match", + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the document was found
" + }, + "304": { + "description": "is returned if the \"If-None-Match\" header is given and the document has the same version
" + }, + "404": { + "description": "is returned if the document or collection was not found
" + }, + "412": { + "description": "is returned if a \"If-Match\" header or rev is given and the found document has a different version. The response will also contain the found document's current revision in the _rev attribute. Additionally, the attributes _id and _key will be returned.
" + } + }, + "summary": "Read document", + "tags": [ + "Documents" + ], + "x-examples": [], + "x-filename": "Documents - arangod/RestHandler/RestDocumentHandler.cpp" + }, + "head": { + "description": "\n\nLike 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.

Example:

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

\n

", + "parameters": [ + { + "description": "The handle of the document.
", + "format": "string", + "in": "path", + "name": "document-handle", + "required": true, + "type": "string" + }, + { + "description": "You can conditionally fetch a document based on a target revision id by using the rev URL parameter.
", + "in": "query", + "name": "rev", + "required": false, + "type": "string" + }, + { + "description": "If the \"If-None-Match\" header is given, then it must contain exactly one etag. If the current document revision is different to the specified etag, an HTTP 200 response is returned. If the current document revision is identical to the specified etag, then an HTTP 304 is returned.
", + "in": "header", + "name": "If-None-Match", + "type": "string" + }, + { + "description": "You can conditionally fetch a document based on a target revision id by using the if-match HTTP header.
", + "in": "header", + "name": "If-Match", + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the document was found
" + }, + "304": { + "description": "is returned if the \"If-None-Match\" header is given and the document has same version
" + }, + "404": { + "description": "is returned if the document or collection was not found
" + }, + "412": { + "description": "is returned if a \"If-Match\" header or rev is given and the found document has a different version. The response will also contain the found document's current revision in the etag header.
" + } + }, + "summary": "Read document header", + "tags": [ + "Documents" + ], + "x-examples": [], + "x-filename": "Documents - arangod/RestHandler/RestDocumentHandler.cpp" + }, + "patch": { + "description": "free style json body\n\nPartially 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 synchronization 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 synchronization 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 synchronization 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, _key contains the key which uniquely identifies a document in a given collection, and 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).

Example: patches an existing document with new content.

shell> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/document/products/703846855 <<EOF\n{ \n  \"hello\" : \"world\" \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"704174535\"\nlocation: /_db/_system/_api/document/products/703846855\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/703846855\", \n  \"_rev\" : \"704174535\", \n  \"_key\" : \"703846855\" \n}\nshell> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/document/products/703846855 <<EOF\n{ \n  \"numbers\" : { \n    \"one\" : 1, \n    \"two\" : 2, \n    \"three\" : 3, \n    \"empty\" : null \n  } \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"704764359\"\nlocation: /_db/_system/_api/document/products/703846855\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/703846855\", \n  \"_rev\" : \"704764359\", \n  \"_key\" : \"703846855\" \n}\nshell> curl --dump - http://localhost:8529/_api/document/products/703846855\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"704764359\"\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/703846855\", \n  \"_rev\" : \"704764359\", \n  \"_key\" : \"703846855\" \n}\nshell> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/document/products/703846855?keepNull=false <<EOF\n{ \n  \"hello\" : null, \n  \"numbers\" : { \n    \"four\" : 4 \n  } \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"705223111\"\nlocation: /_db/_system/_api/document/products/703846855\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/703846855\", \n  \"_rev\" : \"705223111\", \n  \"_key\" : \"703846855\" \n}\nshell> curl --dump - http://localhost:8529/_api/document/products/703846855\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"705223111\"\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/703846855\", \n  \"_rev\" : \"705223111\", \n  \"_key\" : \"703846855\" \n}\n

\n
Example: Merging attributes of an object using `mergeObjects`:

shell> curl --dump - http://localhost:8529/_api/document/products/706075079\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"706075079\"\n\n{ \n  \"inhabitants\" : { \n    \"china\" : 1366980000, \n    \"india\" : 1263590000, \n    \"usa\" : 319220000 \n  }, \n  \"_id\" : \"products/706075079\", \n  \"_rev\" : \"706075079\", \n  \"_key\" : \"706075079\" \n}\nshell> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/document/products/706075079?mergeObjects=true <<EOF\n{ \n  \"inhabitants\" : { \n    \"indonesia\" : 252164800, \n    \"brazil\" : 203553000 \n  } \n}\nEOF\n\nshell> curl --dump - http://localhost:8529/_api/document/products/706075079\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"706599367\"\n\n{ \n  \"inhabitants\" : { \n    \"china\" : 1366980000, \n    \"india\" : 1263590000, \n    \"usa\" : 319220000, \n    \"indonesia\" : 252164800, \n    \"brazil\" : 203553000 \n  }, \n  \"_id\" : \"products/706075079\", \n  \"_rev\" : \"706599367\", \n  \"_key\" : \"706075079\" \n}\nshell> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/document/products/706075079?mergeObjects=false <<EOF\n{ \n  \"inhabitants\" : { \n    \"pakistan\" : 188346000 \n  } \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"707058119\"\nlocation: /_db/_system/_api/document/products/706075079\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/706075079\", \n  \"_rev\" : \"707058119\", \n  \"_key\" : \"706075079\" \n}\nshell> curl --dump - http://localhost:8529/_api/document/products/706075079\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"707058119\"\n\n{ \n  \"inhabitants\" : { \n    \"pakistan\" : 188346000 \n  }, \n  \"_id\" : \"products/706075079\", \n  \"_rev\" : \"707058119\", \n  \"_key\" : \"706075079\" \n}\n

\n
", + "parameters": [ + { + "description": "A JSON representation of the document update.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + }, + { + "description": "The handle of the document.
", + "format": "string", + "in": "path", + "name": "document-handle", + "required": true, + "type": "string" + }, + { + "description": "If the intention is to delete existing attributes with the patch command, the URL query 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.
", + "in": "query", + "name": "keepNull", + "required": false, + "type": "boolean" + }, + { + "description": "Controls whether objects (not arrays) will be merged if present in both the existing and the patch document. If set to false, the value in the patch document will overwrite the existing document's value. If set to true, objects will be merged. The default is true.
", + "in": "query", + "name": "mergeObjects", + "required": false, + "type": "boolean" + }, + { + "description": "Wait until document has been synced to disk.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + }, + { + "description": "You can conditionally patch a document based on a target revision id by using the rev URL parameter.
", + "in": "query", + "name": "rev", + "required": false, + "type": "string" + }, + { + "description": "To control the update behavior in case there is a revision mismatch, you can use the policy parameter.
", + "in": "query", + "name": "policy", + "required": false, + "type": "string" + }, + { + "description": "You can conditionally patch a document based on a target revision id by using the if-match HTTP header.
", + "in": "header", + "name": "If-Match", + "type": "string" + } + ], + "responses": { + "201": { + "description": "is returned if the document was created successfully and waitForSync was true.
" + }, + "202": { + "description": "is returned if the document was created successfully and waitForSync was false.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a document. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection or the document was not found
" + }, + "412": { + "description": "is returned if a \"If-Match\" header or rev is given and the found document has a different version. The response will also contain the found document's current revision in the _rev attribute. Additionally, the attributes _id and _key will be returned.
" + } + }, + "summary": " Patch document", + "tags": [ + "Documents" + ], + "x-examples": [], + "x-filename": "Documents - arangod/RestHandler/RestDocumentHandler.cpp" + }, + "put": { + "description": "free style json body\n\nCompletely 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 synchronization 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 synchronization 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 synchronization 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, _key contains the key which uniquely identifies a document in a given collection, and 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 can use 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 overridden 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.

Example: Using a document handle

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/document/products/714004935 <<EOF\n{\"Hello\": \"you\"}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"714332615\"\nlocation: /_db/_system/_api/document/products/714004935\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/714004935\", \n  \"_rev\" : \"714332615\", \n  \"_key\" : \"714004935\" \n}\n

\n
Example: Unknown document handle

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

\n
Example: Produce a revision conflict

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

\n
Example: Last write wins

shell> curl -X PUT --header 'If-Match: \"716298695\"' --data-binary @- --dump - http://localhost:8529/_api/document/products/715971015?policy=last <<EOF\n{}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"716560839\"\nlocation: /_db/_system/_api/document/products/715971015\n\n{ \n  \"error\" : false, \n  \"_id\" : \"products/715971015\", \n  \"_rev\" : \"716560839\", \n  \"_key\" : \"715971015\" \n}\n

\n
Example: Alternative to header fields

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

\n
", + "parameters": [ + { + "description": "A JSON representation of the new document.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + }, + { + "description": "The handle of the document.
", + "format": "string", + "in": "path", + "name": "document-handle", + "required": true, + "type": "string" + }, + { + "description": "Wait until document has been synced to disk.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + }, + { + "description": "You can conditionally replace a document based on a target revision id by using the rev URL parameter.
", + "in": "query", + "name": "rev", + "required": false, + "type": "string" + }, + { + "description": "To control the update behavior in case there is a revision mismatch, you can use the policy parameter (see below).
", + "in": "query", + "name": "policy", + "required": false, + "type": "string" + }, + { + "description": "You can conditionally replace a document based on a target revision id by using the if-match HTTP header.
", + "in": "header", + "name": "If-Match", + "type": "string" + } + ], + "responses": { + "201": { + "description": "is returned if the document was replaced successfully and waitForSync was true.
" + }, + "202": { + "description": "is returned if the document was replaced successfully and waitForSync was false.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a document. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection or the document was not found
" + }, + "412": { + "description": "is returned if a \"If-Match\" header or rev is given and the found document has a different version. The response will also contain the found document's current revision in the _rev attribute. Additionally, the attributes _id and _key will be returned.
" + } + }, + "summary": "Replace document", + "tags": [ + "Documents" + ], + "x-examples": [], + "x-filename": "Documents - arangod/RestHandler/RestDocumentHandler.cpp" + } + }, + "/_api/edge": { + "get": { + "description": "\n\nReturns an array of all URIs for all edges from the collection identified by collection.
", + "parameters": [ + { + "description": "The name of the collection.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "All went good.
" + }, + "404": { + "description": "The collection does not exist.
" + } + }, + "summary": " Read all edges from collection", + "tags": [ + "Graph edges" + ], + "x-examples": [], + "x-filename": "Graph edges - arangod/RestHandler/RestEdgeHandler.cpp, js/actions/api-edges.js" + }, + "post": { + "description": "free style json body\n\nCreates a new edge document in the collection named collection. A JSON representation of the document must be passed as the body of the POST request.
The from and to handles are immutable once the edge has been created.
In all other respects the method works like POST /document.

Example: Create an edge and read it back:

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

\n
", + "parameters": [ + { + "description": "A JSON representation of the edge document must be passed as the body of the POST request. This JSON object may contain the edge's document key in the _key attribute if needed.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + }, + { + "description": "Creates a new edge in the collection identified by collection name.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + }, + { + "description": "If this parameter has a value of true or yes, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed.
Note: This flag is not supported in a cluster. Using it will result in an error.
", + "in": "query", + "name": "createCollection", + "required": false, + "type": "boolean" + }, + { + "description": "Wait until the edge document has been synced to disk.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + }, + { + "description": "The document handle of the start point must be passed in from handle.
", + "in": "query", + "name": "from", + "required": true, + "type": "string" + }, + { + "description": "The document handle of the end point must be passed in to handle.
", + "in": "query", + "name": "to", + "required": true, + "type": "string" + } + ], + "responses": { + "201": { + "description": "is returned if the edge was created successfully and waitForSync was true.
" + }, + "202": { + "description": "is returned if the edge was created successfully and waitForSync was false.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of an edge, or if the collection specified is not an edge collection. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": "Create edge", + "tags": [ + "Graph edges" + ], + "x-examples": [], + "x-filename": "Graph edges - arangod/RestHandler/RestEdgeHandler.cpp, js/actions/api-edges.js" + } + }, + "/_api/edge/{document-handle}": { + "delete": { + "description": "\n\nThe 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 deleted edge document, _key contains the key which uniquely identifies a document in a given collection, and the attribute _rev contains the new 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 synchronization for collections that have a default waitForSync value of true.
", + "parameters": [ + { + "description": "Deletes the edge document identified by document-handle.
", + "format": "string", + "in": "path", + "name": "document-handle", + "required": true, + "type": "string" + }, + { + "description": "You can conditionally delete an edge document based on a target revision id by using the rev URL parameter.
", + "in": "query", + "name": "rev", + "required": false, + "type": "string" + }, + { + "description": "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 edge documents (see replacing edge documents for more details).
", + "in": "query", + "name": "policy", + "required": false, + "type": "string" + }, + { + "description": "Wait until edge document has been synced to disk.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + }, + { + "description": "You can conditionally delete an edge document based on a target revision id by using the if-match HTTP header.
", + "in": "header", + "name": "If-Match", + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the edge document was deleted successfully and waitForSync was true.
" + }, + "202": { + "description": "is returned if the edge document was deleted successfully and waitForSync was false.
" + }, + "404": { + "description": "is returned if the collection or the edge document was not found. The response body contains an error document in this case.
" + }, + "412": { + "description": "is returned if a \"If-Match\" header or rev is given and the found document has a different version. The response will also contain the found document's current revision in the _rev attribute. Additionally, the attributes _id and _key will be returned.
" + } + }, + "summary": " Deletes edge", + "tags": [ + "Graph edges" + ], + "x-examples": [], + "x-filename": "Graph edges - arangod/RestHandler/RestEdgeHandler.cpp, js/actions/api-edges.js" + }, + "get": { + "description": "\n\nReturns the edge identified by document-handle. The returned edge contains a few special attributes:
  • _id contains the document handle
  • _rev contains the revision
  • _from and to contain the document handles of the connected vertex documents
", + "parameters": [ + { + "description": "The handle of the edge document.
", + "format": "string", + "in": "path", + "name": "document-handle", + "required": true, + "type": "string" + }, + { + "description": "If the \"If-None-Match\" header is given, then it must contain exactly one etag. The edge is returned if it has a different revision than the given etag. Otherwise an HTTP 304 is returned.
", + "in": "header", + "name": "If-None-Match", + "type": "string" + }, + { + "description": "If the \"If-Match\" header is given, then it must contain exactly one etag. The edge 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.
", + "in": "header", + "name": "If-Match", + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the edge was found
" + }, + "304": { + "description": "is returned if the \"If-None-Match\" header is given and the edge has the same version
" + }, + "404": { + "description": "is returned if the edge or collection was not found
" + }, + "412": { + "description": "is returned if a \"If-Match\" header or rev is given and the found document has a different version. The response will also contain the found document's current revision in the _rev attribute. Additionally, the attributes _id and _key will be returned.
" + } + }, + "summary": " Read edge", + "tags": [ + "Graph edges" + ], + "x-examples": [], + "x-filename": "Graph edges - arangod/RestHandler/RestEdgeHandler.cpp, js/actions/api-edges.js" + }, + "head": { + "description": "\n\nLike GET, but only returns the header fields and not the body. You can use this call to get the current revision of an edge document or check if it was deleted.
", + "parameters": [ + { + "description": "The handle of the edge document.
", + "format": "string", + "in": "path", + "name": "document-handle", + "required": true, + "type": "string" + }, + { + "description": "You can conditionally fetch an edge document based on a target revision id by using the rev URL parameter.
", + "in": "query", + "name": "rev", + "required": false, + "type": "string" + }, + { + "description": "If the \"If-None-Match\" header is given, then it must contain exactly one etag. If the current document revision is different to the specified etag, an HTTP 200 response is returned. If the current document revision is identical to the specified etag, then an HTTP 304 is returned.
", + "in": "header", + "name": "If-None-Match", + "type": "string" + }, + { + "description": "You can conditionally fetch an edge document based on a target revision id by using the if-match HTTP header.
", + "in": "header", + "name": "If-Match", + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the edge document was found
" + }, + "304": { + "description": "is returned if the \"If-None-Match\" header is given and the edge document has same version
" + }, + "404": { + "description": "is returned if the edge document or collection was not found
" + }, + "412": { + "description": "is returned if a \"If-Match\" header or rev is given and the found document has a different version. The response will also contain the found document's current revision in the etag header.
" + } + }, + "summary": " Read edge header", + "tags": [ + "Graph edges" + ], + "x-examples": [], + "x-filename": "Graph edges - arangod/RestHandler/RestEdgeHandler.cpp, js/actions/api-edges.js" + }, + "patch": { + "description": "free style json body\n\nPartially updates the edge 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 edge document if they do not yet exist, and overwritten in the existing edge 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.
Note: Internal attributes such as _key, _from and _to are immutable once set and cannot be updated.
Optionally, the URL parameter waitForSync can be used to force synchronization of the edge 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 synchronization 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 synchronization 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 edge document, _key contains the key which uniquely identifies a document in a given collection, and the attribute _rev contains the new document revision.
If the edge document does not exist, then a HTTP 404 is returned and the body of the response contains an error document.
You can conditionally update an edge 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 edge documents (see replacing documents for details).
", + "parameters": [ + { + "description": "A JSON representation of the edge update.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + }, + { + "description": "The handle of the edge document.
", + "format": "string", + "in": "path", + "name": "document-handle", + "required": true, + "type": "string" + }, + { + "description": "If the intention is to delete existing attributes with the patch command, the URL query 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 edge document that are contained in the patch document with an attribute value of null.
", + "in": "query", + "name": "keepNull", + "required": false, + "type": "boolean" + }, + { + "description": "Controls whether objects (not arrays) will be merged if present in both the existing and the patch edge. If set to false, the value in the patch edge will overwrite the existing edge's value. If set to true, objects will be merged. The default is true.
", + "in": "query", + "name": "mergeObjects", + "required": false, + "type": "boolean" + }, + { + "description": "Wait until edge document has been synced to disk.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + }, + { + "description": "You can conditionally patch an edge document based on a target revision id by using the rev URL parameter.
", + "in": "query", + "name": "rev", + "required": false, + "type": "string" + }, + { + "description": "To control the update behavior in case there is a revision mismatch, you can use the policy parameter.
", + "in": "query", + "name": "policy", + "required": false, + "type": "string" + }, + { + "description": "You can conditionally patch an edge document based on a target revision id by using the if-match HTTP header.
", + "in": "header", + "name": "If-Match", + "type": "string" + } + ], + "responses": { + "201": { + "description": "is returned if the document was patched successfully and waitForSync was true.
" + }, + "202": { + "description": "is returned if the document was patched successfully and waitForSync was false.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation or when applied on an non-edge collection. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection or the edge document was not found
" + }, + "412": { + "description": "is returned if a \"If-Match\" header or rev is given and the found document has a different version. The response will also contain the found document's current revision in the _rev attribute. Additionally, the attributes _id and _key will be returned.
" + } + }, + "summary": " Patches edge", + "tags": [ + "Graph edges" + ], + "x-examples": [], + "x-filename": "Graph edges - arangod/RestHandler/RestEdgeHandler.cpp, js/actions/api-edges.js" + }, + "put": { + "description": "free style json body\n\nCompletely updates (i.e. replaces) the edge document identified by document-handle. If the edge document exists and can be updated, then a HTTP 201 is returned and the \"ETag\" header field contains the new revision of the edge document.
If the new edge 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. Note: The attributes _from and _to of an edge are immutable and cannot be updated either.
Optionally, the URL parameter waitForSync can be used to force synchronization of the edge 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 synchronization 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 synchronization 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 edge document, _key contains the key which uniquely identifies a document in a given collection, and the attribute _rev contains the new document revision.
If the edge 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 revision id for conditional replacements (i.e. replacements that will only be executed if the revision id found in the database matches the 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 revision id as returned in the _rev attribute of an edge document or by an HTTP etag header.
For example, to conditionally replace an edge document based on a specific revision id, you can use 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 edge 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 overridden 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.
", + "parameters": [ + { + "description": "A JSON representation of the new edge data.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + }, + { + "description": "The handle of the edge document.
", + "format": "string", + "in": "path", + "name": "document-handle", + "required": true, + "type": "string" + }, + { + "description": "Wait until edge document has been synced to disk.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + }, + { + "description": "You can conditionally replace an edge document based on a target revision id by using the rev URL parameter.
", + "in": "query", + "name": "rev", + "required": false, + "type": "string" + }, + { + "description": "To control the update behavior in case there is a revision mismatch, you can use the policy parameter (see below).
", + "in": "query", + "name": "policy", + "required": false, + "type": "string" + }, + { + "description": "You can conditionally replace an edge document based on a target revision id by using the if-match HTTP header.
", + "in": "header", + "name": "If-Match", + "type": "string" + } + ], + "responses": { + "201": { + "description": "is returned if the edge document was replaced successfully and waitForSync was true.
" + }, + "202": { + "description": "is returned if the edge document was replaced successfully and waitForSync was false.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of an edge document or if applied to a non-edge collection. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection or the edge document was not found
" + }, + "412": { + "description": "is returned if a \"If-Match\" header or rev is given and the found document has a different version. The response will also contain the found document's current revision in the _rev attribute. Additionally, the attributes _id and _key will be returned.
" + } + }, + "summary": "replaces an edge", + "tags": [ + "Graph edges" + ], + "x-examples": [], + "x-filename": "Graph edges - arangod/RestHandler/RestEdgeHandler.cpp, js/actions/api-edges.js" + } + }, + "/_api/edges/{collection-id}": { + "get": { + "description": "\n\nReturns an array of edges starting or ending in the vertex identified by vertex-handle.

Example: Any direction

shell> 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      \"_key\" : \"6\", \n      \"_rev\" : \"725211591\", \n      \"_from\" : \"vertices/2\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v2 -> v1\" \n    }, \n    { \n      \"_id\" : \"edges/7\", \n      \"_key\" : \"7\", \n      \"_rev\" : \"725735879\", \n      \"_from\" : \"vertices/4\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v4 -> v1\" \n    }, \n    { \n      \"_id\" : \"edges/5\", \n      \"_key\" : \"5\", \n      \"_rev\" : \"724687303\", \n      \"_from\" : \"vertices/1\", \n      \"_to\" : \"vertices/3\", \n      \"$label\" : \"v1 -> v3\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: In edges

shell> 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      \"_key\" : \"6\", \n      \"_rev\" : \"729930183\", \n      \"_from\" : \"vertices/2\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v2 -> v1\" \n    }, \n    { \n      \"_id\" : \"edges/7\", \n      \"_key\" : \"7\", \n      \"_rev\" : \"730454471\", \n      \"_from\" : \"vertices/4\", \n      \"_to\" : \"vertices/1\", \n      \"$label\" : \"v4 -> v1\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Out edges

shell> 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      \"_key\" : \"5\", \n      \"_rev\" : \"734124487\", \n      \"_from\" : \"vertices/1\", \n      \"_to\" : \"vertices/3\", \n      \"$label\" : \"v1 -> v3\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [ + { + "description": "The id of the collection.
", + "format": "string", + "in": "path", + "name": "collection-id", + "required": true, + "type": "string" + }, + { + "description": "The id of the start vertex.
", + "in": "query", + "name": "vertex", + "required": true, + "type": "string" + }, + { + "description": "Selects in or out direction for edges. If not set, any edges are returned.
", + "in": "query", + "name": "direction", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the edge collection was found and edges were retrieved.
" + }, + "400": { + "description": "is returned if the request contains invalid parameters.
" + }, + "404": { + "description": "is returned if the edge collection was not found.
" + } + }, + "summary": " Read in- or outbound edges", + "tags": [ + "Graph edges" + ], + "x-examples": [], + "x-filename": "Graph edges - arangod/RestHandler/RestEdgeHandler.cpp, js/actions/api-edges.js" + } + }, + "/_api/endpoint": { + "get": { + "description": "\n\nReturns an array of all configured endpoints the server is listening on. For each endpoint, the array of allowed databases is returned too if set.
The result is a JSON object which has the endpoints as keys, and an array of mapped database names as values for each endpoint.
If an array of mapped databases is empty, it means that all databases can be accessed via the endpoint. If an array of mapped databases contains more than one database name, this means that any of the databases might be accessed via the endpoint, and the first database in the arry will be treated as the default database for the endpoint. The default database will be used when an incoming request does not specify a database name in the request explicitly.
Note: retrieving the array of all endpoints is allowed in the system database only. Calling this action in any other database will make the server return an error.

Example:

shell> curl --dump - http://localhost:8529/_api/endpoint\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n  { \n    \"endpoint\" : \"tcp://127.0.0.1:32239\", \n    \"databases\" : [ ] \n  } \n]\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned when the array of endpoints can be determined successfully.
" + }, + "400": { + "description": "is returned if the action is not carried out in the system database.
" + }, + "405": { + "description": "The server will respond with HTTP 405 if an unsupported HTTP method is used.
" + } + }, + "summary": " Return list of all endpoints", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_api/explain": { + "post": { + "description": "**A json post document with these Properties is required:**
  • query: the query which you want explained; If the query references any bind variables, these must also be passed in the attribute bindVars. Additional options for the query can be passed in the options attribute.
  • options: Options for the query
    • optimizer.rules: an array of to-be-included or to-be-excluded optimizer rules can be put into this attribute, telling the optimizer to include or exclude specific rules. To disable a rule, prefix its name with a `-`, to enable a rule, prefix it with a `+`. There is also a pseudo-rule `all`, which will match all optimizer rules. of type string
    • maxNumberOfPlans: an optional maximum number of plans that the optimizer is allowed to generate. Setting this attribute to a low value allows to put a cap on the amount of work the optimizer does.
    • allPlans: if set to true, all possible execution plans will be returned. The default is false, meaning only the optimal plan will be returned.
  • bindVars: key/value pairs representing the bind values of type object
\n\n
To explain how an AQL query would be executed on the server, the query string can be sent to the server via an HTTP POST request. The server will then validate the query and create an execution plan for it. The execution plan will be returned, but the query will not be executed.
The execution plan that is returned by the server can be used to estimate the probable performance of the query. Though the actual performance will depend on many different factors, the execution plan normally can provide some rough estimates on the amount of work the server needs to do in order to actually run the query.
By default, the explain operation will return the optimal plan as chosen by the query optimizer The optimal plan is the plan with the lowest total estimated cost. The plan will be returned in the attribute plan of the response object. If the option allPlans is specified in the request, the result will contain all plans created by the optimizer. The plans will then be returned in the attribute plans.
The result will also contain an attribute warnings, which is an array of warnings that occurred during optimization or execution plan creation. Additionally, a stats attribute is contained in the result with some optimizer statistics.
Each plan in the result is a JSON object with the following attributes:
  • nodes: the array of execution nodes of the plan. The array of available node types can be found [here](../Aql/Optimizer.html)
  • estimatedCost: the total estimated cost for the plan. If there are multiple plans, the optimizer will choose the plan with the lowest total cost.
  • collections: an array of collections used in the query
  • rules: an array of rules the optimizer applied. An overview of the available rules can be found [here](../Aql/Optimizer.html)
  • variables: array of variables used in the query (note: this may contain internal variables created by the optimizer)

Example: Valid query

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/explain <<EOF\n{ \n  \"query\" : \"FOR p IN products RETURN p\" \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"plan\" : { \n    \"nodes\" : [ \n      { \n        \"type\" : \"SingletonNode\", \n        \"dependencies\" : [ ], \n        \"id\" : 1, \n        \"estimatedCost\" : 1, \n        \"estimatedNrItems\" : 1 \n      }, \n      { \n        \"type\" : \"EnumerateCollectionNode\", \n        \"dependencies\" : [ \n          1 \n        ], \n        \"id\" : 2, \n        \"estimatedCost\" : 11, \n        \"estimatedNrItems\" : 10, \n        \"database\" : \"_system\", \n        \"collection\" : \"products\", \n        \"outVariable\" : { \n          \"id\" : 0, \n          \"name\" : \"p\" \n        }, \n        \"random\" : false \n      }, \n      { \n        \"type\" : \"ReturnNode\", \n        \"dependencies\" : [ \n          2 \n        ], \n        \"id\" : 3, \n        \"estimatedCost\" : 21, \n        \"estimatedNrItems\" : 10, \n        \"inVariable\" : { \n          \"id\" : 0, \n          \"name\" : \"p\" \n        } \n      } \n    ], \n    \"rules\" : [ ], \n    \"collections\" : [ \n      { \n        \"name\" : \"products\", \n        \"type\" : \"read\" \n      } \n    ], \n    \"variables\" : [ \n      { \n        \"id\" : 0, \n        \"name\" : \"p\" \n      } \n    ], \n    \"estimatedCost\" : 21, \n    \"estimatedNrItems\" : 10 \n  }, \n  \"warnings\" : [ ], \n  \"stats\" : { \n    \"rulesExecuted\" : 23, \n    \"rulesSkipped\" : 0, \n    \"plansCreated\" : 1 \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: A plan with some optimizer rules applied

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/explain <<EOF\n{ \n  \"query\" : \"FOR p IN products LET a = p.id FILTER a == 4 LET name = p.name SORT p.id LIMIT 1 RETURN name\" \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"plan\" : { \n    \"nodes\" : [ \n      { \n        \"type\" : \"SingletonNode\", \n        \"dependencies\" : [ ], \n        \"id\" : 1, \n        \"estimatedCost\" : 1, \n        \"estimatedNrItems\" : 1 \n      }, \n      { \n        \"type\" : \"IndexRangeNode\", \n        \"dependencies\" : [ \n          1 \n        ], \n        \"id\" : 11, \n        \"estimatedCost\" : 11, \n        \"estimatedNrItems\" : 10, \n        \"database\" : \"_system\", \n        \"collection\" : \"products\", \n        \"outVariable\" : { \n          \"id\" : 0, \n          \"name\" : \"p\" \n        }, \n        \"ranges\" : [ \n          [ ] \n        ], \n        \"index\" : { \n          \"type\" : \"skiplist\", \n          \"id\" : \"737008071\", \n          \"unique\" : false, \n          \"sparse\" : false, \n          \"fields\" : [ \n            \"id\" \n          ] \n        }, \n        \"reverse\" : false \n      }, \n      { \n        \"type\" : \"CalculationNode\", \n        \"dependencies\" : [ \n          11 \n        ], \n        \"id\" : 3, \n        \"estimatedCost\" : 21, \n        \"estimatedNrItems\" : 10, \n        \"expression\" : { \n          \"type\" : \"attribute access\", \n          \"name\" : \"id\", \n          \"subNodes\" : [ \n            { \n              \"type\" : \"reference\", \n              \"name\" : \"p\", \n              \"id\" : 0 \n            } \n          ] \n        }, \n        \"outVariable\" : { \n          \"id\" : 1, \n          \"name\" : \"a\" \n        }, \n        \"canThrow\" : false, \n        \"expressionType\" : \"attribute\" \n      }, \n      { \n        \"type\" : \"CalculationNode\", \n        \"dependencies\" : [ \n          3 \n        ], \n        \"id\" : 4, \n        \"estimatedCost\" : 31, \n        \"estimatedNrItems\" : 10, \n        \"expression\" : { \n          \"type\" : \"compare ==\", \n          \"subNodes\" : [ \n            { \n              \"type\" : \"reference\", \n              \"name\" : \"a\", \n              \"id\" : 1 \n            }, \n            { \n              \"type\" : \"value\", \n              \"value\" : 4 \n            } \n          ] \n        }, \n        \"outVariable\" : { \n          \"id\" : 4, \n          \"name\" : \"3\" \n        }, \n        \"canThrow\" : false, \n        \"expressionType\" : \"simple\" \n      }, \n      { \n        \"type\" : \"FilterNode\", \n        \"dependencies\" : [ \n          4 \n        ], \n        \"id\" : 5, \n        \"estimatedCost\" : 41, \n        \"estimatedNrItems\" : 10, \n        \"inVariable\" : { \n          \"id\" : 4, \n          \"name\" : \"3\" \n        } \n      }, \n      { \n        \"type\" : \"LimitNode\", \n        \"dependencies\" : [ \n          5 \n        ], \n        \"id\" : 9, \n        \"estimatedCost\" : 42, \n        \"estimatedNrItems\" : 1, \n        \"offset\" : 0, \n        \"limit\" : 1, \n        \"fullCount\" : false \n      }, \n      { \n        \"type\" : \"CalculationNode\", \n        \"dependencies\" : [ \n          9 \n        ], \n        \"id\" : 6, \n        \"estimatedCost\" : 43, \n        \"estimatedNrItems\" : 1, \n        \"expression\" : { \n          \"type\" : \"attribute access\", \n          \"name\" : \"name\", \n          \"subNodes\" : [ \n            { \n              \"type\" : \"reference\", \n              \"name\" : \"p\", \n              \"id\" : 0 \n            } \n          ] \n        }, \n        \"outVariable\" : { \n          \"id\" : 2, \n          \"name\" : \"name\" \n        }, \n        \"canThrow\" : false, \n        \"expressionType\" : \"attribute\" \n      }, \n      { \n        \"type\" : \"ReturnNode\", \n        \"dependencies\" : [ \n          6 \n        ], \n        \"id\" : 10, \n        \"estimatedCost\" : 44, \n        \"estimatedNrItems\" : 1, \n        \"inVariable\" : { \n          \"id\" : 2, \n          \"name\" : \"name\" \n        } \n      } \n    ], \n    \"rules\" : [ \n      \"move-calculations-up\", \n      \"remove-redundant-calculations\", \n      \"move-calculations-up-2\", \n      \"use-index-for-sort\", \n      \"remove-unnecessary-calculations-2\", \n      \"move-calculations-down\" \n    ], \n    \"collections\" : [ \n      { \n        \"name\" : \"products\", \n        \"type\" : \"read\" \n      } \n    ], \n    \"variables\" : [ \n      { \n        \"id\" : 6, \n        \"name\" : \"5\" \n      }, \n      { \n        \"id\" : 4, \n        \"name\" : \"3\" \n      }, \n      { \n        \"id\" : 2, \n        \"name\" : \"name\" \n      }, \n      { \n        \"id\" : 1, \n        \"name\" : \"a\" \n      }, \n      { \n        \"id\" : 0, \n        \"name\" : \"p\" \n      } \n    ], \n    \"estimatedCost\" : 44, \n    \"estimatedNrItems\" : 1 \n  }, \n  \"warnings\" : [ ], \n  \"stats\" : { \n    \"rulesExecuted\" : 35, \n    \"rulesSkipped\" : 0, \n    \"plansCreated\" : 1 \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Using some options

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/explain <<EOF\n{ \n  \"query\" : \"FOR p IN products LET a = p.id FILTER a == 4 LET name = p.name SORT p.id LIMIT 1 RETURN name\", \n  \"options\" : { \n    \"maxNumberOfPlans\" : 2, \n    \"allPlans\" : true, \n    \"optimizer\" : { \n      \"rules\" : [ \n        \"-all\", \n        \"+use-index-for-sort\", \n        \"+use-index-range\" \n      ] \n    } \n  } \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"plans\" : [ \n    { \n      \"nodes\" : [ \n        { \n          \"type\" : \"SingletonNode\", \n          \"dependencies\" : [ ], \n          \"id\" : 1, \n          \"estimatedCost\" : 1, \n          \"estimatedNrItems\" : 1 \n        }, \n        { \n          \"type\" : \"IndexRangeNode\", \n          \"dependencies\" : [ \n            1 \n          ], \n          \"id\" : 11, \n          \"estimatedCost\" : 11, \n          \"estimatedNrItems\" : 10, \n          \"database\" : \"_system\", \n          \"collection\" : \"products\", \n          \"outVariable\" : { \n            \"id\" : 0, \n            \"name\" : \"p\" \n          }, \n          \"ranges\" : [ \n            [ ] \n          ], \n          \"index\" : { \n            \"type\" : \"skiplist\", \n            \"id\" : \"739563975\", \n            \"unique\" : false, \n            \"sparse\" : false, \n            \"fields\" : [ \n              \"id\" \n            ] \n          }, \n          \"reverse\" : false \n        }, \n        { \n          \"type\" : \"CalculationNode\", \n          \"dependencies\" : [ \n            11 \n          ], \n          \"id\" : 3, \n          \"estimatedCost\" : 21, \n          \"estimatedNrItems\" : 10, \n          \"expression\" : { \n            \"type\" : \"attribute access\", \n            \"name\" : \"id\", \n            \"subNodes\" : [ \n              { \n                \"type\" : \"reference\", \n                \"name\" : \"p\", \n                \"id\" : 0 \n              } \n            ] \n          }, \n          \"outVariable\" : { \n            \"id\" : 1, \n            \"name\" : \"a\" \n          }, \n          \"canThrow\" : false, \n          \"expressionType\" : \"attribute\" \n        }, \n        { \n          \"type\" : \"CalculationNode\", \n          \"dependencies\" : [ \n            3 \n          ], \n          \"id\" : 4, \n          \"estimatedCost\" : 31, \n          \"estimatedNrItems\" : 10, \n          \"expression\" : { \n            \"type\" : \"compare ==\", \n            \"subNodes\" : [ \n              { \n                \"type\" : \"reference\", \n                \"name\" : \"a\", \n                \"id\" : 1 \n              }, \n              { \n                \"type\" : \"value\", \n                \"value\" : 4 \n              } \n            ] \n          }, \n          \"outVariable\" : { \n            \"id\" : 4, \n            \"name\" : \"3\" \n          }, \n          \"canThrow\" : false, \n          \"expressionType\" : \"simple\" \n        }, \n        { \n          \"type\" : \"FilterNode\", \n          \"dependencies\" : [ \n            4 \n          ], \n          \"id\" : 5, \n          \"estimatedCost\" : 41, \n          \"estimatedNrItems\" : 10, \n          \"inVariable\" : { \n            \"id\" : 4, \n            \"name\" : \"3\" \n          } \n        }, \n        { \n          \"type\" : \"CalculationNode\", \n          \"dependencies\" : [ \n            5 \n          ], \n          \"id\" : 6, \n          \"estimatedCost\" : 51, \n          \"estimatedNrItems\" : 10, \n          \"expression\" : { \n            \"type\" : \"attribute access\", \n            \"name\" : \"name\", \n            \"subNodes\" : [ \n              { \n                \"type\" : \"reference\", \n                \"name\" : \"p\", \n                \"id\" : 0 \n              } \n            ] \n          }, \n          \"outVariable\" : { \n            \"id\" : 2, \n            \"name\" : \"name\" \n          }, \n          \"canThrow\" : false, \n          \"expressionType\" : \"attribute\" \n        }, \n        { \n          \"type\" : \"CalculationNode\", \n          \"dependencies\" : [ \n            6 \n          ], \n          \"id\" : 7, \n          \"estimatedCost\" : 61, \n          \"estimatedNrItems\" : 10, \n          \"expression\" : { \n            \"type\" : \"attribute access\", \n            \"name\" : \"id\", \n            \"subNodes\" : [ \n              { \n                \"type\" : \"reference\", \n                \"name\" : \"p\", \n                \"id\" : 0 \n              } \n            ] \n          }, \n          \"outVariable\" : { \n            \"id\" : 6, \n            \"name\" : \"5\" \n          }, \n          \"canThrow\" : false, \n          \"expressionType\" : \"attribute\" \n        }, \n        { \n          \"type\" : \"LimitNode\", \n          \"dependencies\" : [ \n            7 \n          ], \n          \"id\" : 9, \n          \"estimatedCost\" : 62, \n          \"estimatedNrItems\" : 1, \n          \"offset\" : 0, \n          \"limit\" : 1, \n          \"fullCount\" : false \n        }, \n        { \n          \"type\" : \"ReturnNode\", \n          \"dependencies\" : [ \n            9 \n          ], \n          \"id\" : 10, \n          \"estimatedCost\" : 63, \n          \"estimatedNrItems\" : 1, \n          \"inVariable\" : { \n            \"id\" : 2, \n            \"name\" : \"name\" \n          } \n        } \n      ], \n      \"rules\" : [ \n        \"use-index-for-sort\" \n      ], \n      \"collections\" : [ \n        { \n          \"name\" : \"products\", \n          \"type\" : \"read\" \n        } \n      ], \n      \"variables\" : [ \n        { \n          \"id\" : 6, \n          \"name\" : \"5\" \n        }, \n        { \n          \"id\" : 4, \n          \"name\" : \"3\" \n        }, \n        { \n          \"id\" : 2, \n          \"name\" : \"name\" \n        }, \n        { \n          \"id\" : 1, \n          \"name\" : \"a\" \n        }, \n        { \n          \"id\" : 0, \n          \"name\" : \"p\" \n        } \n      ], \n      \"estimatedCost\" : 63, \n      \"estimatedNrItems\" : 1 \n    } \n  ], \n  \"warnings\" : [ ], \n  \"stats\" : { \n    \"rulesExecuted\" : 4, \n    \"rulesSkipped\" : 31, \n    \"plansCreated\" : 1 \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Returning all plans

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/explain <<EOF\n{ \n  \"query\" : \"FOR p IN products FILTER p.id == 25 RETURN p\", \n  \"options\" : { \n    \"allPlans\" : true \n  } \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"plans\" : [ \n    { \n      \"nodes\" : [ \n        { \n          \"type\" : \"SingletonNode\", \n          \"dependencies\" : [ ], \n          \"id\" : 1, \n          \"estimatedCost\" : 1, \n          \"estimatedNrItems\" : 1 \n        }, \n        { \n          \"type\" : \"IndexRangeNode\", \n          \"dependencies\" : [ \n            1 \n          ], \n          \"id\" : 6, \n          \"estimatedCost\" : 1.9899995050000001, \n          \"estimatedNrItems\" : 1, \n          \"database\" : \"_system\", \n          \"collection\" : \"products\", \n          \"outVariable\" : { \n            \"id\" : 0, \n            \"name\" : \"p\" \n          }, \n          \"ranges\" : [ \n            [ \n              { \n                \"variable\" : \"p\", \n                \"attr\" : \"id\", \n                \"lowConst\" : { \n                  \"bound\" : 25, \n                  \"include\" : true, \n                  \"isConstant\" : true \n                }, \n                \"highConst\" : { \n                  \"bound\" : 25, \n                  \"include\" : true, \n                  \"isConstant\" : true \n                }, \n                \"lows\" : [ ], \n                \"highs\" : [ ], \n                \"valid\" : true, \n                \"equality\" : true \n              } \n            ] \n          ], \n          \"index\" : { \n            \"type\" : \"hash\", \n            \"id\" : \"736025031\", \n            \"unique\" : false, \n            \"sparse\" : false, \n            \"selectivityEstimate\" : 1, \n            \"fields\" : [ \n              \"id\" \n            ] \n          }, \n          \"reverse\" : false \n        }, \n        { \n          \"type\" : \"ReturnNode\", \n          \"dependencies\" : [ \n            6 \n          ], \n          \"id\" : 5, \n          \"estimatedCost\" : 2.989999505, \n          \"estimatedNrItems\" : 1, \n          \"inVariable\" : { \n            \"id\" : 0, \n            \"name\" : \"p\" \n          } \n        } \n      ], \n      \"rules\" : [ \n        \"use-index-range\", \n        \"remove-filter-covered-by-index\" \n      ], \n      \"collections\" : [ \n        { \n          \"name\" : \"products\", \n          \"type\" : \"read\" \n        } \n      ], \n      \"variables\" : [ \n        { \n          \"id\" : 2, \n          \"name\" : \"1\" \n        }, \n        { \n          \"id\" : 0, \n          \"name\" : \"p\" \n        } \n      ], \n      \"estimatedCost\" : 2.989999505, \n      \"estimatedNrItems\" : 1 \n    } \n  ], \n  \"warnings\" : [ ], \n  \"stats\" : { \n    \"rulesExecuted\" : 23, \n    \"rulesSkipped\" : 0, \n    \"plansCreated\" : 1 \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: A query that produces a warning

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/explain <<EOF\n{ \n  \"query\" : \"FOR i IN 1..10 RETURN 1 / 0\" \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"plan\" : { \n    \"nodes\" : [ \n      { \n        \"type\" : \"SingletonNode\", \n        \"dependencies\" : [ ], \n        \"id\" : 1, \n        \"estimatedCost\" : 1, \n        \"estimatedNrItems\" : 1 \n      }, \n      { \n        \"type\" : \"CalculationNode\", \n        \"dependencies\" : [ \n          1 \n        ], \n        \"id\" : 2, \n        \"estimatedCost\" : 2, \n        \"estimatedNrItems\" : 1, \n        \"expression\" : { \n          \"type\" : \"range\", \n          \"subNodes\" : [ \n            { \n              \"type\" : \"value\", \n              \"value\" : 1 \n            }, \n            { \n              \"type\" : \"value\", \n              \"value\" : 10 \n            } \n          ] \n        }, \n        \"outVariable\" : { \n          \"id\" : 2, \n          \"name\" : \"1\" \n        }, \n        \"canThrow\" : false, \n        \"expressionType\" : \"simple\" \n      }, \n      { \n        \"type\" : \"CalculationNode\", \n        \"dependencies\" : [ \n          2 \n        ], \n        \"id\" : 4, \n        \"estimatedCost\" : 3, \n        \"estimatedNrItems\" : 1, \n        \"expression\" : { \n          \"type\" : \"value\", \n          \"value\" : null \n        }, \n        \"outVariable\" : { \n          \"id\" : 4, \n          \"name\" : \"3\" \n        }, \n        \"canThrow\" : false, \n        \"expressionType\" : \"json\" \n      }, \n      { \n        \"type\" : \"EnumerateListNode\", \n        \"dependencies\" : [ \n          4 \n        ], \n        \"id\" : 3, \n        \"estimatedCost\" : 13, \n        \"estimatedNrItems\" : 10, \n        \"inVariable\" : { \n          \"id\" : 2, \n          \"name\" : \"1\" \n        }, \n        \"outVariable\" : { \n          \"id\" : 0, \n          \"name\" : \"i\" \n        } \n      }, \n      { \n        \"type\" : \"ReturnNode\", \n        \"dependencies\" : [ \n          3 \n        ], \n        \"id\" : 5, \n        \"estimatedCost\" : 23, \n        \"estimatedNrItems\" : 10, \n        \"inVariable\" : { \n          \"id\" : 4, \n          \"name\" : \"3\" \n        } \n      } \n    ], \n    \"rules\" : [ \n      \"move-calculations-up\", \n      \"move-calculations-up-2\" \n    ], \n    \"collections\" : [ ], \n    \"variables\" : [ \n      { \n        \"id\" : 4, \n        \"name\" : \"3\" \n      }, \n      { \n        \"id\" : 2, \n        \"name\" : \"1\" \n      }, \n      { \n        \"id\" : 0, \n        \"name\" : \"i\" \n      } \n    ], \n    \"estimatedCost\" : 23, \n    \"estimatedNrItems\" : 10 \n  }, \n  \"warnings\" : [ \n    { \n      \"code\" : 1562, \n      \"message\" : \"division by zero\" \n    } \n  ], \n  \"stats\" : { \n    \"rulesExecuted\" : 23, \n    \"rulesSkipped\" : 0, \n    \"plansCreated\" : 1 \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Invalid query (missing bind parameter)

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/explain <<EOF\n{ \n  \"query\" : \"FOR p IN products FILTER p.id == @id LIMIT 2 RETURN p.n\" \n}\nEOF\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 400, \n  \"errorNum\" : 1551, \n  \"errorMessage\" : \"no value specified for declared bind parameter 'id' (while parsing)\" \n}\n

\n
Example: The data returned in the plan attribute of the result contains one element per AQL top-level statement (i.e. FOR, RETURN, FILTER etc.). If the query optimizer removed some unnecessary statements, the result might also contain less elements than there were top-level statements in the AQL query. The following example shows a query with a non-sensible filter condition that the optimizer has removed so that there are less top-level statements.

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/explain <<EOF\n{ \"query\" : \"FOR i IN [ 1, 2, 3 ] FILTER 1 == 2 RETURN i\" }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"plan\" : { \n    \"nodes\" : [ \n      { \n        \"type\" : \"SingletonNode\", \n        \"dependencies\" : [ ], \n        \"id\" : 1, \n        \"estimatedCost\" : 1, \n        \"estimatedNrItems\" : 1 \n      }, \n      { \n        \"type\" : \"CalculationNode\", \n        \"dependencies\" : [ \n          1 \n        ], \n        \"id\" : 2, \n        \"estimatedCost\" : 2, \n        \"estimatedNrItems\" : 1, \n        \"expression\" : { \n          \"type\" : \"array\", \n          \"subNodes\" : [ \n            { \n              \"type\" : \"value\", \n              \"value\" : 1 \n            }, \n            { \n              \"type\" : \"value\", \n              \"value\" : 2 \n            }, \n            { \n              \"type\" : \"value\", \n              \"value\" : 3 \n            } \n          ] \n        }, \n        \"outVariable\" : { \n          \"id\" : 2, \n          \"name\" : \"1\" \n        }, \n        \"canThrow\" : false, \n        \"expressionType\" : \"json\" \n      }, \n      { \n        \"type\" : \"NoResultsNode\", \n        \"dependencies\" : [ \n          2 \n        ], \n        \"id\" : 7, \n        \"estimatedCost\" : 0.5, \n        \"estimatedNrItems\" : 0 \n      }, \n      { \n        \"type\" : \"EnumerateListNode\", \n        \"dependencies\" : [ \n          7 \n        ], \n        \"id\" : 3, \n        \"estimatedCost\" : 0.5, \n        \"estimatedNrItems\" : 0, \n        \"inVariable\" : { \n          \"id\" : 2, \n          \"name\" : \"1\" \n        }, \n        \"outVariable\" : { \n          \"id\" : 0, \n          \"name\" : \"i\" \n        } \n      }, \n      { \n        \"type\" : \"ReturnNode\", \n        \"dependencies\" : [ \n          3 \n        ], \n        \"id\" : 6, \n        \"estimatedCost\" : 0.5, \n        \"estimatedNrItems\" : 0, \n        \"inVariable\" : { \n          \"id\" : 0, \n          \"name\" : \"i\" \n        } \n      } \n    ], \n    \"rules\" : [ \n      \"move-calculations-up\", \n      \"move-filters-up\", \n      \"remove-unnecessary-filters\", \n      \"remove-unnecessary-calculations\" \n    ], \n    \"collections\" : [ ], \n    \"variables\" : [ \n      { \n        \"id\" : 4, \n        \"name\" : \"3\" \n      }, \n      { \n        \"id\" : 2, \n        \"name\" : \"1\" \n      }, \n      { \n        \"id\" : 0, \n        \"name\" : \"i\" \n      } \n    ], \n    \"estimatedCost\" : 0.5, \n    \"estimatedNrItems\" : 0 \n  }, \n  \"warnings\" : [ ], \n  \"stats\" : { \n    \"rulesExecuted\" : 23, \n    \"rulesSkipped\" : 0, \n    \"plansCreated\" : 1 \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_explain" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "If the query is valid, the server will respond with HTTP 200 and return the optimal execution plan in the plan attribute of the response. If option allPlans was set in the request, an array of plans will be returned in the allPlans attribute instead.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request, or if the query contains a parse error. The body of the response will contain the error details embedded in a JSON object. Omitting bind variables if the query references any will also result in an HTTP 400 error.
" + }, + "404": { + "description": "The server will respond with HTTP 404 in case a non-existing collection is accessed in the query.
" + } + }, + "summary": " Explain an AQL query", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + } + }, + "/_api/export": { + "post": { + "description": "**A json post document with these Properties is required:**
  • 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 so this option is turned off by default, and \"count\" is only returned when requested.
  • restrict: an object containing an array of attribute names that will be included or excluded when returning result documents.
    Not specifying restrict will by default return all attributes of each document.
    • fields: Contains an array of attribute names to include or exclude. Matching of attribute names for inclusion or exclusion will be done on the top level only. Specifying names of nested attributes is not supported at the moment.
      of type string
    • type: has to be be set to either include or exclude depending on which you want to use
  • 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.
  • flush: if set to true, a WAL flush operation will be executed prior to the export. The flush operation will start copying documents from the WAL to the collection's datafiles. There will be an additional wait time of up to flushWait seconds after the flush to allow the WAL collector to change the adjusted document meta-data to point into the datafiles, too. The default value is false (i.e. no flush) so most recently inserted or updated documents from the collection might be missing in the export.
  • flushWait: maximum wait time in seconds after a flush operation. The default value is 10. This option only has an effect when flush is set to true.
  • limit: an optional limit value, determining the maximum number of documents to be included in the cursor. Omitting the limit attribute or setting it to 0 will lead to no limit being used. If a limit is used, it is undefined which documents from the collection will be included in the export and which will be excluded. This is because there is no natural order of documents in a collection.
  • ttl: an optional time-to-live for the cursor (in seconds). The cursor will be removed on the server automatically after the specified amount of time. This is useful to ensure garbage collection of cursors that are not fully fetched by clients. If not set, a server-defined value will be used.
\n\nA call to this method creates a cursor containing all documents in the specified collection. In contrast to other data-producing APIs, the internal data structures produced by the export API are more lightweight, so it is the preferred way to retrieve all documents from a collection.
Documents are returned in a similar manner as in the `/_api/cursor` REST API. If all documents of the collection fit into the first batch, then no cursor will be created, and the result object's hasMore attribute will be set to false. If not all documents fit into the first batch, then the result object's hasMore attribute will be set to true, and the id attribute of the result will contain a cursor id.
The order in which the documents are returned is not specified.
By default, only those documents from the collection will be returned that are stored in the collection's datafiles. Documents that are present in the write-ahead log (WAL) at the time the export is run will not be exported.
To export these documents as well, the caller can issue a WAL flush request before calling the export API or set the flush attribute. Setting the flush option will trigger a WAL flush before the export so documents get copied from the WAL to the collection datafiles.
If the result set can be created by the server, the server will respond with HTTP 201. The body of the response will contain a JSON object with the result set.
The returned JSON object has the following properties:
  • 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 the collection was empty)
  • hasMore: a boolean indicator whether there are more results available for the cursor 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
Clients should always delete an export cursor result as early as possible because a lingering export cursor will prevent the underlying collection from being compacted or unloaded. By default, unused cursors will be deleted automatically after a server-defined idle time, and clients can adjust this idle time by setting the ttl value.
Note: this API is currently not supported on cluster coordinators.
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_export" + }, + "x-description-offset": 59 + }, + { + "description": "The name of the collection to export.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + } + ], + "responses": { + "201": { + "description": "is returned if the result set can be created by the server.
" + }, + "400": { + "description": "is returned if the JSON representation is malformed or the query specification is missing from the request.
" + }, + "404": { + "description": "The server will respond with HTTP 404 in case a non-existing collection is accessed in the query.
" + }, + "405": { + "description": "The server will respond with HTTP 405 if an unsupported HTTP method is used.
" + }, + "501": { + "description": "The server will respond with HTTP 501 if this API is called on a cluster coordinator.

" + } + }, + "summary": " Create export cursor", + "tags": [ + "Bulk" + ], + "x-examples": [], + "x-filename": "Bulk - arangod/RestHandler/RestExportHandler.cpp, arangod/RestHandler/RestImportHandler.cpp, arangod/RestHandler/RestBatchHandler.cpp" + } + }, + "/_api/gharial": { + "get": { + "description": "\n\nLists all graph names stored in this database.

Example:

shell> curl --dump - http://localhost:8529/_api/gharial\n\nHTTP/1.1 200 OK\ncontent-type: application/json\n\n{ \n  \"error\" : false, \n  \"code\" : 202, \n  \"graphs\" : [ \n    { \n      \"_id\" : \"_graphs/social\", \n      \"_key\" : \"social\", \n      \"_rev\" : \"557308359\", \n      \"edgeDefinitions\" : [ \n        { \n          \"collection\" : \"relation\", \n          \"from\" : [ \n            \"female\", \n            \"male\" \n          ], \n          \"to\" : [ \n            \"female\", \n            \"male\" \n          ] \n        } \n      ], \n      \"orphanCollections\" : [ ] \n    }, \n    { \n      \"_id\" : \"_graphs/routeplanner\", \n      \"_key\" : \"routeplanner\", \n      \"_rev\" : \"560650695\", \n      \"orphanCollections\" : [ ], \n      \"edgeDefinitions\" : [ \n        { \n          \"collection\" : \"germanHighway\", \n          \"from\" : [ \n            \"germanCity\" \n          ], \n          \"to\" : [ \n            \"germanCity\" \n          ] \n        }, \n        { \n          \"collection\" : \"frenchHighway\", \n          \"from\" : [ \n            \"frenchCity\" \n          ], \n          \"to\" : [ \n            \"frenchCity\" \n          ] \n        }, \n        { \n          \"collection\" : \"internationalHighway\", \n          \"from\" : [ \n            \"frenchCity\", \n            \"germanCity\" \n          ], \n          \"to\" : [ \n            \"frenchCity\", \n            \"germanCity\" \n          ] \n        } \n      ] \n    } \n  ] \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned if the module is available and the graphs could be listed.
" + } + }, + "summary": " List all graphs", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "post": { + "description": "\n\nThe creation of a graph requires the name of the graph and a definition of its edges. [See also edge definitions](../GeneralGraphs/Management.md#edge-definitions).
**A json post document with these Properties is required:**
  • orphanCollections: An array of additional vertex collections.
  • edgeDefinitions: An array of definitions for the edge
  • name: Name of the graph.

Example:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/gharial <<EOF\n{ \n  \"name\" : \"myGraph\", \n  \"edgeDefinitions\" : [ \n    { \n      \"collection\" : \"edges\", \n      \"from\" : [ \n        \"startVertices\" \n      ], \n      \"to\" : [ \n        \"endVertices\" \n      ] \n    } \n  ] \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json\netag: 527817159\n\n{ \n  \"error\" : false, \n  \"code\" : 201, \n  \"graph\" : { \n    \"name\" : \"myGraph\", \n    \"edgeDefinitions\" : [ \n      { \n        \"collection\" : \"edges\", \n        \"from\" : [ \n          \"startVertices\" \n        ], \n        \"to\" : [ \n          \"endVertices\" \n        ] \n      } \n    ], \n    \"orphanCollections\" : [ ], \n    \"_id\" : \"_graphs/myGraph\", \n    \"_rev\" : \"527817159\" \n  } \n}\n

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_general_graph_create_http_examples" + }, + "x-description-offset": 229 + } + ], + "responses": { + "201": { + "description": "Is returned if the graph could be created. The body contains the graph configuration that has been stored.
" + }, + "409": { + "description": "Returned if there is a conflict storing the graph. This can occur either if a graph with this name is already stored, or if there is one edge definition with a the same [edge collection](../Glossary/index.html#edge_collection) but a different signature used in any other graph.
" + } + }, + "summary": " Create a graph", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + } + }, + "/_api/gharial/{graph-name}": { + "delete": { + "description": "\n\nRemoves a graph from the collection \\_graphs.

Example:

shell> curl -X DELETE --dump - http://localhost:8529/_api/gharial/social\n\nHTTP/1.1 200 OK\ncontent-type: application/json\n\n{ \n  \"error\" : false, \n  \"code\" : 200, \n  \"removed\" : true \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Returned if the graph could be dropped.
" + }, + "404": { + "description": "Returned if no graph with this name could be found.
" + } + }, + "summary": " Drop a graph", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "get": { + "description": "\n\nGets a graph from the collection \\_graphs. Returns the definition content of this graph.

Example:

shell> curl --dump - http://localhost:8529/_api/gharial/myGraph\n\nHTTP/1.1 200 OK\ncontent-type: application/json\netag: 552131015\n\n{ \n  \"error\" : false, \n  \"code\" : 200, \n  \"graph\" : { \n    \"name\" : \"myGraph\", \n    \"edgeDefinitions\" : [ \n      { \n        \"collection\" : \"edges\", \n        \"from\" : [ \n          \"startVertices\" \n        ], \n        \"to\" : [ \n          \"endVertices\" \n        ] \n      } \n    ], \n    \"orphanCollections\" : [ ], \n    \"_id\" : \"_graphs/myGraph\", \n    \"_rev\" : \"552131015\" \n  } \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Returned if the graph could be found.
" + }, + "404": { + "description": "Returned if no graph with this name could be found.
" + } + }, + "summary": " Get a graph", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + } + }, + "/_api/gharial/{graph-name}/edge": { + "get": { + "description": "\n\nLists all edge collections within this graph.

Example:

shell> curl --dump - http://localhost:8529/_api/gharial/social/edge\n\nHTTP/1.1 200 OK\ncontent-type: application/json\n\n{ \n  \"error\" : false, \n  \"code\" : 200, \n  \"collections\" : [ \n    \"relation\" \n  ] \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned if the edge definitions could be listed.
" + }, + "404": { + "description": "Returned if no graph with this name could be found.
" + } + }, + "summary": " List edge definitions", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "post": { + "description": "\n\nAdds an additional edge definition to the graph. This edge definition has to contain a collection and an array of each from and to vertex collections. An edge definition can only be added if this definition is either not used in any other graph, or it is used with exactly the same definition. It is not possible to store a definition \"e\" from \"v1\" to \"v2\" in the one graph, and \"e\" from \"v2\" to \"v1\" in the other graph.
**A json post document with these Properties is required:**
  • to: One or many edge collections that can contain target vertices. of type string
  • from: One or many vertex collections that can contain source vertices. of type string
  • collection: The name of the edge collection to be used.

Example:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/gharial/social/edge <<EOF\n{ \n  \"collection\" : \"lives_in\", \n  \"from\" : [ \n    \"female\", \n    \"male\" \n  ], \n  \"to\" : [ \n    \"city\" \n  ] \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json\netag: 514972103\n\n{ \n  \"error\" : false, \n  \"code\" : 201, \n  \"graph\" : { \n    \"name\" : \"social\", \n    \"edgeDefinitions\" : [ \n      { \n        \"collection\" : \"relation\", \n        \"from\" : [ \n          \"female\", \n          \"male\" \n        ], \n        \"to\" : [ \n          \"female\", \n          \"male\" \n        ] \n      }, \n      { \n        \"collection\" : \"lives_in\", \n        \"from\" : [ \n          \"female\", \n          \"male\" \n        ], \n        \"to\" : [ \n          \"city\" \n        ] \n      } \n    ], \n    \"orphanCollections\" : [ ], \n    \"_id\" : \"_graphs/social\", \n    \"_rev\" : \"514972103\" \n  } \n}\n

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_general_graph_edge_definition_add_http_examples" + }, + "x-description-offset": 537 + } + ], + "responses": { + "200": { + "description": "Returned if the definition could be added successfully.
" + }, + "400": { + "description": "Returned if the defininition could not be added, the edge collection is used in an other graph with a different signature.
" + }, + "404": { + "description": "Returned if no graph with this name could be found.
" + } + }, + "summary": " Add edge definition", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + } + }, + "/_api/gharial/{graph-name}/edge/{collection-name}": { + "post": { + "description": "\n\nCreates a new edge in the collection. Within the body the has to contain a \\_from and \\_to value referencing to valid vertices in the graph. Furthermore the edge has to be valid in the definition of this [edge collection](../Glossary/index.html#edge_collection).
free style json body
Example:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/gharial/social/edge/relation <<EOF\n{ \n  \"type\" : \"friend\", \n  \"_from\" : \"female/alice\", \n  \"_to\" : \"female/diana\" \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json\netag: 513464775\n\n{ \n  \"error\" : false, \n  \"code\" : 202, \n  \"edge\" : { \n    \"_id\" : \"relation/513464775\", \n    \"_rev\" : \"513464775\", \n    \"_key\" : \"513464775\" \n  } \n}\n

\n
", + "parameters": [ + { + "description": "The body has to be the JSON object to be stored.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 303 + } + ], + "responses": { + "201": { + "description": "Returned if the edge could be created.
" + }, + "202": { + "description": "Returned if the request was successful but waitForSync is false.
" + }, + "404": { + "description": "Returned if no graph with this name, no edge collection or no edge with this id could be found.
" + } + }, + "summary": " Create an edge", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + } + }, + "/_api/gharial/{graph-name}/edge/{collection-name}/{edge-key}": { + "delete": { + "description": "\n\nRemoves an edge from the collection.

Example:

shell> curl -X DELETE --dump - http://localhost:8529/_api/gharial/social/edge/relation/aliceAndBob\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json\n\n{ \n  \"error\" : false, \n  \"code\" : 202, \n  \"removed\" : true \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Returned if the edge could be removed.
" + }, + "202": { + "description": "Returned if the request was successful but waitForSync is false.
" + }, + "404": { + "description": "Returned if no graph with this name, no edge collection or no edge with this id could be found.
" + }, + "412": { + "description": "Returned if if-match header is given, but the documents revision is different.
" + } + }, + "summary": " Remove an edge", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "get": { + "description": "\n\nGets an edge from the given collection.

Example:

shell> curl --dump - http://localhost:8529/_api/gharial/social/edge/relation/aliceAndBob\n\nHTTP/1.1 200 OK\ncontent-type: application/json\netag: 549837255\n\n{ \n  \"error\" : false, \n  \"code\" : 200, \n  \"edge\" : { \n    \"_id\" : \"relation/aliceAndBob\", \n    \"_key\" : \"aliceAndBob\", \n    \"_rev\" : \"549837255\", \n    \"_from\" : \"female/alice\", \n    \"_to\" : \"male/bob\", \n    \"type\" : \"married\" \n  } \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Returned if the edge could be found.
" + }, + "404": { + "description": "Returned if no graph with this name, no edge collection or no edge with this id could be found.
" + }, + "412": { + "description": "Returned if if-match header is given, but the documents revision is different.
" + } + }, + "summary": " Get an edge", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "patch": { + "description": "\n\nUpdates the data of the specific edge in the collection.
free style json body
Example:

shell> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/gharial/social/edge/relation/aliceAndBob <<EOF\n{ \n  \"since\" : \"01.01.2001\" \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json\netag: 580639175\n\n{ \n  \"error\" : false, \n  \"code\" : 202, \n  \"edge\" : { \n    \"_id\" : \"relation/aliceAndBob\", \n    \"_rev\" : \"580639175\", \n    \"_oldRev\" : \"579525063\", \n    \"_key\" : \"aliceAndBob\" \n  } \n}\n

\n
", + "parameters": [ + { + "description": "The body has to be a JSON object containing the attributes to be updated.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 63 + } + ], + "responses": { + "200": { + "description": "Returned if the edge could be updated.
" + }, + "202": { + "description": "Returned if the request was successful but waitForSync is false.
" + }, + "404": { + "description": "Returned if no graph with this name, no edge collection or no edge with this id could be found.
" + } + }, + "summary": " Modify an edge", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "put": { + "description": "\n\nReplaces the data of an edge in the collection.
free style json body
Example:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/gharial/social/edge/relation/aliceAndBob <<EOF\n{ \n  \"type\" : \"divorced\" \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json\netag: 584505799\n\n{ \n  \"error\" : false, \n  \"code\" : 202, \n  \"edge\" : { \n    \"_id\" : \"relation/aliceAndBob\", \n    \"_rev\" : \"584505799\", \n    \"_oldRev\" : \"583522759\", \n    \"_key\" : \"aliceAndBob\" \n  } \n}\n

\n
", + "parameters": [ + { + "description": "The body has to be the JSON object to be stored.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 54 + } + ], + "responses": { + "200": { + "description": "Returned if the edge could be replaced.
" + }, + "202": { + "description": "Returned if the request was successful but waitForSync is false.
" + }, + "404": { + "description": "Returned if no graph with this name, no edge collection or no edge with this id could be found.
" + }, + "412": { + "description": "Returned if if-match header is given, but the documents revision is different.
" + } + }, + "summary": " Replace an edge", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + } + }, + "/_api/gharial/{graph-name}/edge/{definition-name}": { + "delete": { + "description": "\n\nRemove one edge definition from the graph. This will only remove the edge collection, the vertex collections remain untouched and can still be used in your queries.

Example:

shell> curl -X DELETE --dump - http://localhost:8529/_api/gharial/social/edge/relation\n\nHTTP/1.1 200 OK\ncontent-type: application/json\netag: 544659911\n\n{ \n  \"error\" : false, \n  \"code\" : 200, \n  \"graph\" : { \n    \"name\" : \"social\", \n    \"edgeDefinitions\" : [ ], \n    \"orphanCollections\" : [ \n      \"female\", \n      \"male\" \n    ], \n    \"_id\" : \"_graphs/social\", \n    \"_rev\" : \"544659911\" \n  } \n}\n

\n

", + "parameters": [], + "responses": { + "200": { + "description": "Returned if the edge definition could be removed from the graph.
" + }, + "400": { + "description": "Returned if no edge definition with this name is found in the graph.
" + }, + "404": { + "description": "Returned if no graph with this name could be found.
" + } + }, + "summary": " Remove an edge definition from the graph", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "post": { + "description": "\n\nChange one specific edge definition. This will modify all occurrences of this definition in all graphs known to your database.
**A json post document with these Properties is required:**
  • to: One or many edge collections that can contain target vertices. of type string
  • from: One or many vertex collections that can contain source vertices. of type string
  • collection: The name of the edge collection to be used.

Example:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/gharial/social/edge/relation <<EOF\n{ \n  \"collection\" : \"relation\", \n  \"from\" : [ \n    \"female\", \n    \"male\", \n    \"animal\" \n  ], \n  \"to\" : [ \n    \"female\", \n    \"male\", \n    \"animal\" \n  ] \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json\netag: 593746375\n\n{ \n  \"error\" : false, \n  \"code\" : 200, \n  \"graph\" : { \n    \"name\" : \"social\", \n    \"edgeDefinitions\" : [ \n      { \n        \"collection\" : \"relation\", \n        \"from\" : [ \n          \"animal\", \n          \"female\", \n          \"male\" \n        ], \n        \"to\" : [ \n          \"animal\", \n          \"female\", \n          \"male\" \n        ] \n      } \n    ], \n    \"orphanCollections\" : [ ], \n    \"_id\" : \"_graphs/social\", \n    \"_rev\" : \"593746375\" \n  } \n}\n

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_general_graph_edge_definition_modify_http_examples" + }, + "x-description-offset": 192 + } + ], + "responses": { + "200": { + "description": "Returned if the edge definition could be replaced.
" + }, + "400": { + "description": "Returned if no edge definition with this name is found in the graph.
" + }, + "404": { + "description": "Returned if no graph with this name could be found.
" + } + }, + "summary": " Replace an edge definition", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + } + }, + "/_api/gharial/{graph-name}/vertex": { + "get": { + "description": "\n\nLists all vertex collections within this graph.

Example:

shell> curl --dump - http://localhost:8529/_api/gharial/social/vertex\n\nHTTP/1.1 200 OK\ncontent-type: application/json\n\n{ \n  \"error\" : false, \n  \"code\" : 200, \n  \"collections\" : [ \n    \"female\", \n    \"male\" \n  ] \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned if the collections could be listed.
" + }, + "404": { + "description": "Returned if no graph with this name could be found.
" + } + }, + "summary": " List vertex collections", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "post": { + "description": "\n\nAdds a vertex collection to the set of collections of the graph. If the collection does not exist, it will be created.

Example:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/gharial/social/vertex <<EOF\n{ \n  \"collection\" : \"otherVertices\" \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json\netag: 523426247\n\n{ \n  \"error\" : false, \n  \"code\" : 201, \n  \"graph\" : { \n    \"name\" : \"social\", \n    \"edgeDefinitions\" : [ \n      { \n        \"collection\" : \"relation\", \n        \"from\" : [ \n          \"female\", \n          \"male\" \n        ], \n        \"to\" : [ \n          \"female\", \n          \"male\" \n        ] \n      } \n    ], \n    \"orphanCollections\" : [ \n      \"otherVertices\" \n    ], \n    \"_id\" : \"_graphs/social\", \n    \"_rev\" : \"523426247\" \n  } \n}\n

\n
", + "parameters": [], + "responses": { + "201": { + "description": "Returned if the edge collection could be added successfully.
" + }, + "404": { + "description": "Returned if no graph with this name could be found.
" + } + }, + "summary": " Add vertex collection", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + } + }, + "/_api/gharial/{graph-name}/vertex/{collection-name}": { + "delete": { + "description": "\n\nRemoves a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph.

Example: /// You can remove vertex collections that are not used in any edge collection:

shell> curl -X DELETE --dump - http://localhost:8529/_api/gharial/social/vertex/otherVertices\n\nHTTP/1.1 200 OK\ncontent-type: application/json\netag: 588372423\n\n{ \n  \"error\" : false, \n  \"code\" : 200, \n  \"graph\" : { \n    \"name\" : \"social\", \n    \"edgeDefinitions\" : [ \n      { \n        \"collection\" : \"relation\", \n        \"from\" : [ \n          \"female\", \n          \"male\" \n        ], \n        \"to\" : [ \n          \"female\", \n          \"male\" \n        ] \n      } \n    ], \n    \"orphanCollections\" : [ ], \n    \"_id\" : \"_graphs/social\", \n    \"_rev\" : \"588372423\" \n  } \n}\n

\n
Example: You cannot remove vertex collections that are used in edge collections:

shell> curl -X DELETE --dump - http://localhost:8529/_api/gharial/social/vertex/male\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json\n\n{ \n  \"error\" : true, \n  \"code\" : 400, \n  \"errorNum\" : 1928, \n  \"errorMessage\" : \"not in orphan collection\" \n}\n

\n

", + "parameters": [], + "responses": { + "200": { + "description": "Returned if the vertex collection was removed from the graph successfully.
" + }, + "400": { + "description": "Returned if the vertex collection is still used in an edge definition. In this case it cannot be removed from the graph yet, it has to be removed from the edge definition first.
" + }, + "404": { + "description": "Returned if no graph with this name could be found.
" + } + }, + "summary": " Remove vertex collection", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "post": { + "description": "\n\nAdds a vertex to the given collection.
free style json body
Example:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/gharial/social/vertex/male <<EOF\n{ \n  \"name\" : \"Francis\" \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json\netag: 521918919\n\n{ \n  \"error\" : false, \n  \"code\" : 202, \n  \"vertex\" : { \n    \"_id\" : \"male/521918919\", \n    \"_rev\" : \"521918919\", \n    \"_key\" : \"521918919\" \n  } \n}\n

\n
", + "parameters": [ + { + "description": "The body has to be the JSON object to be stored.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 45 + } + ], + "responses": { + "201": { + "description": "Returned if the vertex could be added and waitForSync is true.
" + }, + "202": { + "description": "Returned if the request was successful but waitForSync is false.
" + }, + "404": { + "description": "Returned if no graph or no vertex collection with this name could be found.
" + } + }, + "summary": " Create a vertex", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + } + }, + "/_api/gharial/{graph-name}/vertex/{collection-name}/{vertex-key}": { + "delete": { + "description": "\n\nRemoves a vertex from the collection.

Example:

shell> curl -X DELETE --dump - http://localhost:8529/_api/gharial/social/vertex/female/alice\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json\n\n{ \n  \"error\" : false, \n  \"code\" : 202, \n  \"removed\" : true \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Returned if the vertex could be removed.
" + }, + "202": { + "description": "Returned if the request was successful but waitForSync is false.
" + }, + "404": { + "description": "Returned if no graph with this name, no vertex collection or no vertex with this id could be found.
" + }, + "412": { + "description": "Returned if if-match header is given, but the documents revision is different.
" + } + }, + "summary": " Remove a vertex", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "get": { + "description": "\n\nGets a vertex from the given collection.

Example:

shell> curl --dump - http://localhost:8529/_api/gharial/social/vertex/female/alice\n\nHTTP/1.1 200 OK\ncontent-type: application/json\netag: 553966023\n\n{ \n  \"error\" : false, \n  \"code\" : 200, \n  \"vertex\" : { \n    \"_id\" : \"female/alice\", \n    \"_key\" : \"alice\", \n    \"_rev\" : \"553966023\", \n    \"name\" : \"Alice\" \n  } \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "Returned if the vertex could be found.
" + }, + "404": { + "description": "Returned if no graph with this name, no vertex collection or no vertex with this id could be found.
" + }, + "412": { + "description": "Returned if if-match header is given, but the documents revision is different.
" + } + }, + "summary": " Get a vertex", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "patch": { + "description": "\n\nUpdates the data of the specific vertex in the collection.
free style json body
Example:

shell> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/gharial/social/vertex/female/alice <<EOF\n{ \n  \"age\" : 26 \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json\netag: 576641479\n\n{ \n  \"error\" : false, \n  \"code\" : 202, \n  \"vertex\" : { \n    \"_id\" : \"female/alice\", \n    \"_rev\" : \"576641479\", \n    \"_oldRev\" : \"574478791\", \n    \"_key\" : \"alice\" \n  } \n}\n

\n
", + "parameters": [ + { + "description": "The body has to contain a JSON object containing exactly the attributes that should be replaced.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 65 + } + ], + "responses": { + "200": { + "description": "Returned if the vertex could be updated.
" + }, + "202": { + "description": "Returned if the request was successful but waitForSync is false.
" + }, + "404": { + "description": "Returned if no graph with this name, no vertex collection or no vertex with this id could be found.
" + }, + "412": { + "description": "Returned if if-match header is given, but the documents revision is different.
" + } + }, + "summary": " Modify a vertex", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + }, + "put": { + "description": "\n\nReplaces the data of a vertex in the collection.
free style json body
Example:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/gharial/social/vertex/female/alice <<EOF\n{ \n  \"name\" : \"Alice Cooper\", \n  \"age\" : 26 \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json\netag: 600496583\n\n{ \n  \"error\" : false, \n  \"code\" : 202, \n  \"vertex\" : { \n    \"_id\" : \"female/alice\", \n    \"_rev\" : \"600496583\", \n    \"_oldRev\" : \"598333895\", \n    \"_key\" : \"alice\" \n  } \n}\n

\n
", + "parameters": [ + { + "description": "The body has to be the JSON object to be stored.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 55 + } + ], + "responses": { + "200": { + "description": "Returned if the vertex could be replaced.
" + }, + "202": { + "description": "Returned if the request was successful but waitForSync is false.
" + }, + "404": { + "description": "Returned if no graph with this name, no vertex collection or no vertex with this id could be found.
" + }, + "412": { + "description": "Returned if if-match header is given, but the documents revision is different.
" + } + }, + "summary": " Replace a vertex", + "tags": [ + "Graph" + ], + "x-examples": [], + "x-filename": "Graph - js/apps/system/_api/gharial/APP/gharial.js" + } + }, + "/_api/import#document": { + "post": { + "description": "free style json body\n\nNOTE Swagger examples won't work due to the anchor.

Creates documents in the collection identified by `collection-name`. The first line of the request body must contain a JSON-encoded array of attribute names. All following lines in the request body must contain JSON-encoded arrays of attribute values. Each line is interpreted as a separate document, and the values specified will be mapped to the array of attribute names specified in the first header line.
The response is a JSON object with the following attributes:
  • `created`: number of documents imported.
  • `errors`: number of documents that were not imported due to an error.
  • `empty`: number of empty lines found in the input (will only contain a value greater zero for types `documents` or `auto`).
  • `updated`: number of updated/replaced documents (in case `onDuplicate` was set to either `update` or `replace`).
  • `ignored`: number of failed but ignored insert operations (in case `onDuplicate` was set to `ignore`).
  • `details`: if URL parameter `details` is set to true, the result will contain a `details` attribute which is an array with more detailed information about which documents could not be inserted.
Note: this API is currently not supported on cluster coordinators.

Example: Importing two documents, with attributes `_key`, `value1` and `value2` each. One line in the import data is empty

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products <<EOF\n[ \"_key\", \"value1\", \"value2\" ]\n[ \"abc\", 25, \"test\" ]\n\n[ \"foo\", \"bar\", \"baz\" ]\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 2, \n  \"errors\" : 0, \n  \"empty\" : 1, \n  \"updated\" : 0, \n  \"ignored\" : 0 \n}\n

\n
Example: Importing two documents into a new collection

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&createCollection=true <<EOF\n[ \"value1\", \"value2\" ]\n[ 1234, null ]\n[ \"foo\", \"bar\" ]\n[ 534.55, true ]\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 3, \n  \"errors\" : 0, \n  \"empty\" : 0, \n  \"updated\" : 0, \n  \"ignored\" : 0 \n}\n

\n
Example: Importing into an edge collection, with attributes `_from`, `_to` and `name`

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=links <<EOF\n[ \"_from\", \"_to\", \"name\" ]\n[ \"products/123\", \"products/234\", \"some name\" ]\n[ \"products/332\", \"products/abc\", \"other name\" ]\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 2, \n  \"errors\" : 0, \n  \"empty\" : 0, \n  \"updated\" : 0, \n  \"ignored\" : 0 \n}\n

\n
Example: Importing into an edge collection, omitting `_from` or `_to`

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=links&details=true <<EOF\n[ \"name\" ]\n[ \"some name\" ]\n[ \"other name\" ]\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 0, \n  \"errors\" : 2, \n  \"empty\" : 0, \n  \"updated\" : 0, \n  \"ignored\" : 0, \n  \"details\" : [ \n    \"at position 1: missing '_from' or '_to' attribute, offending document: {\\\"name\\\":\\\"some name\\\"}\", \n    \"at position 2: missing '_from' or '_to' attribute, offending document: {\\\"name\\\":\\\"other name\\\"}\" \n  ] \n}\n

\n
Example: Violating a unique constraint, but allow partial imports

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&details=true <<EOF\n[ \"_key\", \"value1\", \"value2\" ]\n[ \"abc\", 25, \"test\" ]\n[ \"abc\", \"bar\", \"baz\" ]\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 1, \n  \"errors\" : 1, \n  \"empty\" : 0, \n  \"updated\" : 0, \n  \"ignored\" : 0, \n  \"details\" : [ \n    \"at position 2: creating document failed with error 'unique constraint violated', offending document: {\\\"_key\\\":\\\"abc\\\",\\\"value1\\\":\\\"bar\\\",\\\"value2\\\":\\\"baz\\\"}\" \n  ] \n}\n

\n
Example: Violating a unique constraint, not allowing partial imports

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&complete=true <<EOF\n[ \"_key\", \"value1\", \"value2\" ]\n[ \"abc\", 25, \"test\" ]\n[ \"abc\", \"bar\", \"baz\" ]\nEOF\n\nHTTP/1.1 409 Conflict\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"cannot create document, unique constraint violated\", \n  \"code\" : 409, \n  \"errorNum\" : 1210 \n}\n

\n
Example: Using a non-existing collection

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products <<EOF\n[ \"_key\", \"value1\", \"value2\" ]\n[ \"abc\", 25, \"test\" ]\n[ \"foo\", \"bar\", \"baz\" ]\nEOF\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"collection 'products' not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1203 \n}\n

\n
Example: Using a malformed body

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products <<EOF\n{ \"_key\": \"foo\", \"value1\": \"bar\" }\nEOF\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"no JSON array found in second line\", \n  \"code\" : 400, \n  \"errorNum\" : 400 \n}\n

\n
", + "parameters": [ + { + "description": "The body must consist of JSON-encoded arrays of attribute values, with one line per document. The first row of the request must be a JSON-encoded array of attribute names. These attribute names are used for the data in the subsequent lines.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + }, + { + "description": "The collection name.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + }, + { + "description": "If this parameter has a value of `true` or `yes`, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed.
", + "in": "query", + "name": "createCollection", + "required": false, + "type": "boolean" + }, + { + "description": "If this parameter has a value of `true` or `yes`, then all data in the collection will be removed prior to the import. Note that any existing index definitions will be preseved.
", + "in": "query", + "name": "overwrite", + "required": false, + "type": "boolean" + }, + { + "description": "Wait until documents have been synced to disk before returning.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + }, + { + "description": "Controls what action is carried out in case of a unique key constraint violation. Possible values are:
  • error: this will not import the current document because of the unique key constraint violation. This is the default setting.
  • update: this will update an existing document in the database with the data specified in the request. Attributes of the existing document that are not present in the request will be preseved.
  • replace: this will replace an existing document in the database with the data specified in the request.
  • ignore: this will not update an existing document and simply ignore the error caused by the unique key constraint violation.
Note that update, replace and ignore will only work when the import document in the request contains the _key attribute. update and replace may also fail because of secondary unique key constraint violations.
", + "in": "query", + "name": "onDuplicate", + "required": false, + "type": "string" + }, + { + "description": "If set to `true` or `yes`, it will make the whole import fail if any error occurs. Otherwise the import will continue even if some documents cannot be imported.
", + "in": "query", + "name": "complete", + "required": false, + "type": "boolean" + }, + { + "description": "If set to `true` or `yes`, the result will include an attribute `details` with details about documents that could not be imported.
", + "in": "query", + "name": "details", + "required": false, + "type": "boolean" + } + ], + "responses": { + "201": { + "description": "is returned if all documents could be imported successfully.
" + }, + "400": { + "description": "is returned if `type` contains an invalid value, no `collection` is specified, the documents are incorrectly encoded, or the request is malformed.
" + }, + "404": { + "description": "is returned if `collection` or the `_from` or `_to` attributes of an imported edge refer to an unknown collection.
" + }, + "409": { + "description": "is returned if the import would trigger a unique key violation and `complete` is set to `true`.
" + }, + "500": { + "description": "is returned if the server cannot auto-generate a document key (out of keys error) for a document with no user-defined key.
" + }, + "501": { + "description": "The server will respond with HTTP 501 if this API is called on a cluster coordinator.
" + } + }, + "summary": "imports document values", + "tags": [ + "Bulk" + ], + "x-examples": [], + "x-filename": "Bulk - arangod/RestHandler/RestExportHandler.cpp, arangod/RestHandler/RestImportHandler.cpp, arangod/RestHandler/RestBatchHandler.cpp" + } + }, + "/_api/import#json": { + "post": { + "description": "free style json body\n\nNOTE Swagger examples won't work due to the anchor.

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. The request body can either consist of multiple lines, with each line being a single stand-alone JSON object, or a singe JSON array with sub-objects.
The response is a JSON object with the following attributes:
  • `created`: number of documents imported.
  • `errors`: number of documents that were not imported due to an error.
  • `empty`: number of empty lines found in the input (will only contain a value greater zero for types `documents` or `auto`).
  • `updated`: number of updated/replaced documents (in case `onDuplicate` was set to either `update` or `replace`).
  • `ignored`: number of failed but ignored insert operations (in case `onDuplicate` was set to `ignore`).
  • `details`: if URL parameter `details` is set to true, the result will contain a `details` attribute which is an array with more detailed information about which documents could not be inserted.
Note: this API is currently not supported on cluster coordinators.

Example: Importing documents with heterogenous attributes from a JSON array

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=list <<EOF\n[ \n  { \n    \"_key\" : \"abc\", \n    \"value1\" : 25, \n    \"value2\" : \"test\", \n    \"allowed\" : true \n  }, \n  { \n    \"_key\" : \"foo\", \n    \"name\" : \"baz\" \n  }, \n  { \n    \"name\" : { \n      \"detailed\" : \"detailed name\", \n      \"short\" : \"short name\" \n    } \n  } \n]\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 3, \n  \"errors\" : 0, \n  \"empty\" : 0, \n  \"updated\" : 0, \n  \"ignored\" : 0 \n}\n

\n
Example: Importing documents from individual JSON lines

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=documents <<EOF\n{ \"_key\": \"abc\", \"value1\": 25, \"value2\": \"test\", \"allowed\": true }\n{ \"_key\": \"foo\", \"name\": \"baz\" }\n\n{ \"name\": { \"detailed\": \"detailed name\", \"short\": \"short name\" } }\n\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 3, \n  \"errors\" : 0, \n  \"empty\" : 1, \n  \"updated\" : 0, \n  \"ignored\" : 0 \n}\n

\n
Example: Using the auto type detection

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=auto <<EOF\n[ \n  { \n    \"_key\" : \"abc\", \n    \"value1\" : 25, \n    \"value2\" : \"test\", \n    \"allowed\" : true \n  }, \n  { \n    \"_key\" : \"foo\", \n    \"name\" : \"baz\" \n  }, \n  { \n    \"name\" : { \n      \"detailed\" : \"detailed name\", \n      \"short\" : \"short name\" \n    } \n  } \n]\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 3, \n  \"errors\" : 0, \n  \"empty\" : 0, \n  \"updated\" : 0, \n  \"ignored\" : 0 \n}\n

\n
Example: Importing documents into a new collection from a JSON array

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&createCollection=true&type=list <<EOF\n[ \n  { \n    \"id\" : \"12553\", \n    \"active\" : true \n  }, \n  { \n    \"id\" : \"4433\", \n    \"active\" : false \n  }, \n  { \n    \"id\" : \"55932\", \n    \"count\" : 4334 \n  } \n]\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 3, \n  \"errors\" : 0, \n  \"empty\" : 0, \n  \"updated\" : 0, \n  \"ignored\" : 0 \n}\n

\n
Example: Importing into an edge collection, with attributes `_from`, `_to` and `name`

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=links&type=documents <<EOF\n{ \"_from\": \"products/123\", \"_to\": \"products/234\" }\n{ \"_from\": \"products/332\", \"_to\": \"products/abc\", \"name\": \"other name\" }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 2, \n  \"errors\" : 0, \n  \"empty\" : 0, \n  \"updated\" : 0, \n  \"ignored\" : 0 \n}\n

\n
Example: Importing into an edge collection, omitting `_from` or `_to`

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=links&type=list&details=true <<EOF\n[ \n  { \n    \"name\" : \"some name\" \n  } \n]\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 0, \n  \"errors\" : 1, \n  \"empty\" : 0, \n  \"updated\" : 0, \n  \"ignored\" : 0, \n  \"details\" : [ \n    \"at position 1: missing '_from' or '_to' attribute, offending document: {\\\"name\\\":\\\"some name\\\"}\" \n  ] \n}\n

\n
Example: Violating a unique constraint, but allow partial imports

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=documents&details=true <<EOF\n{ \"_key\": \"abc\", \"value1\": 25, \"value2\": \"test\" }\n{ \"_key\": \"abc\", \"value1\": \"bar\", \"value2\": \"baz\" }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"created\" : 1, \n  \"errors\" : 1, \n  \"empty\" : 0, \n  \"updated\" : 0, \n  \"ignored\" : 0, \n  \"details\" : [ \n    \"at position 2: creating document failed with error 'unique constraint violated', offending document: {\\\"_key\\\":\\\"abc\\\",\\\"value1\\\":\\\"bar\\\",\\\"value2\\\":\\\"baz\\\"}\" \n  ] \n}\n

\n
Example: Violating a unique constraint, not allowing partial imports

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=documents&complete=true <<EOF\n{ \"_key\": \"abc\", \"value1\": 25, \"value2\": \"test\" }\n{ \"_key\": \"abc\", \"value1\": \"bar\", \"value2\": \"baz\" }\nEOF\n\nHTTP/1.1 409 Conflict\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"cannot create document, unique constraint violated\", \n  \"code\" : 409, \n  \"errorNum\" : 1210 \n}\n

\n
Example: Using a non-existing collection

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=documents <<EOF\n{ \"name\": \"test\" }\nEOF\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"collection 'products' not found\", \n  \"code\" : 404, \n  \"errorNum\" : 1203 \n}\n

\n
Example: Using a malformed body

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/import?collection=products&type=list <<EOF\n{ }\nEOF\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"errorMessage\" : \"expecting a JSON array in the request\", \n  \"code\" : 400, \n  \"errorNum\" : 400 \n}\n

\n
", + "parameters": [ + { + "description": "The body must either be a JSON-encoded array of objects or a string with multiple JSON objects separated by newlines.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + }, + { + "description": "Determines how the body of the request will be interpreted. `type` can have the following values:
  • `documents`: when this type is used, each line in the request body is expected to be an individual JSON-encoded document. Multiple JSON objects in the request body need to be separated by newlines.
  • `list`: when this type is used, the request body must contain a single JSON-encoded array of individual objects to import.
  • `auto`: if set, this will automatically determine the body type (either `documents` or `list`).
", + "in": "query", + "name": "type", + "required": true, + "type": "string" + }, + { + "description": "The collection name.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + }, + { + "description": "If this parameter has a value of `true` or `yes`, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed.
", + "in": "query", + "name": "createCollection", + "required": false, + "type": "boolean" + }, + { + "description": "If this parameter has a value of `true` or `yes`, then all data in the collection will be removed prior to the import. Note that any existing index definitions will be preseved.
", + "in": "query", + "name": "overwrite", + "required": false, + "type": "boolean" + }, + { + "description": "Wait until documents have been synced to disk before returning.
", + "in": "query", + "name": "waitForSync", + "required": false, + "type": "boolean" + }, + { + "description": "Controls what action is carried out in case of a unique key constraint violation. Possible values are:
  • error: this will not import the current document because of the unique key constraint violation. This is the default setting.
  • update: this will update an existing document in the database with the data specified in the request. Attributes of the existing document that are not present in the request will be preseved.
  • replace: this will replace an existing document in the database with the data specified in the request.
  • ignore: this will not update an existing document and simply ignore the error caused by a unique key constraint violation.
Note that that update, replace and ignore will only work when the import document in the request contains the _key attribute. update and replace may also fail because of secondary unique key constraint violations.
", + "in": "query", + "name": "onDuplicate", + "required": false, + "type": "string" + }, + { + "description": "If set to `true` or `yes`, it will make the whole import fail if any error occurs. Otherwise the import will continue even if some documents cannot be imported.
", + "in": "query", + "name": "complete", + "required": false, + "type": "boolean" + }, + { + "description": "If set to `true` or `yes`, the result will include an attribute `details` with details about documents that could not be imported.
", + "in": "query", + "name": "details", + "required": false, + "type": "boolean" + } + ], + "responses": { + "201": { + "description": "is returned if all documents could be imported successfully.
" + }, + "400": { + "description": "is returned if `type` contains an invalid value, no `collection` is specified, the documents are incorrectly encoded, or the request is malformed.
" + }, + "404": { + "description": "is returned if `collection` or the `_from` or `_to` attributes of an imported edge refer to an unknown collection.
" + }, + "409": { + "description": "is returned if the import would trigger a unique key violation and `complete` is set to `true`.
" + }, + "500": { + "description": "is returned if the server cannot auto-generate a document key (out of keys error) for a document with no user-defined key.
" + }, + "501": { + "description": "The server will respond with HTTP 501 if this API is called on a cluster coordinator.
" + } + }, + "summary": "imports documents from JSON", + "tags": [ + "Bulk" + ], + "x-examples": [], + "x-filename": "Bulk - arangod/RestHandler/RestExportHandler.cpp, arangod/RestHandler/RestImportHandler.cpp, arangod/RestHandler/RestBatchHandler.cpp" + } + }, + "/_api/index": { + "get": { + "description": "\n\n
Returns an object with an attribute indexes containing an array of all index descriptions for the given collection. The same information is also available in the identifiers as an object with the index handles as keys.

Example: Return information about all indexes

shell> curl --dump - http://localhost:8529/_api/index?collection=products\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"indexes\" : [ \n    { \n      \"id\" : \"products/0\", \n      \"type\" : \"primary\", \n      \"fields\" : [ \n        \"_key\" \n      ], \n      \"selectivityEstimate\" : 1, \n      \"unique\" : true, \n      \"sparse\" : false \n    }, \n    { \n      \"id\" : \"products/758438343\", \n      \"type\" : \"hash\", \n      \"fields\" : [ \n        \"name\" \n      ], \n      \"selectivityEstimate\" : 1, \n      \"unique\" : false, \n      \"sparse\" : false \n    }, \n    { \n      \"id\" : \"products/758700487\", \n      \"type\" : \"skiplist\", \n      \"fields\" : [ \n        \"price\" \n      ], \n      \"unique\" : false, \n      \"sparse\" : true \n    } \n  ], \n  \"identifiers\" : { \n    \"products/0\" : { \n      \"id\" : \"products/0\", \n      \"type\" : \"primary\", \n      \"fields\" : [ \n        \"_key\" \n      ], \n      \"selectivityEstimate\" : 1, \n      \"unique\" : true, \n      \"sparse\" : false \n    }, \n    \"products/758438343\" : { \n      \"id\" : \"products/758438343\", \n      \"type\" : \"hash\", \n      \"fields\" : [ \n        \"name\" \n      ], \n      \"selectivityEstimate\" : 1, \n      \"unique\" : false, \n      \"sparse\" : false \n    }, \n    \"products/758700487\" : { \n      \"id\" : \"products/758700487\", \n      \"type\" : \"skiplist\", \n      \"fields\" : [ \n        \"price\" \n      ], \n      \"unique\" : false, \n      \"sparse\" : true \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [ + { + "description": "The collection name.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "returns a json object containing a list of indexes on that collection.
" + } + }, + "summary": " Read all indexes of a collection", + "tags": [ + "Indexes" + ], + "x-examples": [], + "x-filename": "Indexes - js/actions/api-index.js" + }, + "post": { + "description": "**A json post document with these Properties is required:**
  • fields: an array of attribute paths. of type string
  • unique: if true, then create a unique index.
  • type: must be equal to \"skiplist\".
  • sparse: if true, then create a sparse index.
\n\n
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.
In a sparse index all documents will be excluded from the index that do not contain at least one of the specified index attributes (i.e. fields) or that have a value of null in any of the specified index attributes. Such documents will not be indexed, and not be taken into account for uniqueness checks if the unique flag is set.
In a non-sparse index, these documents will be indexed (for non-present indexed attributes, a value of null will be used) and will be taken into account for uniqueness checks if the unique flag is set.
Note: unique indexes on non-shard keys are not supported in a cluster.

Example: Creating a skiplist index

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

\n
Example: Creating a sparse skiplist index

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

\n
", + "parameters": [ + { + "description": "The collection name.

", + "in": "query", + "name": "collection-name", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_index_skiplist" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "If the index already exists, then a HTTP 200 is returned.
" + }, + "201": { + "description": "If the index does not already exist and could be created, then a HTTP 201 is returned.
" + }, + "400": { + "description": "If the collection already contains documents and you try to create a unique skip-list index in such a way that there are documents violating the uniqueness, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Create skip list", + "tags": [ + "Indexes" + ], + "x-examples": [], + "x-filename": "Indexes - js/actions/api-index.js" + } + }, + "/_api/index#CapConstraints": { + "post": { + "description": "**A json post document with these Properties is required:**
  • byteSize: The maximal size of the active document data in the collection (in bytes). If specified, the value must be at least 16384.

  • type: must be equal to \"cap\".
  • size: The maximal number of documents for the collection. If specified, the value must be greater than zero.
\n\nNOTE Swagger examples won't work due to the anchor.


Creates a cap constraint for the collection collection-name, if it does not already exist. Expects an object containing the index details.
Note: 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.

Example: Creating a cap constraint

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

\n
", + "parameters": [ + { + "description": "The collection name.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_index_cap" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "If the index already exists, then an HTTP 200 is returned.
" + }, + "201": { + "description": "If the index does not already exist and could be created, then an HTTP 201 is returned.
" + }, + "400": { + "description": "If either size or byteSize contain invalid values, then an HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Create cap constraint", + "tags": [ + "Indexes" + ], + "x-examples": [], + "x-filename": "Indexes - js/actions/api-index.js" + } + }, + "/_api/index#fulltext": { + "post": { + "description": "**A json post document with these Properties is required:**
  • fields: an array of attribute names. Currently, the array is limited to exactly one attribute. of type string
  • type: must be equal to \"fulltext\".
  • 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.
\n\nNOTE Swagger examples won't work due to the anchor.

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

Example: Creating a fulltext index

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

\n
", + "parameters": [ + { + "description": "The collection name.
", + "in": "query", + "name": "collection-name", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_index_fulltext" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "If the index already exists, then a HTTP 200 is returned.
" + }, + "201": { + "description": "If the index does not already exist and could be created, then a HTTP 201 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Create fulltext index", + "tags": [ + "Indexes" + ], + "x-examples": [], + "x-filename": "Indexes - js/actions/api-index.js" + } + }, + "/_api/index#general": { + "post": { + "description": "free style json body\n\nNOTE Swagger examples won't work due to the anchor.

Creates a new index in the collection collection. Expects an object containing the index details.
The type of the index to be created must specified in the type attribute of the index details. Depending on the index type, additional other attributes may need to specified in the request in order to create the index.
Most indexes (a notable exception being the cap constraint) require the array of attributes to be indexed in the fields attribute of the index details. Depending on the index type, a single attribute or multiple attributes can be indexed.
Indexing system attributes such as _id, _key, _from, and _to is not supported for user-defined indexes. Manually creating an index using any of these attributes will fail with an error.
Some indexes can be created as unique or non-unique variants. Uniqueness can be controlled for most indexes by specifying the unique flag in the index details. Setting it to true will create a unique index. Setting it to false or omitting the unique attribute will create a non-unique index.
Note: The following index types do not support uniqueness, and using the unique attribute with these types may lead to an error:
  • cap constraints
  • fulltext indexes
Note: Unique indexes on non-shard keys are not supported in a cluster.
Hash and skiplist indexes can optionally be created in a sparse variant. A sparse index will be created if the sparse attribute in the index details is set to true. Sparse indexes do not index documents for which any of the index attributes is either not set or is null.
", + "parameters": [ + { + "description": "The collection name.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + }, + { + "description": "
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + } + ], + "responses": { + "200": { + "description": "If the index already exists, then an HTTP 200 is returned.
" + }, + "201": { + "description": "If the index does not already exist and could be created, then an HTTP 201 is returned.
" + }, + "400": { + "description": "If an invalid index description is posted or attributes are used that the target index will not support, then an HTTP 400 is returned.
" + }, + "404": { + "description": "If collection is unknown, then an HTTP 404 is returned.
" + } + }, + "summary": " Create index", + "tags": [ + "Indexes" + ], + "x-examples": [], + "x-filename": "Indexes - js/actions/api-index.js" + } + }, + "/_api/index#geo": { + "post": { + "description": "**A json post document with these Properties is required:**
  • fields: An array with one or two attribute paths.
    If it is an array 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 an array with at least two double values. The array 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 an array 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. of type string
  • type: must be equal to \"geo\".
  • geoJson: If a geo-spatial index on a location is constructed and geoJson is true, then the order within the array is longitude followed by latitude. This corresponds to the format described in http://geojson.org/geojson-spec.html#positions
\n\nNOTE Swagger examples won't work due to the anchor.

Creates a geo-spatial index in the collection collection-name, if it does not already exist. Expects an object containing the index details.
Geo indexes are always sparse, meaning that documents that do not contain the index attributes or have non-numeric values in the index attributes will not be indexed.

Example: Creating a geo index with a location attribute

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

\n
Example: Creating a geo index with latitude and longitude attributes

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

\n
", + "parameters": [ + { + "description": "The collection name.

", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_index_geo" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "If the index already exists, then a HTTP 200 is returned.
" + }, + "201": { + "description": "If the index does not already exist and could be created, then a HTTP 201 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Create geo-spatial index", + "tags": [ + "Indexes" + ], + "x-examples": [], + "x-filename": "Indexes - js/actions/api-index.js" + } + }, + "/_api/index#hash": { + "post": { + "description": "**A json post document with these Properties is required:**
  • fields: an array of attribute paths. of type string
  • unique: if true, then create a unique index.
  • type: must be equal to \"hash\".
  • sparse: if true, then create a sparse index.
\n\nNOTE Swagger examples won't work due to the anchor.

Creates a hash index for the collection collection-name if it does not already exist. The call expects an object containing the index details.
In a sparse index all documents will be excluded from the index that do not contain at least one of the specified index attributes (i.e. fields) or that have a value of null in any of the specified index attributes. Such documents will not be indexed, and not be taken into account for uniqueness checks if the unique flag is set.
In a non-sparse index, these documents will be indexed (for non-present indexed attributes, a value of null will be used) and will be taken into account for uniqueness checks if the unique flag is set.
Note: unique indexes on non-shard keys are not supported in a cluster.

Example: Creating an unique constraint

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

\n
Example: Creating a non-unique hash index

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

\n
Example: Creating a sparse index

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

\n
", + "parameters": [ + { + "description": "The collection name.
", + "in": "query", + "name": "collection-name", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_index_hash" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "If the index already exists, then a HTTP 200 is returned.
" + }, + "201": { + "description": "If the index does not already exist and could be created, then a HTTP 201 is returned.
" + }, + "400": { + "description": "If the collection already contains documents and you try to create a unique hash index in such a way that there are documents violating the uniqueness, then a HTTP 400 is returned.
" + }, + "404": { + "description": "If the collection-name is unknown, then a HTTP 404 is returned.
" + } + }, + "summary": " Create hash index", + "tags": [ + "Indexes" + ], + "x-examples": [], + "x-filename": "Indexes - js/actions/api-index.js" + } + }, + "/_api/index/{index-handle}": { + "delete": { + "description": "\n\n
Deletes an index with index-handle.

Example:

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

\n
", + "parameters": [ + { + "description": "The index handle.
", + "format": "string", + "in": "path", + "name": "index-handle", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "If the index could be deleted, then an HTTP 200 is returned.
" + }, + "404": { + "description": "If the index-handle is unknown, then an HTTP 404 is returned." + } + }, + "summary": " Delete index", + "tags": [ + "Indexes" + ], + "x-examples": [], + "x-filename": "Indexes - js/actions/api-index.js" + }, + "get": { + "description": "\n\n
The result is an object describing the index. It has at least the following attributes:
  • id: the identifier of the index
  • type: the index type
All other attributes are type-dependent. For example, some indexes provide unique or sparse flags, whereas others don't. Some indexes also provide a selectivity estimate in the selectivityEstimate attribute of the result.

Example:

shell> curl --dump - http://localhost:8529/_api/index/products/0\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/0\", \n  \"type\" : \"primary\", \n  \"fields\" : [ \n    \"_key\" \n  ], \n  \"selectivityEstimate\" : 1, \n  \"unique\" : true, \n  \"sparse\" : false, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [ + { + "description": "The index-handle.
", + "format": "string", + "in": "path", + "name": "index-handle", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "If the index exists, then a HTTP 200 is returned.
" + }, + "404": { + "description": "If the index does not exist, then a HTTP 404 is returned.
" + } + }, + "summary": "Read index", + "tags": [ + "Indexes" + ], + "x-examples": [], + "x-filename": "Indexes - js/actions/api-index.js" + } + }, + "/_api/job/{job-id}": { + "get": { + "description": "\n\nReturns the processing status of the specified job. The processing status can be determined by peeking into the HTTP response code of the response.

Example: Querying the status of a done job:

shell> curl -X PUT --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 603314631\n\nshell> curl -X PUT --dump - http://localhost:8529/_api/job/603314631\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nx-arango-async-id: 603314631\n\n{ \n  \"server\" : \"arango\", \n  \"version\" : \"2.7.0-devel\" \n}\n

\n
Example: Querying the status of a pending job: (we create a sleep job therefore...)

shell> curl --header 'x-arango-async: store' --dump - http://localhost:8529/_admin/sleep?duration=30\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 603380167\n\nshell> curl --dump - http://localhost:8529/_api/job/603380167\n\nHTTP/1.1 204 No Content\ncontent-type: text/plain; charset=utf-8\n\n

\n
", + "parameters": [ + { + "description": "The async job id.
", + "format": "string", + "in": "path", + "name": "job-id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the job requested via job-id has been executed and its result is ready to fetch.
" + }, + "204": { + "description": "is returned if the job requested via job-id is still in the queue of pending (or not yet finished) jobs.
" + }, + "404": { + "description": "is returned if the job was not found or already deleted or fetched from the job result list.
" + } + }, + "summary": " Returns async job", + "tags": [ + "job" + ], + "x-examples": [], + "x-filename": "job - arangod/HttpServer/AsyncJobManager.cpp, arangod/RestHandler/RestJobHandler.cpp" + }, + "put": { + "description": "\n\nReturns the result of an async job identified by job-id. If the async job result is present on the server, the result will be removed from the list of result. That means this method can be called for each job-id once. The method will return the original job result's headers and body, plus the additional HTTP header x-arango-async-job-id. If this header is present, then the job was found and the response contains the original job's result. If the header is not present, the job was not found and the response contains status information from the job manager.

Example: Not providing a job-id:

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

\n
Example: Providing a job-id for a non-existing job:

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

\n
Example: Fetching the result of an HTTP GET job:

shell> curl -X PUT --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 602986951\n\nshell> curl -X PUT --dump - http://localhost:8529/_api/job/602986951\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nx-arango-async-id: 602986951\n\n{ \n  \"server\" : \"arango\", \n  \"version\" : \"2.7.0-devel\" \n}\n

\n
Example: Fetching the result of an HTTP POST job that failed:

shell> curl -X PUT --header 'x-arango-async: store' --data-binary @- --dump - http://localhost:8529/_api/collection <<EOF\n{ \n  \"name\" : \" this name is invalid \" \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 603052487\n\nshell> curl -X PUT --dump - http://localhost:8529/_api/job/603052487\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\nx-arango-async-id: 603052487\n\n{ \n  \"error\" : true, \n  \"code\" : 400, \n  \"errorNum\" : 400, \n  \"errorMessage\" : \"expected PUT /_api/collection/<collection-name>/<action>\" \n}\n

\n
", + "parameters": [ + { + "description": "The async job id.
", + "format": "string", + "in": "path", + "name": "job-id", + "required": true, + "type": "string" + } + ], + "responses": { + "204": { + "description": "is returned if the job requested via job-id is still in the queue of pending (or not yet finished) jobs. In this case, no x-arango-async-id HTTP header will be returned.
" + }, + "400": { + "description": "is returned if no job-id was specified in the request. In this case, no x-arango-async-id HTTP header will be returned.
" + }, + "404": { + "description": "is returned if the job was not found or already deleted or fetched from the job result list. In this case, no x-arango-async-id HTTP header will be returned.
" + } + }, + "summary": " Return result of an async job", + "tags": [ + "job" + ], + "x-examples": [], + "x-filename": "job - arangod/HttpServer/AsyncJobManager.cpp, arangod/RestHandler/RestJobHandler.cpp" + } + }, + "/_api/job/{job-id}/cancel": { + "put": { + "description": "\n\nCancels the currently running job identified by job-id. Note that it still might take some time to actually cancel the running async job.

Example:

shell> curl -X POST --header 'x-arango-async: store' --data-binary @- --dump - http://localhost:8529/_api/cursor <<EOF\n{ \n  \"query\" : \"FOR i IN 1..10 FOR j IN 1..10 LET x = sleep(1.0) FILTER i == 5 && j == 5 RETURN 42\" \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 602659271\n\nshell> curl --dump - http://localhost:8529/_api/job/pending\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n  \"602659271\" \n]\nshell> curl -X PUT --dump - http://localhost:8529/_api/job/602659271/cancel\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : true \n}\nshell> curl --dump - http://localhost:8529/_api/job/pending\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ ]\n

\n
", + "parameters": [ + { + "description": "The async job id.
", + "format": "string", + "in": "path", + "name": "job-id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "cancel has been initiated.
" + }, + "400": { + "description": "is returned if no job-id was specified in the request. In this case, no x-arango-async-id HTTP header will be returned.
" + }, + "404": { + "description": "is returned if the job was not found or already deleted or fetched from the job result list. In this case, no x-arango-async-id HTTP header will be returned.
" + } + }, + "summary": " Cancel async job", + "tags": [ + "job" + ], + "x-examples": [], + "x-filename": "job - arangod/HttpServer/AsyncJobManager.cpp, arangod/RestHandler/RestJobHandler.cpp" + } + }, + "/_api/job/{type}": { + "delete": { + "description": "\n\nDeletes either all job results, expired job results, or the result of a specific job. Clients can use this method to perform an eventual garbage collection of job results.

Example: Deleting all jobs:

shell> curl -X PUT --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 602790343\n\nshell> curl -X DELETE --dump - http://localhost:8529/_api/job/all\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : true \n}\n

\n
Example: Deleting expired jobs:

shell> curl -X PUT --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 602855879\n\nshell> curl --dump - http://localhost:8529/_admin/time\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"time\" : 1443627576.40017, \n  \"error\" : false, \n  \"code\" : 200 \n}\nshell> curl -X DELETE --dump - http://localhost:8529/_api/job/expired?stamp=1443627576.40017\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : true \n}\nshell> curl --dump - http://localhost:8529/_api/job/pending\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ ]\n

\n
Example: Deleting the result of a specific job:

shell> curl -X PUT --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 602921415\n\nshell> curl -X DELETE --dump - http://localhost:8529/_api/job/602921415\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : true \n}\n

\n
Example: Deleting the result of a non-existing job:

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

\n
", + "parameters": [ + { + "description": "The type of jobs to delete. type can be: *all: Deletes all jobs results. Currently executing or queued async jobs will not be stopped by this call. *expired: Deletes expired results. To determine the expiration status of a result, pass the stamp URL parameter. stamp needs to be a UNIX timestamp, and all async job results created at a lower timestamp will be deleted. *an actual job-id: In this case, the call will remove the result of the specified async job. If the job is currently executing or queued, it will not be aborted.
", + "format": "string", + "in": "path", + "name": "type", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the deletion operation was carried out successfully. This code will also be returned if no results were deleted.
" + }, + "400": { + "description": "is returned if type is not specified or has an invalid value.
" + }, + "404": { + "description": "is returned if type is a job-id but no async job with the specified id was found.
" + } + }, + "summary": " Deletes async job", + "tags": [ + "job" + ], + "x-examples": [], + "x-filename": "job - arangod/HttpServer/AsyncJobManager.cpp, arangod/RestHandler/RestJobHandler.cpp" + }, + "get": { + "description": "\n\nReturns the list of ids of async jobs with a specific status (either done or pending). The list can be used by the client to get an overview of the job system status and to retrieve completed job results later.

Example: Fetching the list of done jobs:

shell> curl -X PUT --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 603118023\n\nshell> curl --dump - http://localhost:8529/_api/job/done\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n  \"603118023\" \n]\n

\n
Example: Fetching the list of pending jobs:

shell> curl -X PUT --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 603183559\n\nshell> curl --dump - http://localhost:8529/_api/job/pending\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ ]\n

\n
Example: Querying the status of a pending job: (we create a sleep job therefore...)

shell> curl --header 'x-arango-async: store' --dump - http://localhost:8529/_admin/sleep?duration=30\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 603249095\n\nshell> curl --dump - http://localhost:8529/_api/job/pending\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n  \"603249095\" \n]\nshell> curl -X DELETE --dump - http://localhost:8529/_api/job/603249095\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : true \n}\n

\n
", + "parameters": [ + { + "description": "The type of jobs to return. The type can be either done or pending. Setting the type to done will make the method return the ids of already completed async jobs for which results can be fetched. Setting the type to pending will return the ids of not yet finished async jobs.
", + "format": "string", + "in": "path", + "name": "type", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the list can be compiled successfully. Note: the list might be empty.
" + }, + "400": { + "description": "is returned if type is not specified or has an invalid value.
" + } + }, + "summary": " Returns list of async jobs", + "tags": [ + "job" + ], + "x-examples": [], + "x-filename": "job - arangod/HttpServer/AsyncJobManager.cpp, arangod/RestHandler/RestJobHandler.cpp" + } + }, + "/_api/query": { + "post": { + "description": "**A json post document with these Properties is required:**
  • query: To validate a query string without executing it, the query string can be passed to the server via an HTTP POST request.

Example: a Valid query

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/query <<EOF\n{ \"query\" : \"FOR p IN products FILTER p.name == @name LIMIT 2 RETURN p.n\" }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : false, \n  \"code\" : 200, \n  \"parsed\" : true, \n  \"collections\" : [ \n    \"products\" \n  ], \n  \"bindVars\" : [ \n    \"name\" \n  ], \n  \"ast\" : [ \n    { \n      \"type\" : \"root\", \n      \"subNodes\" : [ \n        { \n          \"type\" : \"for\", \n          \"subNodes\" : [ \n            { \n              \"type\" : \"variable\", \n              \"name\" : \"p\", \n              \"id\" : 0 \n            }, \n            { \n              \"type\" : \"collection\", \n              \"name\" : \"products\" \n            } \n          ] \n        }, \n        { \n          \"type\" : \"filter\", \n          \"subNodes\" : [ \n            { \n              \"type\" : \"compare ==\", \n              \"subNodes\" : [ \n                { \n                  \"type\" : \"attribute access\", \n                  \"name\" : \"name\", \n                  \"subNodes\" : [ \n                    { \n                      \"type\" : \"reference\", \n                      \"name\" : \"p\", \n                      \"id\" : 0 \n                    } \n                  ] \n                }, \n                { \n                  \"type\" : \"parameter\", \n                  \"name\" : \"name\" \n                } \n              ] \n            } \n          ] \n        }, \n        { \n          \"type\" : \"limit\", \n          \"subNodes\" : [ \n            { \n              \"type\" : \"value\", \n              \"value\" : 0 \n            }, \n            { \n              \"type\" : \"value\", \n              \"value\" : 2 \n            } \n          ] \n        }, \n        { \n          \"type\" : \"return\", \n          \"subNodes\" : [ \n            { \n              \"type\" : \"attribute access\", \n              \"name\" : \"n\", \n              \"subNodes\" : [ \n                { \n                  \"type\" : \"reference\", \n                  \"name\" : \"p\", \n                  \"id\" : 0 \n                } \n              ] \n            } \n          ] \n        } \n      ] \n    } \n  ], \n  \"warnings\" : [ ] \n}\n

\n
Example: an Invalid query

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/PostApiQueryProperties" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "If the query is valid, the server will respond with HTTP 200 and return the names of the bind parameters it found in the query (if any) in the bindVars attribute of the response. It will also return an array of the collections used in the query in the collections attribute. If a query can be parsed successfully, the ast attribute of the returned JSON will contain the abstract syntax tree representation of the query. The format of the ast is subject to change in future versions of ArangoDB, but it can be used to inspect how ArangoDB interprets a given query. Note that the abstract syntax tree will be returned without any optimizations applied to it.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request, or if the query contains a parse error. The body of the response will contain the error details embedded in a JSON object.
" + } + }, + "summary": " Parse an AQL query", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + } + }, + "/_api/query-cache": { + "delete": { + "description": "\n\nclears the query cache", + "parameters": [], + "responses": { + "200": { + "description": "The server will respond with HTTP 200 when the cache was cleared successfully.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request.
" + } + }, + "summary": " Clears any results in the AQL query cache", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + } + }, + "/_api/query-cache/properties": { + "get": { + "description": "\n\nReturns the global AQL query cache configuration. The configuration is a JSON object with the following properties:
  • mode: the mode the AQL query cache operates in. The mode is one of the following values: off, on or demand.
  • maxResults: the maximum number of query results that will be stored per database-specific cache.
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned if the properties can be retrieved successfully.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request,

" + } + }, + "summary": " Returns the global properties for the AQL query cache", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + }, + "put": { + "description": "\n\nAfter the properties have been changed, the current set of properties will be returned in the HTTP response.
Note: changing the properties may invalidate all results in the cache. The global properties for AQL query cache. The properties need to be passed in the attribute properties in the body of the HTTP request. properties needs to be a JSON object with the following properties:
**A json post document with these Properties is required:**
  • mode: the mode the AQL query cache should operate in. Possible values are off, on or demand.
  • maxResults: the maximum number of query results that will be stored per database-specific cache.

", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/PutApiQueryCacheProperties" + }, + "x-description-offset": 489 + } + ], + "responses": { + "200": { + "description": "Is returned if the properties were changed successfully.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request,

" + } + }, + "summary": " Globally adjusts the AQL query result cache properties", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + } + }, + "/_api/query/current": { + "get": { + "description": "\n\nReturns an array containing the AQL queries currently running in the selected database. Each query is a JSON object with the following attributes:
  • id: the query's id
  • query: the query string (potentially truncated)
  • started: the date and time when the query was started
  • runTime: the query's run time up to the point the list of queries was queried
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned when the list of queries can be retrieved successfully.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request,

" + } + }, + "summary": " Returns the currently running AQL queries", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + } + }, + "/_api/query/properties": { + "get": { + "description": "\n\nReturns the current query tracking configuration. The configuration is a JSON object with the following properties:
  • enabled: if set to true, then queries will be tracked. If set to false, neither queries nor slow queries will be tracked.
  • trackSlowQueries: if set to true, then slow queries will be tracked in the list of slow queries if their runtime exceeds the value set in slowQueryThreshold. In order for slow queries to be tracked, the enabled property must also be set to true.
  • maxSlowQueries: the maximum number of slow queries to keep in the list of slow queries. If the list of slow queries is full, the oldest entry in it will be discarded when additional slow queries occur.
  • slowQueryThreshold: the threshold value for treating a query as slow. A query with a runtime greater or equal to this threshold value will be put into the list of slow queries when slow query tracking is enabled. The value for slowQueryThreshold is specified in seconds.
  • maxQueryStringLength: the maximum query string length to keep in the list of queries. Query strings can have arbitrary lengths, and this property can be used to save memory in case very long query strings are used. The value is specified in bytes.
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned if properties were retrieved successfully.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request,

" + } + }, + "summary": " Returns the properties for the AQL query tracking", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + }, + "put": { + "description": "**A json post document with these Properties is required:**
  • slowQueryThreshold: The threshold value for treating a query as slow. A query with a runtime greater or equal to this threshold value will be put into the list of slow queries when slow query tracking is enabled. The value for slowQueryThreshold is specified in seconds.
  • enabled: If set to true, then queries will be tracked. If set to false, neither queries nor slow queries will be tracked.
  • maxSlowQueries: The maximum number of slow queries to keep in the list of slow queries. If the list of slow queries is full, the oldest entry in it will be discarded when additional slow queries occur.
  • trackSlowQueries: If set to true, then slow queries will be tracked in the list of slow queries if their runtime exceeds the value set in slowQueryThreshold. In order for slow queries to be tracked, the enabled property must also be set to true.
  • maxQueryStringLength: The maximum query string length to keep in the list of queries. Query strings can have arbitrary lengths, and this property can be used to save memory in case very long query strings are used. The value is specified in bytes.
\n\nThe properties need to be passed in the attribute properties in the body of the HTTP request. properties needs to be a JSON object.
After the properties have been changed, the current set of properties will be returned in the HTTP response.
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/PutApiQueryProperties" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "Is returned if the properties were changed successfully.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request,

" + } + }, + "summary": " Changes the properties for the AQL query tracking", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + } + }, + "/_api/query/slow": { + "delete": { + "description": "\n\nClears the list of slow AQL queries
", + "parameters": [], + "responses": { + "200": { + "description": "The server will respond with HTTP 200 when the list of queries was cleared successfully.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request.
" + } + }, + "summary": " Clears the list of slow AQL queries", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + }, + "get": { + "description": "\n\nReturns an array containing the last AQL queries that exceeded the slow query threshold in the selected database. The maximum amount of queries in the list can be controlled by setting the query tracking property `maxSlowQueries`. The threshold for treating a query as slow can be adjusted by setting the query tracking property `slowQueryThreshold`.
Each query is a JSON object with the following attributes:
  • id: the query's id
  • query: the query string (potentially truncated)
  • started: the date and time when the query was started
  • runTime: the query's run time up to the point the list of queries was queried
", + "parameters": [], + "responses": { + "200": { + "description": "Is returned when the list of queries can be retrieved successfully.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request,

" + } + }, + "summary": " Returns the list of slow AQL queries", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + } + }, + "/_api/query/{query-id}": { + "delete": { + "description": "\n\nKills a running query. The query will be terminated at the next cancelation point.
", + "parameters": [ + { + "description": "The id of the query.
", + "format": "string", + "in": "path", + "name": "query-id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The server will respond with HTTP 200 when the query was still running when the kill request was executed and the query's kill flag was set.
" + }, + "400": { + "description": "The server will respond with HTTP 400 in case of a malformed request.
" + }, + "404": { + "description": "The server will respond with HTTP 404 when no query with the specified id was found.
" + } + }, + "summary": " Kills a running AQL query", + "tags": [ + "AQL" + ], + "x-examples": [], + "x-filename": "AQL - arangod/RestHandler/RestQueryHandler.cpp, js/actions/api-aqlfunction.js, js/actions/api-explain.js, arangod/RestHandler/RestQueryCacheHandler.cpp" + } + }, + "/_api/replication/applier-config": { + "get": { + "description": "\n\nReturns the configuration of the replication applier.
The body of the response is a JSON object 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\").
  • database: the name of the database to connect to (e.g. \"_system\").
  • username: an optional ArangoDB username to use when connecting to the endpoint.
  • password: the password to use when connecting to the endpoint.
  • maxConnectRetries: the maximum number of connection attempts the applier will make in a row. If the applier cannot establish a connection to the endpoint in this number of attempts, it will stop itself.
  • connectTimeout: the timeout (in seconds) when attempting to connect to the endpoint. This value is used for each connection attempt.
  • requestTimeout: the timeout (in seconds) for individual requests to the endpoint.
  • chunkSize: the requested maximum size for log transfer packets that is used when the endpoint is contacted.
  • 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.
  • includeSystem: whether or not system collection operations will be applied
  • requireFromPresent: if set to true, then the replication applier will check at start whether the start tick from which it starts or resumes replication is still present on the master. If not, then there would be data loss. If requireFromPresent is true, the replication applier will abort with an appropriate error message. If set to false, then the replication applier will still start, and ignore the data loss.
  • verbose: if set to true, then a log line will be emitted for all operations performed by the replication applier. This should be used for debugging replication problems only.
  • restrictType: the configuration for restrictCollections
  • restrictCollections: the optional array of collections to include or exclude, based on the setting of restrictType

Example:

shell> 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\" : 100, \n  \"sslProtocol\" : 0, \n  \"chunkSize\" : 0, \n  \"autoStart\" : false, \n  \"adaptivePolling\" : true, \n  \"includeSystem\" : true, \n  \"requireFromPresent\" : false, \n  \"verbose\" : false, \n  \"restrictType\" : \"\", \n  \"restrictCollections\" : [ ] \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + } + }, + "summary": " Return configuration of replication applier", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + }, + "put": { + "description": "**A json post document with these Properties is required:**
  • username: an optional ArangoDB username to use when connecting to the endpoint.
  • includeSystem: whether or not system collection operations will be applied
  • endpoint: the logger server to connect to (e.g. \"tcp://192.168.173.13:8529\"). The endpoint must be specified.
  • verbose: if set to true, then a log line will be emitted for all operations performed by the replication applier. This should be used for debugging replication problems only.
  • connectTimeout: the timeout (in seconds) when attempting to connect to the endpoint. This value is used for each connection attempt.
  • database: the name of the database on the endpoint. If not specified, defaults to the current local database name.
  • restrictType: the configuration for restrictCollections; Has to be either include or exclude
  • requestTimeout: the timeout (in seconds) for individual requests to the endpoint.
  • requireFromPresent: if set to true, then the replication applier will check at start whether the start tick from which it starts or resumes replication is still present on the master. If not, then there would be data loss. If requireFromPresent is true, the replication applier will abort with an appropriate error message. If set to false, then the replication applier will still start, and ignore the data loss.
  • maxConnectRetries: the maximum number of connection attempts the applier will make in a row. If the applier cannot establish a connection to the endpoint in this number of attempts, it will stop itself.
  • 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 seldom.
  • password: the password to use when connecting to the endpoint.
  • restrictCollections: the array of collections to include or exclude, based on the setting of restrictType of type string
  • chunkSize: the requested maximum size for log transfer packets that is used when the endpoint is contacted.
\n\nSets 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.
In case of success, the body of the response is a JSON object with the updated configuration.

Example:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/replication/applier-config <<EOF\n{ \n  \"endpoint\" : \"tcp://127.0.0.1:8529\", \n  \"username\" : \"replicationApplier\", \n  \"password\" : \"applier1234@foxx\", \n  \"chunkSize\" : 4194304, \n  \"autoStart\" : false, \n  \"adaptivePolling\" : true \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"endpoint\" : \"tcp://127.0.0.1:8529\", \n  \"database\" : \"_system\", \n  \"username\" : \"replicationApplier\", \n  \"requestTimeout\" : 300, \n  \"connectTimeout\" : 10, \n  \"ignoreErrors\" : 0, \n  \"maxConnectRetries\" : 100, \n  \"sslProtocol\" : 0, \n  \"chunkSize\" : 4194304, \n  \"autoStart\" : false, \n  \"adaptivePolling\" : true, \n  \"includeSystem\" : true, \n  \"requireFromPresent\" : false, \n  \"verbose\" : false, \n  \"restrictType\" : \"\", \n  \"restrictCollections\" : [ ] \n}\n

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_put_api_replication_applier_adjust" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "400": { + "description": "is returned if the configuration is incomplete or malformed, or if the replication applier is currently running.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + } + }, + "summary": " Adjust configuration of replication applier", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/applier-start": { + "put": { + "description": "\n\nStarts 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.

Example:

shell> 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    \"safeResumeTick\" : null, \n    \"progress\" : { \n      \"time\" : \"2015-09-30T15:38:57Z\", \n      \"message\" : \"applier created\", \n      \"failedConnects\" : 0 \n    }, \n    \"totalRequests\" : 0, \n    \"totalFailedConnects\" : 0, \n    \"totalEvents\" : 0, \n    \"totalOperationsExcluded\" : 0, \n    \"lastError\" : { \n      \"errorNum\" : 0 \n    }, \n    \"time\" : \"2015-09-30T15:40:09Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"2.7.0-devel\", \n    \"serverId\" : \"4865533481307\" \n  }, \n  \"endpoint\" : \"tcp://127.0.0.1:8529\", \n  \"database\" : \"_system\" \n}\n

\n
", + "parameters": [ + { + "description": "The remote lastLogTick value from which to start applying. If not specified, the last saved tick from the previous applier run is used. If there is no previous applier state saved, the applier will start at the beginning of the logger server's log.
", + "in": "query", + "name": "from", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "400": { + "description": "is returned if the replication applier is not fully configured or the configuration is invalid.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + } + }, + "summary": " Start replication applier", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/applier-state": { + "get": { + "description": "\n\nReturns the state of the replication applier, regardless of whether the applier is currently running or not.
The response is a JSON object with the following attributes:
  • state: a JSON object 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.
    - totalRequests: the total number of requests the applier has made to the endpoint.
    - totalFailedConnects: the total number of failed connection attempts the applier has made.
    - totalEvents: the total number of log events the applier has processed.
    - totalOperationsExcluded: the total number of log events excluded because of restrictCollections.
    - progress: a JSON object 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
    - failedConnects: the current number of failed connection attempts
    - lastError: a JSON object 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 object 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)
  • database: the name of the database the applier is connected to (if applier is active) or will connect to (if applier is currently inactive)

Example: Fetching the state of an inactive applier:

shell> 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    \"safeResumeTick\" : null, \n    \"progress\" : { \n      \"time\" : \"2015-09-30T15:40:09Z\", \n      \"message\" : \"applier shut down\", \n      \"failedConnects\" : 1 \n    }, \n    \"totalRequests\" : 1, \n    \"totalFailedConnects\" : 1, \n    \"totalEvents\" : 0, \n    \"totalOperationsExcluded\" : 0, \n    \"lastError\" : { \n      \"time\" : \"2015-09-30T15:40:10Z\", \n      \"errorMessage\" : \"could not connect to master at tcp://127.0.0.1:8529: Could not connect to 'tcp://127.0.0.1:8529' 'connect() failed with #111 - Connection refused'\", \n      \"errorNum\" : 1412 \n    }, \n    \"time\" : \"2015-09-30T15:40:10Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"2.7.0-devel\", \n    \"serverId\" : \"4865533481307\" \n  }, \n  \"endpoint\" : \"tcp://127.0.0.1:8529\", \n  \"database\" : \"_system\" \n}\n

\n
Example: Fetching the state of an active applier:

shell> 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    \"safeResumeTick\" : null, \n    \"progress\" : { \n      \"time\" : \"2015-09-30T15:40:10Z\", \n      \"message\" : \"fetching master state information\", \n      \"failedConnects\" : 1 \n    }, \n    \"totalRequests\" : 2, \n    \"totalFailedConnects\" : 2, \n    \"totalEvents\" : 0, \n    \"totalOperationsExcluded\" : 0, \n    \"lastError\" : { \n      \"errorNum\" : 0 \n    }, \n    \"time\" : \"2015-09-30T15:40:10Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"2.7.0-devel\", \n    \"serverId\" : \"4865533481307\" \n  }, \n  \"endpoint\" : \"tcp://127.0.0.1:8529\", \n  \"database\" : \"_system\" \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + } + }, + "summary": " State of the replication applier", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/applier-stop": { + "put": { + "description": "\n\nStops the replication applier. This will return immediately if the replication applier is not running.

Example:

shell> 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    \"safeResumeTick\" : null, \n    \"progress\" : { \n      \"time\" : \"2015-09-30T15:40:10Z\", \n      \"message\" : \"applier shut down\", \n      \"failedConnects\" : 1 \n    }, \n    \"totalRequests\" : 3, \n    \"totalFailedConnects\" : 3, \n    \"totalEvents\" : 0, \n    \"totalOperationsExcluded\" : 0, \n    \"lastError\" : { \n      \"time\" : \"2015-09-30T15:40:11Z\", \n      \"errorMessage\" : \"could not connect to master at tcp://127.0.0.1:8529: Could not connect to 'tcp://127.0.0.1:8529' 'connect() failed with #111 - Connection refused'\", \n      \"errorNum\" : 1412 \n    }, \n    \"time\" : \"2015-09-30T15:40:11Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"2.7.0-devel\", \n    \"serverId\" : \"4865533481307\" \n  }, \n  \"endpoint\" : \"tcp://127.0.0.1:8529\", \n  \"database\" : \"_system\" \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + } + }, + "summary": " Stop replication applier", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/batch": { + "post": { + "description": "**A json post document with these Properties is required:**
  • ttl: the time-to-live for the new batch (in seconds)
    A JSON object with the batch configuration.
\n\nCreates a new dump batch and returns the batch's id.
The response is a JSON object with the following attributes:
  • id: the id of the batch
Note: on a coordinator, this request must have the URL parameter DBserver which must be an ID of a DBserver. The very same request is forwarded synchronously to that DBserver. It is an error if this attribute is not bound in the coordinator case.
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_batch_replication" + }, + "x-description-offset": 59 + } + ], + "responses": { + "204": { + "description": "is returned if the batch was created successfully.
" + }, + "400": { + "description": "is returned if the ttl value is invalid or if DBserver attribute is not specified or illegal on a coordinator.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + } + }, + "summary": " Create new dump batch", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/batch/{id}": { + "delete": { + "description": "\n\nDeletes the existing dump batch, allowing compaction and cleanup to resume.
Note: on a coordinator, this request must have the URL parameter DBserver which must be an ID of a DBserver. The very same request is forwarded synchronously to that DBserver. It is an error if this attribute is not bound in the coordinator case.
", + "parameters": [ + { + "description": "The id of the batch.
", + "format": "string", + "in": "path", + "name": "id", + "required": true, + "type": "string" + } + ], + "responses": { + "204": { + "description": "is returned if the batch was deleted successfully.
" + }, + "400": { + "description": "is returned if the batch was not found.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + } + }, + "summary": " Deletes an existing dump batch", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + }, + "put": { + "description": "**A json post document with these Properties is required:**
  • ttl: the time-to-live for the new batch (in seconds)
\n\nExtends the ttl of an existing dump batch, using the batch's id and the provided ttl value.
If the batch's ttl can be extended successfully, the response is empty.
Note: on a coordinator, this request must have the URL parameter DBserver which must be an ID of a DBserver. The very same request is forwarded synchronously to that DBserver. It is an error if this attribute is not bound in the coordinator case.
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_put_batch_replication" + }, + "x-description-offset": 59 + }, + { + "description": "The id of the batch.
", + "format": "string", + "in": "path", + "name": "id", + "required": true, + "type": "string" + } + ], + "responses": { + "204": { + "description": "is returned if the batch's ttl was extended successfully.
" + }, + "400": { + "description": "is returned if the ttl value is invalid or the batch was not found.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + } + }, + "summary": " Prolong existing dump batch", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/clusterInventory": { + "get": { + "description": "\n\nReturns the array of collections and indexes available on the cluster.
The response will be an array of JSON objects, one for each collection. Each collection containscontains exactly two keys \"parameters\" and \"indexes\". This information comes from Plan/Collections/{DB-Name}/* in the agency, just that the indexes attribute there is relocated to adjust it to the data format of arangodump.
", + "parameters": [ + { + "description": "Include system collections in the result. The default value is true.
", + "in": "query", + "name": "includeSystem", + "required": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + } + }, + "summary": " Return cluster inventory of collections and indexes", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/dump": { + "get": { + "description": "\n\nReturns 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 object, with at least the following attributes:
  • tick: the operation's tick attribute
  • 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.
  • type: the type of entry. Possible values for type are:
    - 2300: document insertion/update
    - 2301: edge insertion/update
    - 2302: document/edge deletion
Note: there will be no distinction between inserts and updates when calling this method.

Example: Empty collection:

shell> 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

\n
Example: Non-empty collection:

shell> 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: 766695879\n\n\"{\\\"tick\\\":\\\"766040519\\\",\\\"type\\\":2300,\\\"key\\\":\\\"123456\\\",\\\"rev\\\":\\\"765974983\\\",\\\"data\\\":{\\\"_key\\\":\\\"123456\\\",\\\"_rev\\\":\\\"765974983\\\",\\\"c\\\":false,\\\"b\\\":1,\\\"d\\\":\\\"additional value\\\"}}\\n{\\\"tick\\\":\\\"766499271\\\",\\\"type\\\":2302,\\\"key\\\":\\\"foobar\\\",\\\"rev\\\":\\\"766433735\\\"}\\n{\\\"tick\\\":\\\"766695879\\\",\\\"type\\\":2302,\\\"key\\\":\\\"abcdef\\\",\\\"rev\\\":\\\"766630343\\\"}\\n\"\n

\n
", + "parameters": [ + { + "description": "The name or id of the collection to dump.
", + "in": "query", + "name": "collection", + "required": true, + "type": "string" + }, + { + "description": "Lower bound tick value for results.
", + "in": "query", + "name": "from", + "required": false, + "type": "number" + }, + { + "description": "Upper bound tick value for results.
", + "in": "query", + "name": "to", + "required": false, + "type": "number" + }, + { + "description": "Approximate maximum size of the returned result.
", + "in": "query", + "name": "chunkSize", + "required": false, + "type": "number" + }, + { + "description": "Include system collections in the result. The default value is true.
", + "in": "query", + "name": "includeSystem", + "required": false, + "type": "boolean" + }, + { + "description": "Whether or not to include tick values in the dump. The default value is true.
", + "in": "query", + "name": "ticks", + "required": false, + "type": "boolean" + }, + { + "description": "Whether or not to flush the WAL before dumping. The default value is true.
", + "in": "query", + "name": "flush", + "required": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "is returned if the request was executed successfully and data was returned. The header `x-arango-replication-lastincluded` is set to the tick of the last document returned.
" + }, + "204": { + "description": "is returned if the request was executed successfully, but there was no content available. The header `x-arango-replication-lastincluded` is `0` in this case.
" + }, + "400": { + "description": "is returned if either the from or to values are invalid.
" + }, + "404": { + "description": "is returned when the collection could not be found.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + } + }, + "summary": " Return data of a collection", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/inventory": { + "get": { + "description": "\n\nReturns the array of collections and indexes available on the server. This array can be used by replication clients to initiate an initial sync with the server.
The response will contain a JSON object with the collection and state and tick attributes.
collections is a array of collections with the following sub-attributes:
  • parameters: the collection properties
  • indexes: a array of the indexes of a the collection. Primary indexes and edges indexes are not included in this array.
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. Note: since ArangoDB 2.2, the value will always be true
  • 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 server, a replication client can execute these steps:
  • call the /inventory API method. This returns the lastLogTick value and the array of collections and indexes from the 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.
Note: on a coordinator, this request must have the URL parameter DBserver which must be an ID of a DBserver. The very same request is forwarded synchronously to that DBserver. It is an error if this attribute is not bound in the coordinator case.

Example:

shell> 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\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"7199175\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"_apps\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ \n        { \n          \"id\" : \"7461319\", \n          \"type\" : \"hash\", \n          \"fields\" : [ \n            \"mount\" \n          ], \n          \"selectivityEstimate\" : 1, \n          \"unique\" : true, \n          \"sparse\" : false \n        } \n      ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"4446663\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 4194304, \n        \"name\" : \"_aqlfunctions\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"2087367\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"_graphs\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"2218439\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"_modules\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"2349511\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 33554432, \n        \"name\" : \"_routing\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"14145991\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"_sessions\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"14866887\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"_system_users_users\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"252359\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 4194304, \n        \"name\" : \"_users\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ \n        { \n          \"id\" : \"580039\", \n          \"type\" : \"hash\", \n          \"fields\" : [ \n            \"user\" \n          ], \n          \"selectivityEstimate\" : 1, \n          \"unique\" : true, \n          \"sparse\" : true \n        } \n      ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"22206919\", \n        \"indexBuckets\" : 8, \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\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"21354951\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"demo\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    } \n  ], \n  \"state\" : { \n    \"running\" : true, \n    \"lastLogTick\" : \"767351239\", \n    \"totalEvents\" : 4726, \n    \"time\" : \"2015-09-30T15:40:13Z\" \n  }, \n  \"tick\" : \"767351239\" \n}\n

\n
Example: With some additional indexes:

shell> 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\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"7199175\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"_apps\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ \n        { \n          \"id\" : \"7461319\", \n          \"type\" : \"hash\", \n          \"fields\" : [ \n            \"mount\" \n          ], \n          \"selectivityEstimate\" : 1, \n          \"unique\" : true, \n          \"sparse\" : false \n        } \n      ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"4446663\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 4194304, \n        \"name\" : \"_aqlfunctions\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"2087367\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"_graphs\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"2218439\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"_modules\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"2349511\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 33554432, \n        \"name\" : \"_routing\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"14145991\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"_sessions\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"14866887\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"_system_users_users\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"252359\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 4194304, \n        \"name\" : \"_users\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ \n        { \n          \"id\" : \"580039\", \n          \"type\" : \"hash\", \n          \"fields\" : [ \n            \"user\" \n          ], \n          \"selectivityEstimate\" : 1, \n          \"unique\" : true, \n          \"sparse\" : true \n        } \n      ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"22206919\", \n        \"indexBuckets\" : 8, \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\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"21354951\", \n        \"indexBuckets\" : 8, \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\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"767416775\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"IndexedCollection1\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ \n        { \n          \"id\" : \"767678919\", \n          \"type\" : \"hash\", \n          \"fields\" : [ \n            \"name\" \n          ], \n          \"selectivityEstimate\" : 1, \n          \"unique\" : false, \n          \"sparse\" : false \n        }, \n        { \n          \"id\" : \"768006599\", \n          \"type\" : \"skiplist\", \n          \"fields\" : [ \n            \"a\", \n            \"b\" \n          ], \n          \"unique\" : true, \n          \"sparse\" : false \n        }, \n        { \n          \"id\" : \"768203207\", \n          \"type\" : \"cap\", \n          \"size\" : 500, \n          \"byteSize\" : 0, \n          \"unique\" : false \n        } \n      ] \n    }, \n    { \n      \"parameters\" : { \n        \"version\" : 5, \n        \"type\" : 2, \n        \"cid\" : \"768399815\", \n        \"indexBuckets\" : 8, \n        \"deleted\" : false, \n        \"doCompact\" : true, \n        \"maximalSize\" : 1048576, \n        \"name\" : \"IndexedCollection2\", \n        \"isVolatile\" : false, \n        \"waitForSync\" : false \n      }, \n      \"indexes\" : [ \n        { \n          \"id\" : \"768596423\", \n          \"type\" : \"fulltext\", \n          \"fields\" : [ \n            \"text\" \n          ], \n          \"unique\" : false, \n          \"sparse\" : true, \n          \"minLength\" : 10 \n        }, \n        { \n          \"id\" : \"768924103\", \n          \"type\" : \"skiplist\", \n          \"fields\" : [ \n            \"a\" \n          ], \n          \"unique\" : false, \n          \"sparse\" : false \n        }, \n        { \n          \"id\" : \"769120711\", \n          \"type\" : \"cap\", \n          \"size\" : 0, \n          \"byteSize\" : 1048576, \n          \"unique\" : false \n        } \n      ] \n    } \n  ], \n  \"state\" : { \n    \"running\" : true, \n    \"lastLogTick\" : \"767351239\", \n    \"totalEvents\" : 4739, \n    \"time\" : \"2015-09-30T15:40:13Z\" \n  }, \n  \"tick\" : \"769251783\" \n}\n

\n
", + "parameters": [ + { + "description": "Include system collections in the result. The default value is true.
", + "in": "query", + "name": "includeSystem", + "required": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + } + }, + "summary": " Return inventory of collections and indexes", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/logger-first-tick": { + "get": { + "description": "\n\nReturns the first available tick value that can be served from the server's replication log. This method can be called by replication clients after to determine if certain data (identified by a tick value) is still available for replication.
The result is a JSON object containing the attribute firstTick. This attribute contains the minimum tick value available in the server's replication log.
Note: this method is not supported on a coordinator in a cluster.

Example: Returning the first available tick

shell> curl --dump - http://localhost:8529/_api/replication/logger-first-tick\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n\"{\\\"firstTick\\\":\\\"383431\\\"}\"\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + }, + "501": { + "description": "is returned when this operation is called on a coordinator in a cluster.
" + } + }, + "summary": " Returns the first available tick value", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/logger-follow": { + "get": { + "description": "\n\nReturns data from the server's replication log. This method can be called by replication clients after an initial synchronization 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 object, 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.
Note: this method is not supported on a coordinator in a cluster.

Example: No log events available

shell> curl --dump - http://localhost:8529/_api/replication/logger-follow?from=770628039\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-frompresent: true\nx-arango-replication-lastincluded: 0\nx-arango-replication-lasttick: 770628039\n\n

\n
Example: A few log events

shell> curl --dump - http://localhost:8529/_api/replication/logger-follow?from=770628039\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-frompresent: true\nx-arango-replication-lastincluded: 771873223\nx-arango-replication-lasttick: 771873223\n\n\"{\\\"tick\\\":\\\"770759111\\\",\\\"type\\\":2000,\\\"database\\\":\\\"121287\\\",\\\"cid\\\":\\\"770693575\\\",\\\"collection\\\":{\\\"version\\\":5,\\\"type\\\":2,\\\"cid\\\":\\\"770693575\\\",\\\"indexBuckets\\\":8,\\\"deleted\\\":false,\\\"doCompact\\\":true,\\\"maximalSize\\\":1048576,\\\"name\\\":\\\"products\\\",\\\"isVolatile\\\":false,\\\"waitForSync\\\":false}}\\n{\\\"tick\\\":\\\"771086791\\\",\\\"type\\\":2300,\\\"database\\\":\\\"121287\\\",\\\"cid\\\":\\\"770693575\\\",\\\"tid\\\":\\\"0\\\",\\\"key\\\":\\\"p1\\\",\\\"rev\\\":\\\"771021255\\\",\\\"data\\\":{\\\"_key\\\":\\\"p1\\\",\\\"_rev\\\":\\\"771021255\\\",\\\"name\\\":\\\"flux compensator\\\"}}\\n{\\\"tick\\\":\\\"771414471\\\",\\\"type\\\":2300,\\\"database\\\":\\\"121287\\\",\\\"cid\\\":\\\"770693575\\\",\\\"tid\\\":\\\"0\\\",\\\"key\\\":\\\"p2\\\",\\\"rev\\\":\\\"771348935\\\",\\\"data\\\":{\\\"_key\\\":\\\"p2\\\",\\\"_rev\\\":\\\"771348935\\\",\\\"hp\\\":5100,\\\"name\\\":\\\"hybrid hovercraft\\\"}}\\n{\\\"tick\\\":\\\"771611079\\\",\\\"type\\\":2302,\\\"database\\\":\\\"121287\\\",\\\"cid\\\":\\\"770693575\\\",\\\"tid\\\":\\\"0\\\",\\\"key\\\":\\\"p1\\\",\\\"rev\\\":\\\"771545543\\\"}\\n{\\\"tick\\\":\\\"771807687\\\",\\\"type\\\":2300,\\\"database\\\":\\\"121287\\\",\\\"cid\\\":\\\"770693575\\\",\\\"tid\\\":\\\"0\\\",\\\"key\\\":\\\"p2\\\",\\\"rev\\\":\\\"771742151\\\",\\\"data\\\":{\\\"_key\\\":\\\"p2\\\",\\\"_rev\\\":\\\"771742151\\\"}}\\n{\\\"tick\\\":\\\"771873223\\\",\\\"type\\\":2001,\\\"database\\\":\\\"121287\\\",\\\"cid\\\":\\\"770693575\\\"}\\n\"\n

\n
Example: More events than would fit into the response

shell> curl --dump - http://localhost:8529/_api/replication/logger-follow?from=769317319&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-frompresent: true\nx-arango-replication-lastincluded: 769841607\nx-arango-replication-lasttick: 770628039\n\n\"{\\\"tick\\\":\\\"769382855\\\",\\\"type\\\":2001,\\\"database\\\":\\\"121287\\\",\\\"cid\\\":\\\"768399815\\\"}\\n{\\\"tick\\\":\\\"769513927\\\",\\\"type\\\":2000,\\\"database\\\":\\\"121287\\\",\\\"cid\\\":\\\"769448391\\\",\\\"collection\\\":{\\\"version\\\":5,\\\"type\\\":2,\\\"cid\\\":\\\"769448391\\\",\\\"indexBuckets\\\":8,\\\"deleted\\\":false,\\\"doCompact\\\":true,\\\"maximalSize\\\":1048576,\\\"name\\\":\\\"products\\\",\\\"isVolatile\\\":false,\\\"waitForSync\\\":false}}\\n{\\\"tick\\\":\\\"769841607\\\",\\\"type\\\":2300,\\\"database\\\":\\\"121287\\\",\\\"cid\\\":\\\"769448391\\\",\\\"tid\\\":\\\"0\\\",\\\"key\\\":\\\"p1\\\",\\\"rev\\\":\\\"769776071\\\",\\\"data\\\":{\\\"_key\\\":\\\"p1\\\",\\\"_rev\\\":\\\"769776071\\\",\\\"name\\\":\\\"flux compensator\\\"}}\\n\"\n

\n
", + "parameters": [ + { + "description": "Lower bound tick value for results.
", + "in": "query", + "name": "from", + "required": false, + "type": "number" + }, + { + "description": "Upper bound tick value for results.
", + "in": "query", + "name": "to", + "required": false, + "type": "number" + }, + { + "description": "Approximate maximum size of the returned result.
", + "in": "query", + "name": "chunkSize", + "required": false, + "type": "number" + }, + { + "description": "Include system collections in the result. The default value is true.
", + "in": "query", + "name": "includeSystem", + "required": false, + "type": "boolean" + } + ], + "responses": { + "200": { + "description": "is returned if the request was executed successfully, and there are log events available for the requested range. The response body will not be empty in this case.
" + }, + "204": { + "description": "is returned if the request was executed successfully, but there are no log events available for the requested range. The response body will be empty in this case.
" + }, + "400": { + "description": "is returned if either the from or to values are invalid.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + }, + "501": { + "description": "is returned when this operation is called on a coordinator in a cluster.
" + } + }, + "summary": " Returns log entries", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/logger-state": { + "get": { + "description": "\n\nReturns 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 body of the response contains a JSON object with the following attributes:
  • state: the current logger state as a JSON object 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.
    - totalEvents: total number of events logged since the server was started. The value is not reset between multiple stops and re-starts of the logger.
    - time: the current date and time on the logger server
  • server: a JSON object with the following sub-attributes:
    - version: the logger server's version
    - serverId: the logger server's id
  • clients: returns the last fetch status by replication clients connected to the logger. Each client is returned as a JSON object with the following attributes:
    - serverId: server id of client
    - lastServedTick: last tick value served to this client via the logger-follow API
    - time: date and time when this client last called the logger-follow API

Example: Returns the state of the replication logger.

shell> 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\" : \"771873223\", \n    \"totalEvents\" : 4761, \n    \"time\" : \"2015-09-30T15:40:17Z\" \n  }, \n  \"server\" : { \n    \"version\" : \"2.7.0-devel\", \n    \"serverId\" : \"4865533481307\" \n  }, \n  \"clients\" : [ ] \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned if the logger state could be determined successfully.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if the logger state could not be determined.
" + } + }, + "summary": " Return replication logger state", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/logger-tick-ranges": { + "get": { + "description": "\n\nReturns the currently available ranges of tick values for all currently available WAL logfiles. The tick values can be used to determine if certain data (identified by tick value) are still available for replication.
The body of the response contains a JSON array. Each array member is an object that describes a single logfile. Each object has the following attributes:
*datafile: name of the logfile
*status: status of the datafile, in textual form (e.g. \"sealed\", \"open\")
*tickMin: minimum tick value contained in logfile
*tickMax: maximum tick value contained in logfile

Example: Returns the available tick ranges.

shell> curl --dump - http://localhost:8529/_api/replication/logger-tick-ranges\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n  { \n    \"datafile\" : \"/tmp/vocdir.2239/journals/logfile-186823.db\", \n    \"status\" : \"collected\", \n    \"tickMin\" : \"383431\", \n    \"tickMax\" : \"642505159\" \n  }, \n  { \n    \"datafile\" : \"/tmp/vocdir.2239/journals/logfile-642636231.db\", \n    \"status\" : \"collected\", \n    \"tickMin\" : \"642963911\", \n    \"tickMax\" : \"645716423\" \n  }, \n  { \n    \"datafile\" : \"/tmp/vocdir.2239/journals/logfile-645847495.db\", \n    \"status\" : \"collected\", \n    \"tickMin\" : \"645978567\", \n    \"tickMax\" : \"766695879\" \n  }, \n  { \n    \"datafile\" : \"/tmp/vocdir.2239/journals/logfile-766826951.db\", \n    \"status\" : \"collected\", \n    \"tickMin\" : \"766958023\", \n    \"tickMax\" : \"767089095\" \n  }, \n  { \n    \"datafile\" : \"/tmp/vocdir.2239/journals/logfile-767220167.db\", \n    \"status\" : \"open\", \n    \"tickMin\" : \"767351239\", \n    \"tickMax\" : \"771873223\" \n  } \n]\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned if the tick ranges could be determined successfully.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if the logger state could not be determined.
" + }, + "501": { + "description": "is returned when this operation is called on a coordinator in a cluster.
" + } + }, + "summary": " Return the tick ranges available in the WAL logfiles", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/make-slave": { + "put": { + "description": "**A json post document with these Properties is required:**
  • username: an optional ArangoDB username to use when connecting to the master.
  • includeSystem: whether or not system collection operations will be applied
  • endpoint: the master endpoint to connect to (e.g. \"tcp://192.168.173.13:8529\").
  • verbose: if set to true, then a log line will be emitted for all operations performed by the replication applier. This should be used for debugging replication problems only.
  • connectTimeout: the timeout (in seconds) when attempting to connect to the endpoint. This value is used for each connection attempt.
  • database: the database name on the master (if not specified, defaults to the name of the local current database).
  • requireFromPresent: if set to true, then the replication applier will check at start of its continuous replication if the start tick from the dump phase is still present on the master. If not, then there would be data loss. If requireFromPresent is true, the replication applier will abort with an appropriate error message. If set to false, then the replication applier will still start, and ignore the data loss.
  • requestTimeout: the timeout (in seconds) for individual requests to the endpoint.
  • restrictType: an optional string value for collection filtering. When specified, the allowed values are include or exclude.
  • restrictCollections: an optional array of collections for use with restrictType. If restrictType is include, only the specified collections will be sychronised. If restrictType is exclude, all but the specified collections will be synchronized. of type string
  • adaptivePolling: whether or not the replication applier will use adaptive polling.
  • maxConnectRetries: the maximum number of connection attempts the applier will make in a row. If the applier cannot establish a connection to the endpoint in this number of attempts, it will stop itself.
  • password: the password to use when connecting to the master.
  • chunkSize: the requested maximum size for log transfer packets that is used when the endpoint is contacted.
\n\nStarts a full data synchronization from a remote endpoint into the local ArangoDB database and afterwards starts the continuous replication. The operation works on a per-database level.
All local database data will be removed prior to the synchronization.
In case of success, the body of the response is a JSON object with the following attributes:
  • state: a JSON object 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.
    - totalRequests: the total number of requests the applier has made to the endpoint.
    - totalFailedConnects: the total number of failed connection attempts the applier has made.
    - totalEvents: the total number of log events the applier has processed.
    - totalOperationsExcluded: the total number of log events excluded because of restrictCollections.
    - progress: a JSON object 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
    - failedConnects: the current number of failed connection attempts
    - lastError: a JSON object 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 object 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)
  • database: the name of the database the applier is connected to (if applier is active) or will connect to (if applier is currently inactive)
WARNING: calling this method will sychronize data from the collections found on the remote master to the local ArangoDB database. All data in the local collections will be purged and replaced with data from the master.
Use with caution!
Please also keep in mind that this command may take a long time to complete and return. This is because it will first do a full data synchronization with the master, which will take time roughly proportional to the amount of data.
Note: this method is not supported on a coordinator in a cluster.
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_put_api_replication_makeSlave" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "400": { + "description": "is returned if the configuration is incomplete or malformed.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred during sychronization or when starting the continuous replication.
" + }, + "501": { + "description": "is returned when this operation is called on a coordinator in a cluster.
" + } + }, + "summary": " Turn the server into a slave of another", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/server-id": { + "get": { + "description": "\n\nReturns the servers id. The id is also returned by other replication API methods, and this method is an easy means of determining a server's id.
The body of the response is a JSON object with the attribute serverId. The server id is returned as a string.

Example:

shell> curl --dump - http://localhost:8529/_api/replication/server-id\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"serverId\" : \"4865533481307\" \n}\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred while assembling the response.
" + } + }, + "summary": " Return server id", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/replication/sync": { + "put": { + "description": "**A json post document with these Properties is required:**
  • username: an optional ArangoDB username to use when connecting to the endpoint.
  • includeSystem: whether or not system collection operations will be applied
  • endpoint: the master endpoint to connect to (e.g. \"tcp://192.168.173.13:8529\").
  • database: the database name on the master (if not specified, defaults to the name of the local current database).
  • restrictType: an optional string value for collection filtering. When specified, the allowed values are include or exclude.
  • incremental: if set to true, then an incremental synchronization method will be used for synchronizing data in collections. This method is useful when collections already exist locally, and only the remaining differences need to be transferred from the remote endpoint. In this case, the incremental synchronization can be faster than a full synchronization. The default value is false, meaning that the complete data from the remote collection will be transferred.
  • restrictCollections: an optional array of collections for use with restrictType. If restrictType is include, only the specified collections will be sychronised. If restrictType is exclude, all but the specified collections will be synchronized. of type string
  • password: the password to use when connecting to the endpoint.
\n\nStarts a full data synchronization from a remote endpoint into the local ArangoDB database.
The sync method can be used by replication clients to connect an ArangoDB database to a remote endpoint, fetch the remote list of collections and indexes, and collection data. It will thus create a local backup of the state of data at the remote ArangoDB database. sync works on a per-database level.
sync will first fetch the list of collections and indexes from the remote endpoint. It does so by calling the inventory API of the remote database. It will then purge data in the local ArangoDB database, and after start will transfer collection data from the remote database to the local ArangoDB database. It will extract data from the remote database by calling the remote database's dump API until all data are fetched.
In case of success, the body of the response is a JSON object with the following attributes:
  • collections: an array of collections that were transferred from the endpoint
  • lastLogTick: the last log tick on the endpoint at the time the transfer was started. Use this value as the from value when starting the continuous synchronization later.
WARNING: calling this method will sychronize data from the collections found on the remote endpoint to the local ArangoDB database. All data in the local collections will be purged and replaced with data from the endpoint.
Use with caution!
Note: this method is not supported on a coordinator in a cluster.
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_put_api_replication_synchronize" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned if the request was executed successfully.
" + }, + "400": { + "description": "is returned if the configuration is incomplete or malformed.
" + }, + "405": { + "description": "is returned when an invalid HTTP method is used.
" + }, + "500": { + "description": "is returned if an error occurred during sychronization.
" + }, + "501": { + "description": "is returned when this operation is called on a coordinator in a cluster.
" + } + }, + "summary": " Synchronize data from a remote endpoint", + "tags": [ + "Replication" + ], + "x-examples": [], + "x-filename": "Replication - arangod/RestHandler/RestReplicationHandler.cpp" + } + }, + "/_api/simple/all": { + "put": { + "description": "free style json body\n\n
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 [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

Example: Limit the amount of documents using limit

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/all <<EOF\n{ \"collection\": \"products\", \"skip\": 2, \"limit\" : 2 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"Hello3\" : \"World3\", \n      \"_id\" : \"products/774887879\", \n      \"_rev\" : \"774887879\", \n      \"_key\" : \"774887879\" \n    }, \n    { \n      \"Hello4\" : \"World4\", \n      \"_id\" : \"products/775215559\", \n      \"_rev\" : \"775215559\", \n      \"_key\" : \"775215559\" \n    } \n  ], \n  \"hasMore\" : false, \n  \"count\" : 2, \n  \"cached\" : false, \n  \"extra\" : { \n    \"stats\" : { \n      \"writesExecuted\" : 0, \n      \"writesIgnored\" : 0, \n      \"scannedFull\" : 5, \n      \"scannedIndex\" : 0, \n      \"filtered\" : 0 \n    }, \n    \"warnings\" : [ ] \n  }, \n  \"error\" : false, \n  \"code\" : 201 \n}\n

\n
Example: Using a batchSize value

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/all <<EOF\n{ \"collection\": \"products\", \"batchSize\" : 3 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"Hello2\" : \"World2\", \n      \"_id\" : \"products/772594119\", \n      \"_rev\" : \"772594119\", \n      \"_key\" : \"772594119\" \n    }, \n    { \n      \"Hello1\" : \"World1\", \n      \"_id\" : \"products/772266439\", \n      \"_rev\" : \"772266439\", \n      \"_key\" : \"772266439\" \n    }, \n    { \n      \"Hello5\" : \"World5\", \n      \"_id\" : \"products/773577159\", \n      \"_rev\" : \"773577159\", \n      \"_key\" : \"773577159\" \n    } \n  ], \n  \"hasMore\" : true, \n  \"id\" : \"773773767\", \n  \"count\" : 5, \n  \"extra\" : { \n    \"stats\" : { \n      \"writesExecuted\" : 0, \n      \"writesIgnored\" : 0, \n      \"scannedFull\" : 5, \n      \"scannedIndex\" : 0, \n      \"filtered\" : 0 \n    }, \n    \"warnings\" : [ ] \n  }, \n  \"cached\" : false, \n  \"error\" : false, \n  \"code\" : 201 \n}\n

\n
", + "parameters": [ + { + "description": "Contains the query.
", + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "additionalProperties": {}, + "type": "object" + }, + "x-description-offset": 0 + } + ], + "responses": { + "201": { + "description": "is returned if the query was executed successfully.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Return all documents", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/any": { + "put": { + "description": "\n\n
Returns a random document from a collection. The call expects a JSON object as body with the following attributes:
**A json post document with these Properties is required:**
  • 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 document attrbute contains null.

Example:

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_any" + }, + "x-description-offset": 185 + } + ], + "responses": { + "200": { + "description": "is returned if the query was executed successfully.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Return a random document", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/by-example": { + "put": { + "description": "**A json post document with these Properties is required:**
  • 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)
  • example: The example document.
  • collection: The name of the collection to query.
\n\n
This will find all documents matching a given example.
Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

Example: Matching an attribute

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example <<EOF\n{ \n  \"collection\" : \"products\", \n  \"example\" : { \n    \"i\" : 1 \n  } \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/779082183\", \n      \"_key\" : \"779082183\", \n      \"_rev\" : \"779082183\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 2, \n        \"j\" : 2 \n      } \n    }, \n    { \n      \"_id\" : \"products/778295751\", \n      \"_key\" : \"778295751\", \n      \"_rev\" : \"778295751\", \n      \"i\" : 1, \n      \"a\" : { \n        \"k\" : 1, \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/778885575\", \n      \"_key\" : \"778885575\", \n      \"_rev\" : \"778885575\", \n      \"i\" : 1 \n    }, \n    { \n      \"_id\" : \"products/778623431\", \n      \"_key\" : \"778623431\", \n      \"_rev\" : \"778623431\", \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
Example: Matching an attribute which is a sub-document

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example <<EOF\n{ \n  \"collection\" : \"products\", \n  \"example\" : { \n    \"a.j\" : 1 \n  } \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/780589511\", \n      \"_key\" : \"780589511\", \n      \"_rev\" : \"780589511\", \n      \"i\" : 1, \n      \"a\" : { \n        \"j\" : 1 \n      } \n    }, \n    { \n      \"_id\" : \"products/780261831\", \n      \"_key\" : \"780261831\", \n      \"_rev\" : \"780261831\", \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
Example: Matching an attribute within a sub-document

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example <<EOF\n{ \n  \"collection\" : \"products\", \n  \"example\" : { \n    \"a\" : { \n      \"j\" : 1 \n    } \n  } \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/782555591\", \n      \"_key\" : \"782555591\", \n      \"_rev\" : \"782555591\", \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
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_by_example" + }, + "x-description-offset": 59 + } + ], + "responses": { + "201": { + "description": "is returned if the query was executed successfully.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Simple query by-example", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/first": { + "put": { + "description": "**A json post document with these Properties is required:**
  • count: the number of documents to return at most. Specifying count is optional. If it is not specified, it defaults to 1.
  • collection: the name of the collection
\n\n
This will return the first document(s) from the collection, in the order of insertion/update time. When the count argument is supplied, the result will be an array of documents, with the \"oldest\" document being first in the result array. If the count argument is not supplied, the result is the \"oldest\" document of the collection, or null if the collection is empty.
Note: this method is not supported for sharded collections with more than one shard.

Example: Retrieving the first n documents

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

\n
Example: Retrieving the first document

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_first" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned when the query was successfully executed.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " First document of a collection", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/first-example": { + "put": { + "description": "**A json post document with these Properties is required:**
  • example: The example document.
  • collection: The name of the collection to query.
\n\n
This will return the first document matching a given example.
Returns a result containing the document or HTTP 404 if no document matched the example.
If more than one document in the collection matches the specified example, only one of these documents will be returned, and it is undefined which of the matching documents is returned.

Example: If a matching document was found

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

\n
Example: If no document was found

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_first_example" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned when the query was successfully executed.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Find documents matching an example", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/fulltext": { + "put": { + "description": "**A json post document with these Properties is required:**
  • index: The identifier of the fulltext-index to use.
  • attribute: The attribute that contains the texts.
  • collection: The name of the collection to query.
  • limit: The maximal amount of documents to return. The skip is applied before the limit restriction. (optional)
  • skip: The number of documents to skip in the query (optional).
  • query: The fulltext query. Please refer to [Fulltext queries](../SimpleQueries/FulltextQueries.html) for details.
\n\n
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.
Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.
Note: the fulltext simple query is deprecated as of ArangoDB 2.6. This API may be removed in future versions of ArangoDB. The preferred way for retrieving documents from a collection using the near operator is to issue an AQL query using the FULLTEXT [AQL function](../Aql/FulltextFunctions.md) as follows:

FOR doc IN FULLTEXT(@@collection, @attributeName, @queryString, @limit) RETURN doc

Example:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/fulltext <<EOF\n{ \n  \"collection\" : \"products\", \n  \"attribute\" : \"text\", \n  \"query\" : \"word\" \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : [ \n    { \n      \"_id\" : \"products/791009735\", \n      \"_key\" : \"791009735\", \n      \"_rev\" : \"791009735\", \n      \"text\" : \"this text contains word\" \n    }, \n    { \n      \"_id\" : \"products/791206343\", \n      \"_key\" : \"791206343\", \n      \"_rev\" : \"791206343\", \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
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_fulltext" + }, + "x-description-offset": 59 + } + ], + "responses": { + "201": { + "description": "is returned if the query was executed successfully.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Fulltext index query", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/last": { + "put": { + "description": "**A json post document with these Properties is required:**
  • count: the number of documents to return at most. Specifying count is optional. If it is not specified, it defaults to 1.
  • collection: the name of the collection
\n\n
This will return the last documents from the collection, in the order of insertion/update time. When the count argument is supplied, the result will be an array of documents, with the \"latest\" document being first in the result array.
If the count argument is not supplied, the result is the \"latest\" document of the collection, or null if the collection is empty.
Note: this method is not supported for sharded collections with more than one shard.

Example: Retrieving the last n documents

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

\n
Example: Retrieving the first document

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_last" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned when the query was successfully executed.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Last document of a collection", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/lookup-by-keys": { + "put": { + "description": "**A json post document with these Properties is required:**
  • keys: array with the _keys of documents to remove. of type string
  • collection: The name of the collection to look in for the documents
\n\nLooks up the documents in the specified collection using the array of keys provided. All documents for which a matching key was specified in the keys array and that exist in the collection will be returned. Keys for which no document can be found in the underlying collection are ignored, and no exception will be thrown for them.
The body of the response contains a JSON object with a documents attribute. The documents attribute is an array containing the matching documents. The order in which matching documents are present in the result array is unspecified.

Example: Looking up existing documents

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/lookup-by-keys <<EOF\n{ \n  \"keys\" : [ \n    \"test0\", \n    \"test1\", \n    \"test2\", \n    \"test3\", \n    \"test4\", \n    \"test5\", \n    \"test6\", \n    \"test7\", \n    \"test8\", \n    \"test9\" \n  ], \n  \"collection\" : \"test\" \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"documents\" : [ \n    { \n      \"value\" : 0, \n      \"_id\" : \"test/test0\", \n      \"_rev\" : \"795597255\", \n      \"_key\" : \"test0\" \n    }, \n    { \n      \"value\" : 1, \n      \"_id\" : \"test/test1\", \n      \"_rev\" : \"795793863\", \n      \"_key\" : \"test1\" \n    }, \n    { \n      \"value\" : 2, \n      \"_id\" : \"test/test2\", \n      \"_rev\" : \"795990471\", \n      \"_key\" : \"test2\" \n    }, \n    { \n      \"value\" : 3, \n      \"_id\" : \"test/test3\", \n      \"_rev\" : \"796187079\", \n      \"_key\" : \"test3\" \n    }, \n    { \n      \"value\" : 4, \n      \"_id\" : \"test/test4\", \n      \"_rev\" : \"796383687\", \n      \"_key\" : \"test4\" \n    }, \n    { \n      \"value\" : 5, \n      \"_id\" : \"test/test5\", \n      \"_rev\" : \"796580295\", \n      \"_key\" : \"test5\" \n    }, \n    { \n      \"value\" : 6, \n      \"_id\" : \"test/test6\", \n      \"_rev\" : \"796776903\", \n      \"_key\" : \"test6\" \n    }, \n    { \n      \"value\" : 7, \n      \"_id\" : \"test/test7\", \n      \"_rev\" : \"796973511\", \n      \"_key\" : \"test7\" \n    }, \n    { \n      \"value\" : 8, \n      \"_id\" : \"test/test8\", \n      \"_rev\" : \"797170119\", \n      \"_key\" : \"test8\" \n    }, \n    { \n      \"value\" : 9, \n      \"_id\" : \"test/test9\", \n      \"_rev\" : \"797366727\", \n      \"_key\" : \"test9\" \n    } \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Looking up non-existing documents

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/lookup-by-keys <<EOF\n{ \n  \"keys\" : [ \n    \"foo\", \n    \"bar\", \n    \"baz\" \n  ], \n  \"collection\" : \"test\" \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"documents\" : [ ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n

", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/RestLookupByKeys" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned if the operation was carried out successfully.
" + }, + "404": { + "description": "is returned if the collection was not found. The response body contains an error document in this case.
" + }, + "405": { + "description": "is returned if the operation was called with a different HTTP METHOD than PUT.
" + } + }, + "summary": " Find documents by their keys", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/near": { + "put": { + "description": "**A json post document with these Properties is required:**
  • distance: If given, the attribute key used to return the distance to the given coordinate. (optional). If specified, distances are returned in meters.
  • skip: The number of documents to skip in the query. (optional)
  • longitude: The longitude of the coordinate.
  • limit: The maximal amount of documents to return. The skip is applied before the limit restriction. The default is 100. (optional)
  • collection: The name of the collection to query.
  • latitude: The latitude of the coordinate.
  • geo: If given, the identifier of the geo-index to use. (optional)
\n\n
The default will find at most 100 documents near the given coordinate. The returned array is sorted according to the distance, with the nearest document being first in the return array. If there are near documents of equal distance, documents are chosen randomly from this set until the limit is reached.
In order to use the near operator, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more than one geo-spatial index, you can use the geo field to select a particular index.

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.
Note: the near simple query is deprecated as of ArangoDB 2.6. This API may be removed in future versions of ArangoDB. The preferred way for retrieving documents from a collection using the near operator is to issue an [AQL query](../Aql/GeoFunctions.md) using the NEAR function as follows:

FOR doc IN NEAR(@@collection, @latitude, @longitude, @limit) RETURN doc`

Example: Without distance

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

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_near" + }, + "x-description-offset": 59 + } + ], + "responses": { + "201": { + "description": "is returned if the query was executed successfully.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Returns documents near a coordinate", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/range": { + "put": { + "description": "**A json post document with these Properties is required:**
  • right: The upper bound.
  • attribute: The attribute path to check.
  • collection: The name of the collection to query.
  • limit: The maximal amount of documents to return. The skip is applied before the limit restriction. (optional)
  • closed: If true, use interval including left and right, otherwise exclude right, but include left.
  • skip: The number of documents to skip in the query (optional).
  • left: The lower bound.
\n\n
This will find all documents within a given range. In order to execute a range query, a skip-list index on the queried attribute must be present.
Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.
Note: the range simple query is deprecated as of ArangoDB 2.6. The function may be removed in future versions of ArangoDB. The preferred way for retrieving documents from a collection within a specific range is to use an AQL query as follows:

FOR doc IN @@collection FILTER doc.value >= @left && doc.value < @right LIMIT @skip, @limit RETURN doc`

Example:

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_range" + }, + "x-description-offset": 59 + } + ], + "responses": { + "201": { + "description": "is returned if the query was executed successfully.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown or no suitable index for the range query is present. The response body contains an error document in this case.
" + } + }, + "summary": " Simple range query", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/remove-by-example": { + "put": { + "description": "**A json post document with these Properties is required:**
  • example: An example document that all collection documents are compared against.
  • collection: The name of the collection to remove from.
  • options: a json object which can contains following attributes:
    • limit: an optional value that determines how many documents to delete at most. If limit is specified but is less than the number of documents in the collection, it is undefined which of the documents will be deleted.
    • waitForSync: if set to true, then all removal operations will instantly be synchronized to disk. If this is not specified, then the collection's default sync behavior will be applied.
\n\n
This will find all documents in the collection that match the specified example object.
Note: the limit attribute is not supported on sharded collections. Using it will result in an error.
Returns the number of documents that were deleted.

Example:

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

\n
Example: Using Parameter: waitForSync and limit

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

\n
Example: Using Parameter: waitForSync and limit with new signature

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_remove_by_example" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned if the query was executed successfully.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Remove documents by example", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/remove-by-keys": { + "put": { + "description": "**A json post document with these Properties is required:**
  • keys: array with the _keys of documents to remove. of type string
  • options: a json object which can contains following attributes:
    • waitForSync: if set to true, then all removal operations will instantly be synchronized to disk. If this is not specified, then the collection's default sync behavior will be applied.
  • collection: The name of the collection to look in for the documents to remove
\n\nLooks up the documents in the specified collection using the array of keys provided, and removes all documents from the collection whose keys are contained in the keys array. Keys for which no document can be found in the underlying collection are ignored, and no exception will be thrown for them.
The body of the response contains a JSON object with information how many documents were removed (and how many were not). The removed attribute will contain the number of actually removed documents. The ignored attribute will contain the number of keys in the request for which no matching document could be found.

Example:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-keys <<EOF\n{ \n  \"keys\" : [ \n    \"test0\", \n    \"test1\", \n    \"test2\", \n    \"test3\", \n    \"test4\", \n    \"test5\", \n    \"test6\", \n    \"test7\", \n    \"test8\", \n    \"test9\" \n  ], \n  \"collection\" : \"test\" \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"removed\" : 10, \n  \"ignored\" : 0, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-keys <<EOF\n{ \n  \"keys\" : [ \n    \"foo\", \n    \"bar\", \n    \"baz\" \n  ], \n  \"collection\" : \"test\" \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"removed\" : 0, \n  \"ignored\" : 3, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n

", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/RestRemoveByKeys" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned if the operation was carried out successfully. The number of removed documents may still be 0 in this case if none of the specified document keys were found in the collection.
" + }, + "404": { + "description": "is returned if the collection was not found. The response body contains an error document in this case.
" + }, + "405": { + "description": "is returned if the operation was called with a different HTTP METHOD than PUT.
" + } + }, + "summary": " Remove documents by their keys", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/replace-by-example": { + "put": { + "description": "**A json post document with these Properties is required:**
  • options: a json object which can contain following attributes
    • limit: an optional value that determines how many documents to replace at most. If limit is specified but is less than the number of documents in the collection, it is undefined which of the documents will be replaced.

    • waitForSync: if set to true, then all removal operations will instantly be synchronized to disk. If this is not specified, then the collection's default sync behavior will be applied.
  • example: An example document that all collection documents are compared against.
  • collection: The name of the collection to replace within.
  • newValue: The replacement document that will get inserted in place of the \"old\" documents.
\n\n
This will find all documents in the collection that match the specified example object, and replace the entire document body with the new value specified. Note that document meta-attributes such as _id, _key, _from, _to etc. cannot be replaced.
Note: the limit attribute is not supported on sharded collections. Using it will result in an error.
Returns the number of documents that were replaced.

Example:

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

\n
Example: Using new Signature for attributes WaitForSync and limit

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_replace_by_example" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned if the query was executed successfully.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Replace documents by example", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/update-by-example": { + "put": { + "description": "**A json post document with these Properties is required:**
  • options: a json object which can contains following attributes:
    • keepNull: This parameter can be used to modify the behavior when handling null values. Normally, null values are stored in the database. By setting the keepNull parameter to false, this behavior can be changed so that all attributes in data with null values will be removed from the updated document.
    • limit: an optional value that determines how many documents to update at most. If limit is specified but is less than the number of documents in the collection, it is undefined which of the documents will be updated.
    • waitForSync: if set to true, then all removal operations will instantly be synchronized to disk. If this is not specified, then the collection's default sync behavior will be applied.
  • example: An example document that all collection documents are compared against.
  • collection: The name of the collection to update within.
  • newValue: A document containing all the attributes to update in the found documents.
\n\n
This will find all documents in the collection that match the specified example object, and partially update the document body with the new value specified. Note that document meta-attributes such as _id, _key, _from, _to etc. cannot be replaced.
Note: the limit attribute is not supported on sharded collections. Using it will result in an error.
Returns the number of documents that were updated.


Example: using old syntax for options

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

\n
Example: using new signature for options

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_update_by_example" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "is returned if the collection was updated successfully and waitForSync was true.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Update documents by example", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/within": { + "put": { + "description": "**A json post document with these Properties is required:**
  • distance: If given, the attribute key used to return the distance to the given coordinate. (optional). If specified, distances are returned in meters.
  • skip: The number of documents to skip in the query. (optional)
  • longitude: The longitude of the coordinate.
  • radius: The maximal radius (in meters).
  • collection: The name of the collection to query.
  • latitude: The latitude of the coordinate.
  • 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)
\n\n
This will find all documents within a given radius around the coordinate (latitude, longitude). The returned list is sorted by distance.
In order to use the within operator, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more than one geo-spatial index, you can use the geo field to select a particular index.

Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.
Note: the within simple query is deprecated as of ArangoDB 2.6. This API may be removed in future versions of ArangoDB. The preferred way for retrieving documents from a collection using the near operator is to issue an [AQL query](../Aql/GeoFunctions.md) using the WITHIN function as follows:

FOR doc IN WITHIN(@@collection, @latitude, @longitude, @radius, @distanceAttributeName) RETURN doc

Example: Without distance

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

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_within" + }, + "x-description-offset": 59 + } + ], + "responses": { + "201": { + "description": "is returned if the query was executed successfully.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Find documents within a radius around a coordinate", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/simple/within-rectangle": { + "put": { + "description": "**A json post document with these Properties is required:**
  • latitude1: The latitude of the first rectangle coordinate.
  • skip: The number of documents to skip in the query. (optional)
  • latitude2: The latitude of the second rectangle coordinate.
  • longitude2: The longitude of the second rectangle coordinate.
  • longitude1: The longitude of the first rectangle coordinate.
  • limit: The maximal amount of documents to return. The skip is applied before the limit restriction. The default is 100. (optional)
  • collection: The name of the collection to query.
  • geo: If given, the identifier of the geo-index to use. (optional)
\n\n
This will find all documents within the specified rectangle (determined by the given coordinates (latitude1, longitude1, latitude2, longitude2).
In order to use the within-rectangle query, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more than one geo-spatial index, you can use the geo field to select a particular index.
Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details.

Example:

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

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSA_put_api_simple_within_rectangle" + }, + "x-description-offset": 59 + } + ], + "responses": { + "201": { + "description": "is returned if the query was executed successfully.
" + }, + "400": { + "description": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case.
" + }, + "404": { + "description": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
" + } + }, + "summary": " Within rectangle query", + "tags": [ + "Simple Queries" + ], + "x-examples": [], + "x-filename": "Simple Queries - js/actions/api-simple.js, arangod/RestHandler/RestSimpleHandler.cpp, arangod/RestHandler/RestSimpleQueryHandler.cpp" + } + }, + "/_api/tasks": { + "post": { + "description": "**A json post document with these Properties is required:**
  • params: The parameters to be passed into command
  • offset: Number of seconds initial delay
  • command: The JavaScript code to be executed
  • name: The name of the task
  • period: number of seconds between the executions
\n\ncreates a new task with a generated id

Example:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/tasks/ <<EOF\n{ \n  \"name\" : \"SampleTask\", \n  \"command\" : \"(function(params) { require('internal').print(params); })(params)\", \n  \"params\" : { \n    \"foo\" : \"bar\", \n    \"bar\" : \"foo\" \n  }, \n  \"period\" : 2 \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"836884935\", \n  \"name\" : \"SampleTask\", \n  \"type\" : \"periodic\", \n  \"period\" : 2, \n  \"created\" : 1443627622.01888, \n  \"command\" : \"(function(params) { require('internal').print(params); })(params)\", \n  \"database\" : \"_system\", \n  \"error\" : false, \n  \"code\" : 200 \n}\nshell> curl -X DELETE --dump - http://localhost:8529/_api/tasks/836884935\n\n

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_new_tasks" + }, + "x-description-offset": 59 + } + ], + "responses": { + "400": { + "description": "If the post body is not accurate, a HTTP 400 is returned.
" + } + }, + "summary": " creates a task", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_api/tasks/": { + "get": { + "description": "\n\nfetches all existing tasks on the server

Example: Fetching all tasks

shell> curl --dump - http://localhost:8529/_api/tasks\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n  { \n    \"id\" : \"16898503\", \n    \"name\" : \"user-defined task\", \n    \"type\" : \"periodic\", \n    \"period\" : 1, \n    \"created\" : 1443627553.436199, \n    \"command\" : \"(function () {\\n      require('org/arangodb/foxx/queues/manager').manage();\\n    })(params)\", \n    \"database\" : \"_system\" \n  }, \n  { \n    \"id\" : \"statistics-gc\", \n    \"name\" : \"statistics-gc\", \n    \"type\" : \"periodic\", \n    \"period\" : 450, \n    \"created\" : 1443627552.94918, \n    \"command\" : \"require('org/arangodb/statistics').garbageCollector();\", \n    \"database\" : \"_system\" \n  }, \n  { \n    \"id\" : \"statistics-average-collector\", \n    \"name\" : \"statistics-average-collector\", \n    \"type\" : \"periodic\", \n    \"period\" : 900, \n    \"created\" : 1443627552.946052, \n    \"command\" : \"require('org/arangodb/statistics').historianAverage();\", \n    \"database\" : \"_system\" \n  }, \n  { \n    \"id\" : \"statistics-collector\", \n    \"name\" : \"statistics-collector\", \n    \"type\" : \"periodic\", \n    \"period\" : 10, \n    \"created\" : 1443627552.945114, \n    \"command\" : \"require('org/arangodb/statistics').historian();\", \n    \"database\" : \"_system\" \n  } \n]\n

\n
", + "parameters": [], + "responses": { + "200": { + "description": "The list of tasks
" + } + }, + "summary": " Fetch all tasks or one task", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_api/tasks/{id}": { + "delete": { + "description": "\n\nDeletes the task identified by id on the server.

Example: trying to delete non existing task

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

\n
Example: Remove existing Task

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

\n
", + "parameters": [ + { + "description": "The id of the task to delete.
", + "format": "string", + "in": "path", + "name": "id", + "required": true, + "type": "string" + } + ], + "responses": { + "404": { + "description": "If the task id is unknown, then an HTTP 404 is returned.
" + } + }, + "summary": " deletes the task with id", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + }, + "get": { + "description": "\n\nfetches one existing tasks on the server specified by id

Example: Fetching a single task by its id

shell> curl --dump - http://localhost:8529/_api/tasks/statistics-average-collector\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"statistics-average-collector\", \n  \"name\" : \"statistics-average-collector\", \n  \"type\" : \"periodic\", \n  \"period\" : 900, \n  \"created\" : 1443627552.946052, \n  \"command\" : \"require('org/arangodb/statistics').historianAverage();\", \n  \"database\" : \"_system\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: trying to fetch a non-existing task

shell> curl --dump - http://localhost:8529/_api/tasks/non-existing-task\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 404, \n  \"errorNum\" : 1852, \n  \"errorMessage\" : \"task not found\" \n}\n

\n
", + "parameters": [ + { + "description": "The id of the task to fetch.
", + "format": "string", + "in": "path", + "name": "id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested task
" + } + }, + "summary": " Fetch one task with id", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + }, + "put": { + "description": "**A json post document with these Properties is required:**
  • params: The parameters to be passed into command
  • offset: Number of seconds initial delay
  • command: The JavaScript code to be executed
  • name: The name of the task
  • period: number of seconds between the executions
\n\nregisters a new task with the specified id

Example:

shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/tasks/sampleTask <<EOF\n{ \n  \"id\" : \"SampleTask\", \n  \"name\" : \"SampleTask\", \n  \"command\" : \"(function(params) { require('internal').print(params); })(params)\", \n  \"params\" : { \n    \"foo\" : \"bar\", \n    \"bar\" : \"foo\" \n  }, \n  \"period\" : 2 \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"sampleTask\", \n  \"name\" : \"SampleTask\", \n  \"type\" : \"periodic\", \n  \"period\" : 2, \n  \"created\" : 1443627622.623117, \n  \"command\" : \"(function(params) { require('internal').print(params); })(params)\", \n  \"database\" : \"_system\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
", + "parameters": [ + { + "description": "The id of the task to create
", + "format": "string", + "in": "path", + "name": "id", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_put_api_new_tasks" + }, + "x-description-offset": 59 + } + ], + "responses": { + "400": { + "description": "If the task id already exists or the rest body is not accurate, HTTP 400 is returned.
" + } + }, + "summary": " creates a task with id", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + }, + "/_api/transaction": { + "post": { + "description": "**A json post document with these Properties is required:**
  • 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.
  • params: optional arguments passed to action.
  • collections: contains the array of collections to be used in the transaction (mandatory). collections must be a JSON object that can have the optional sub-attributes read and write. read and write must each be either arrays of collections names or strings with a single collection name.
  • 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.
  • waitForSync: an optional boolean flag that, if set, will force the transaction to write all data to disk before returning.
\n\n
Contains the collections and action.
The transaction description must be passed in the body of the POST request.
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.

Example: Executing a transaction on a single collection

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/transaction <<EOF\n{ \n  \"collections\" : { \n    \"write\" : \"products\" \n  }, \n  \"action\" : \"function () { var db = require('internal').db; db.products.save({});  return db.products.count(); }\" \n}\nEOF\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
Example: Executing a transaction using multiple collections

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/transaction <<EOF\n{ \n  \"collections\" : { \n    \"write\" : [ \n      \"products\", \n      \"materials\" \n    ] \n  }, \n  \"action\" : \"function () {var db = require('internal').db;db.products.save({});db.materials.save({});return 'worked!';}\" \n}\nEOF\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
Example: Aborting a transaction due to an internal error

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/transaction <<EOF\n{ \n  \"collections\" : { \n    \"write\" : \"products\" \n  }, \n  \"action\" : \"function () {var db = require('internal').db;db.products.save({ _key: 'abc'});db.products.save({ _key: 'abc'});}\" \n}\nEOF\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"exception\" : \"[ArangoError 1210: unique constraint violated]\", \n  \"stacktrace\" : [ \n    \"[ArangoError 1210: unique constraint violated]\", \n    \"  at Error (native)\", \n    \"  at eval (<anonymous>:1:99)\", \n    \"  at eval (<anonymous>:1:122)\", \n    \"  at post_api_transaction (js/actions/api-transaction.js:268:16)\", \n    \"  at Function.actions.defineHttp.callback (js/actions/api-transaction.js:288:11)\" \n  ], \n  \"message\" : \"unique constraint violated\", \n  \"error\" : true, \n  \"code\" : 400, \n  \"errorNum\" : 1210, \n  \"errorMessage\" : \"unique constraint violated\" \n}\n

\n
Example: Aborting a transaction by explicitly throwing an exception

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

\n
Example: Referring to a non-existing collection

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/transaction <<EOF\n{ \n  \"collections\" : { \n    \"read\" : \"products\" \n  }, \n  \"action\" : \"function () { return true; }\" \n}\nEOF\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"exception\" : \"[ArangoError 1203: collection not found]\", \n  \"stacktrace\" : [ \n    \"[ArangoError 1203: collection not found]\", \n    \"  at Error (native)\", \n    \"  at post_api_transaction (js/actions/api-transaction.js:268:16)\", \n    \"  at Function.actions.defineHttp.callback (js/actions/api-transaction.js:288:11)\" \n  ], \n  \"message\" : \"collection not found\", \n  \"error\" : true, \n  \"code\" : 404, \n  \"errorNum\" : 1203, \n  \"errorMessage\" : \"collection not found\" \n}\n

\n
", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_post_api_transaction" + }, + "x-description-offset": 59 + } + ], + "responses": { + "200": { + "description": "If the transaction is fully executed and committed on the server, HTTP 200 will be returned.
" + }, + "400": { + "description": "If the transaction specification is either missing or malformed, the server will respond with HTTP 400.
" + }, + "404": { + "description": "If the transaction specification contains an unknown collection, the server will respond with HTTP 404.
" + }, + "500": { + "description": "Exceptions thrown by users will make the server respond with a return code of HTTP 500
" + } + }, + "summary": " Execute transaction", + "tags": [ + "Transactions" + ], + "x-examples": [], + "x-filename": "Transactions - js/actions/api-transaction.js" + } + }, + "/_api/traversal": { + "post": { + "description": "\n\nStarts a traversal starting from a given vertex and following. edges contained in a given edgeCollection. The request must contain the following attributes.
**A json post document with these Properties is required:**
  • sort: body (JavaScript) code of a custom comparison function for the edges. The signature of this function is (l, r) -> integer (where l and r are edges) and must return -1 if l is smaller than, +1 if l is greater than, and 0 if l and r are equal. The reason for this is the following: The order of edges returned for a certain vertex is undefined. This is because there is no natural order of edges for a vertex with multiple connected edges. To explicitly define the order in which edges on the vertex are followed, you can specify an edge comparator function with this attribute. Note that the value here has to be a string to conform to the JSON standard, which in turn is parsed as function body on the server side. Furthermore note that this attribute is only used for the standard expanders. If you use your custom expander you have to do the sorting yourself within the expander code.
  • direction: direction for traversal
    • if set, must be either \"outbound\", \"inbound\", or \"any\"
    • if not set, the expander attribute must be specified
  • minDepth: ANDed with any existing filters): visits only nodes in at least the given depth
  • startVertex: id of the startVertex, e.g. \"users/foo\".
  • visitor: body (JavaScript) code of custom visitor function function signature: (config, result, vertex, path, connected) -> void The visitor function can do anything, but its return value is ignored. To populate a result, use the result variable by reference. Note that the connected argument is only populated when the order attribute is set to \"preorder-expander\".
  • itemOrder: item iteration order can be \"forward\" or \"backward\"
  • strategy: traversal strategy can be \"depthfirst\" or \"breadthfirst\"
  • filter: 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.
  • init: body (JavaScript) code of custom result initialization function function signature: (config, result) -> void initialize any values in result with what is required
  • maxIterations: 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.
  • maxDepth: ANDed with any existing filters visits only nodes in at most the given depth
  • uniqueness: specifies uniqueness for vertices and edges visited if set, must be an object like this:
    \"uniqueness\": {\"vertices\": \"none\"|\"global\"|\"path\", \"edges\": \"none\"|\"global\"|\"path\"}
  • order: traversal order can be \"preorder\", \"postorder\" or \"preorder-expander\"
  • graphName: name of the graph that contains the edges. Either edgeCollection or graphName has to be given. In case both values are set the graphName is prefered.
  • expander: 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
  • edgeCollection: name of the collection that contains the edges.
\n\n
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

Example: 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


shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"outbound\" \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"890100167\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"890296775\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/charlie\", \n          \"_key\" : \"charlie\", \n          \"_rev\" : \"890558919\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"890755527\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"890100167\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/891214279\", \n              \"_key\" : \"891214279\", \n              \"_rev\" : \"891214279\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"890100167\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"890296775\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/891214279\", \n              \"_key\" : \"891214279\", \n              \"_rev\" : \"891214279\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/891410887\", \n              \"_key\" : \"891410887\", \n              \"_rev\" : \"891410887\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/charlie\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"890100167\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"890296775\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/charlie\", \n              \"_key\" : \"charlie\", \n              \"_rev\" : \"890558919\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/891214279\", \n              \"_key\" : \"891214279\", \n              \"_rev\" : \"891214279\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/891607495\", \n              \"_key\" : \"891607495\", \n              \"_rev\" : \"891607495\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"890100167\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"890296775\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"890755527\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Follow only inbound edges

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"inbound\" \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"871619015\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/eve\", \n          \"_key\" : \"eve\", \n          \"_rev\" : \"872470983\", \n          \"name\" : \"Eve\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"871619015\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/873322951\", \n              \"_key\" : \"873322951\", \n              \"_rev\" : \"873322951\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"871619015\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"872470983\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Follow any direction of edges

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"any\", \n  \"uniqueness\" : { \n    \"vertices\" : \"none\", \n    \"edges\" : \"global\" \n  } \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"841537991\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/eve\", \n          \"_key\" : \"eve\", \n          \"_rev\" : \"842389959\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"841734599\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"841537991\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/charlie\", \n          \"_key\" : \"charlie\", \n          \"_rev\" : \"841996743\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"842193351\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"841537991\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/843241927\", \n              \"_key\" : \"843241927\", \n              \"_rev\" : \"843241927\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"841537991\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"842389959\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/843241927\", \n              \"_key\" : \"843241927\", \n              \"_rev\" : \"843241927\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/843438535\", \n              \"_key\" : \"843438535\", \n              \"_rev\" : \"843438535\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"841537991\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"842389959\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"841734599\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/843241927\", \n              \"_key\" : \"843241927\", \n              \"_rev\" : \"843241927\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/843438535\", \n              \"_key\" : \"843438535\", \n              \"_rev\" : \"843438535\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/842652103\", \n              \"_key\" : \"842652103\", \n              \"_rev\" : \"842652103\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"841537991\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"842389959\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"841734599\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"841537991\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/843241927\", \n              \"_key\" : \"843241927\", \n              \"_rev\" : \"843241927\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/843438535\", \n              \"_key\" : \"843438535\", \n              \"_rev\" : \"843438535\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/842848711\", \n              \"_key\" : \"842848711\", \n              \"_rev\" : \"842848711\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/charlie\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"841537991\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"842389959\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"841734599\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/charlie\", \n              \"_key\" : \"charlie\", \n              \"_rev\" : \"841996743\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/843241927\", \n              \"_key\" : \"843241927\", \n              \"_rev\" : \"843241927\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/843438535\", \n              \"_key\" : \"843438535\", \n              \"_rev\" : \"843438535\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/843045319\", \n              \"_key\" : \"843045319\", \n              \"_rev\" : \"843045319\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"841537991\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"842389959\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"841734599\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"842193351\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Excluding Charlie and Bob

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"outbound\", \n  \"filter\" : \"if (vertex.name === \\\"Bob\\\" ||     vertex.name === \\\"Charlie\\\") {  return \\\"exclude\\\";}return;\" \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"863427015\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"864082375\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"863427015\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/864541127\", \n              \"_key\" : \"864541127\", \n              \"_rev\" : \"864541127\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/864934343\", \n              \"_key\" : \"864934343\", \n              \"_rev\" : \"864934343\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"863427015\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"863623623\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"864082375\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Do not follow edges from Bob

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"outbound\", \n  \"filter\" : \"if (vertex.name === \\\"Bob\\\") {return \\\"prune\\\";}return;\" \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"867686855\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"867883463\", \n          \"name\" : \"Bob\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"867686855\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/868800967\", \n              \"_key\" : \"868800967\", \n              \"_rev\" : \"868800967\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"867686855\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"867883463\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Visit only nodes in a depth of at least 2

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"outbound\", \n  \"minDepth\" : 2 \n}\nEOF\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/charlie\", \n          \"_key\" : \"charlie\", \n          \"_rev\" : \"886299079\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"886495687\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/886954439\", \n              \"_key\" : \"886954439\", \n              \"_rev\" : \"886954439\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/887151047\", \n              \"_key\" : \"887151047\", \n              \"_rev\" : \"887151047\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/charlie\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"885840327\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"886036935\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/charlie\", \n              \"_key\" : \"charlie\", \n              \"_rev\" : \"886299079\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/886954439\", \n              \"_key\" : \"886954439\", \n              \"_rev\" : \"886954439\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/887347655\", \n              \"_key\" : \"887347655\", \n              \"_rev\" : \"887347655\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"885840327\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"886036935\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"886495687\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Visit only nodes in a depth of at most 1

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"outbound\", \n  \"maxDepth\" : 1 \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"875616711\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"875813319\", \n          \"name\" : \"Bob\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"875616711\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/876730823\", \n              \"_key\" : \"876730823\", \n              \"_rev\" : \"876730823\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"875616711\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"875813319\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Using a visitor function to return vertex ids only

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"outbound\", \n  \"visitor\" : \"result.visited.vertices.push(vertex._id);\" \n}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"result\" : { \n    \"visited\" : { \n      \"vertices\" : [ \n        \"persons/alice\", \n        \"persons/bob\", \n        \"persons/charlie\", \n        \"persons/dave\" \n      ], \n      \"paths\" : [ ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Count all visited nodes and return a list of nodes only

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"outbound\", \n  \"init\" : \"result.visited = 0; result.myVertices = [ ];\", \n  \"visitor\" : \"result.visited++; result.myVertices.push(vertex);\" \n}\nEOF\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/alice\", \n        \"_key\" : \"alice\", \n        \"_rev\" : \"900323783\", \n        \"name\" : \"Alice\" \n      }, \n      { \n        \"_id\" : \"persons/bob\", \n        \"_key\" : \"bob\", \n        \"_rev\" : \"900520391\", \n        \"name\" : \"Bob\" \n      }, \n      { \n        \"_id\" : \"persons/charlie\", \n        \"_key\" : \"charlie\", \n        \"_rev\" : \"900782535\", \n        \"name\" : \"Charlie\" \n      }, \n      { \n        \"_id\" : \"persons/dave\", \n        \"_key\" : \"dave\", \n        \"_rev\" : \"900979143\", \n        \"name\" : \"Dave\" \n      } \n    ] \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Expand only inbound edges of Alice and outbound edges of Eve

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"expander\" : \"var connections = [ ];if (vertex.name === \\\"Alice\\\") {config.datasource.getInEdges(vertex).forEach(function (e) {connections.push({ vertex: require(\\\"internal\\\").db._document(e._from), edge: e});});}if (vertex.name === \\\"Eve\\\") {config.datasource.getOutEdges(vertex).forEach(function (e) {connections.push({vertex: require(\\\"internal\\\").db._document(e._to), edge: e});});}return connections;\" \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"904583623\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/eve\", \n          \"_key\" : \"eve\", \n          \"_rev\" : \"905435591\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"904780231\", \n          \"name\" : \"Bob\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"904583623\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/906287559\", \n              \"_key\" : \"906287559\", \n              \"_rev\" : \"906287559\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"904583623\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"905435591\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/906287559\", \n              \"_key\" : \"906287559\", \n              \"_rev\" : \"906287559\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/906484167\", \n              \"_key\" : \"906484167\", \n              \"_rev\" : \"906484167\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"904583623\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"905435591\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"904780231\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Follow the depthfirst strategy

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"any\", \n  \"strategy\" : \"depthfirst\" \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"852482503\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/eve\", \n          \"_key\" : \"eve\", \n          \"_rev\" : \"853334471\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"852679111\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"852482503\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/charlie\", \n          \"_key\" : \"charlie\", \n          \"_rev\" : \"852941255\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"853137863\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"852679111\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/eve\", \n          \"_key\" : \"eve\", \n          \"_rev\" : \"853334471\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"852482503\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/charlie\", \n          \"_key\" : \"charlie\", \n          \"_rev\" : \"852941255\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"853137863\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/854186439\", \n              \"_key\" : \"854186439\", \n              \"_rev\" : \"854186439\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"853334471\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/854186439\", \n              \"_key\" : \"854186439\", \n              \"_rev\" : \"854186439\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/854383047\", \n              \"_key\" : \"854383047\", \n              \"_rev\" : \"854383047\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"853334471\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"852679111\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/854186439\", \n              \"_key\" : \"854186439\", \n              \"_rev\" : \"854186439\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/854383047\", \n              \"_key\" : \"854383047\", \n              \"_rev\" : \"854383047\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/853596615\", \n              \"_key\" : \"853596615\", \n              \"_rev\" : \"853596615\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"853334471\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"852679111\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/854186439\", \n              \"_key\" : \"854186439\", \n              \"_rev\" : \"854186439\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/854383047\", \n              \"_key\" : \"854383047\", \n              \"_rev\" : \"854383047\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/853793223\", \n              \"_key\" : \"853793223\", \n              \"_rev\" : \"853793223\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/charlie\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"853334471\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"852679111\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/charlie\", \n              \"_key\" : \"charlie\", \n              \"_rev\" : \"852941255\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/854186439\", \n              \"_key\" : \"854186439\", \n              \"_rev\" : \"854186439\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/854383047\", \n              \"_key\" : \"854383047\", \n              \"_rev\" : \"854383047\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/853989831\", \n              \"_key\" : \"853989831\", \n              \"_rev\" : \"853989831\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"853334471\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"852679111\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"853137863\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/853596615\", \n              \"_key\" : \"853596615\", \n              \"_rev\" : \"853596615\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"852679111\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/853596615\", \n              \"_key\" : \"853596615\", \n              \"_rev\" : \"853596615\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/854383047\", \n              \"_key\" : \"854383047\", \n              \"_rev\" : \"854383047\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"852679111\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"853334471\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/853596615\", \n              \"_key\" : \"853596615\", \n              \"_rev\" : \"853596615\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/854383047\", \n              \"_key\" : \"854383047\", \n              \"_rev\" : \"854383047\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/854186439\", \n              \"_key\" : \"854186439\", \n              \"_rev\" : \"854186439\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"852679111\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"853334471\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/853596615\", \n              \"_key\" : \"853596615\", \n              \"_rev\" : \"853596615\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/853793223\", \n              \"_key\" : \"853793223\", \n              \"_rev\" : \"853793223\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/charlie\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"852679111\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/charlie\", \n              \"_key\" : \"charlie\", \n              \"_rev\" : \"852941255\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/853596615\", \n              \"_key\" : \"853596615\", \n              \"_rev\" : \"853596615\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/853989831\", \n              \"_key\" : \"853989831\", \n              \"_rev\" : \"853989831\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"852482503\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"852679111\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"853137863\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Using postorder ordering

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"any\", \n  \"order\" : \"postorder\" \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"894360007\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/charlie\", \n          \"_key\" : \"charlie\", \n          \"_rev\" : \"894818759\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"895015367\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"894556615\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/eve\", \n          \"_key\" : \"eve\", \n          \"_rev\" : \"895211975\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"894360007\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/eve\", \n          \"_key\" : \"eve\", \n          \"_rev\" : \"895211975\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/charlie\", \n          \"_key\" : \"charlie\", \n          \"_rev\" : \"894818759\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"895015367\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"894556615\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"894360007\", \n          \"name\" : \"Alice\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/896063943\", \n              \"_key\" : \"896063943\", \n              \"_rev\" : \"896063943\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/896260551\", \n              \"_key\" : \"896260551\", \n              \"_rev\" : \"896260551\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/895474119\", \n              \"_key\" : \"895474119\", \n              \"_rev\" : \"895474119\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"895211975\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"894556615\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/896063943\", \n              \"_key\" : \"896063943\", \n              \"_rev\" : \"896063943\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/896260551\", \n              \"_key\" : \"896260551\", \n              \"_rev\" : \"896260551\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/895670727\", \n              \"_key\" : \"895670727\", \n              \"_rev\" : \"895670727\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/charlie\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"895211975\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"894556615\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/charlie\", \n              \"_key\" : \"charlie\", \n              \"_rev\" : \"894818759\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/896063943\", \n              \"_key\" : \"896063943\", \n              \"_rev\" : \"896063943\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/896260551\", \n              \"_key\" : \"896260551\", \n              \"_rev\" : \"896260551\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/895867335\", \n              \"_key\" : \"895867335\", \n              \"_rev\" : \"895867335\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"895211975\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"894556615\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"895015367\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/896063943\", \n              \"_key\" : \"896063943\", \n              \"_rev\" : \"896063943\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/896260551\", \n              \"_key\" : \"896260551\", \n              \"_rev\" : \"896260551\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"895211975\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"894556615\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/896063943\", \n              \"_key\" : \"896063943\", \n              \"_rev\" : \"896063943\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"895211975\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/895474119\", \n              \"_key\" : \"895474119\", \n              \"_rev\" : \"895474119\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/896260551\", \n              \"_key\" : \"896260551\", \n              \"_rev\" : \"896260551\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/896063943\", \n              \"_key\" : \"896063943\", \n              \"_rev\" : \"896063943\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"894556615\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"895211975\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/895474119\", \n              \"_key\" : \"895474119\", \n              \"_rev\" : \"895474119\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/896260551\", \n              \"_key\" : \"896260551\", \n              \"_rev\" : \"896260551\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"894556615\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"895211975\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/895474119\", \n              \"_key\" : \"895474119\", \n              \"_rev\" : \"895474119\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/895670727\", \n              \"_key\" : \"895670727\", \n              \"_rev\" : \"895670727\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/charlie\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"894556615\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/charlie\", \n              \"_key\" : \"charlie\", \n              \"_rev\" : \"894818759\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/895474119\", \n              \"_key\" : \"895474119\", \n              \"_rev\" : \"895474119\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/895867335\", \n              \"_key\" : \"895867335\", \n              \"_rev\" : \"895867335\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"894556615\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"895015367\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/895474119\", \n              \"_key\" : \"895474119\", \n              \"_rev\" : \"895474119\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"894556615\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"894360007\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: Using backward item-ordering:

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"any\", \n  \"itemOrder\" : \"backward\" \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"846518727\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"846715335\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"847174087\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/charlie\", \n          \"_key\" : \"charlie\", \n          \"_rev\" : \"846977479\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/eve\", \n          \"_key\" : \"eve\", \n          \"_rev\" : \"847370695\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"846518727\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/eve\", \n          \"_key\" : \"eve\", \n          \"_rev\" : \"847370695\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"846715335\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"847174087\", \n          \"name\" : \"Dave\" \n        }, \n        { \n          \"_id\" : \"persons/charlie\", \n          \"_key\" : \"charlie\", \n          \"_rev\" : \"846977479\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"846518727\", \n          \"name\" : \"Alice\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/847632839\", \n              \"_key\" : \"847632839\", \n              \"_rev\" : \"847632839\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"846715335\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/847632839\", \n              \"_key\" : \"847632839\", \n              \"_rev\" : \"847632839\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/848026055\", \n              \"_key\" : \"848026055\", \n              \"_rev\" : \"848026055\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"846715335\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"847174087\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/847632839\", \n              \"_key\" : \"847632839\", \n              \"_rev\" : \"847632839\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/847829447\", \n              \"_key\" : \"847829447\", \n              \"_rev\" : \"847829447\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/charlie\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"846715335\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/charlie\", \n              \"_key\" : \"charlie\", \n              \"_rev\" : \"846977479\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/847632839\", \n              \"_key\" : \"847632839\", \n              \"_rev\" : \"847632839\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/848419271\", \n              \"_key\" : \"848419271\", \n              \"_rev\" : \"848419271\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"846715335\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"847370695\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/847632839\", \n              \"_key\" : \"847632839\", \n              \"_rev\" : \"847632839\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/848419271\", \n              \"_key\" : \"848419271\", \n              \"_rev\" : \"848419271\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/848222663\", \n              \"_key\" : \"848222663\", \n              \"_rev\" : \"848222663\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"846715335\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"847370695\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/848222663\", \n              \"_key\" : \"848222663\", \n              \"_rev\" : \"848222663\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"847370695\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/848222663\", \n              \"_key\" : \"848222663\", \n              \"_rev\" : \"848222663\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/848419271\", \n              \"_key\" : \"848419271\", \n              \"_rev\" : \"848419271\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"847370695\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"846715335\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/848222663\", \n              \"_key\" : \"848222663\", \n              \"_rev\" : \"848222663\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/848419271\", \n              \"_key\" : \"848419271\", \n              \"_rev\" : \"848419271\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/848026055\", \n              \"_key\" : \"848026055\", \n              \"_rev\" : \"848026055\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"847370695\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"846715335\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"847174087\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/848222663\", \n              \"_key\" : \"848222663\", \n              \"_rev\" : \"848222663\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/848419271\", \n              \"_key\" : \"848419271\", \n              \"_rev\" : \"848419271\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/847829447\", \n              \"_key\" : \"847829447\", \n              \"_rev\" : \"847829447\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/charlie\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"847370695\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"846715335\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/charlie\", \n              \"_key\" : \"charlie\", \n              \"_rev\" : \"846977479\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/848222663\", \n              \"_key\" : \"848222663\", \n              \"_rev\" : \"848222663\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/848419271\", \n              \"_key\" : \"848419271\", \n              \"_rev\" : \"848419271\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/847632839\", \n              \"_key\" : \"847632839\", \n              \"_rev\" : \"847632839\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"847370695\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"846715335\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"846518727\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

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

shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"any\", \n  \"uniqueness\" : { \n    \"vertices\" : \"none\", \n    \"edges\" : \"global\" \n  } \n}\nEOF\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/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"858446279\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/eve\", \n          \"_key\" : \"eve\", \n          \"_rev\" : \"859298247\", \n          \"name\" : \"Eve\" \n        }, \n        { \n          \"_id\" : \"persons/bob\", \n          \"_key\" : \"bob\", \n          \"_rev\" : \"858642887\", \n          \"name\" : \"Bob\" \n        }, \n        { \n          \"_id\" : \"persons/alice\", \n          \"_key\" : \"alice\", \n          \"_rev\" : \"858446279\", \n          \"name\" : \"Alice\" \n        }, \n        { \n          \"_id\" : \"persons/charlie\", \n          \"_key\" : \"charlie\", \n          \"_rev\" : \"858905031\", \n          \"name\" : \"Charlie\" \n        }, \n        { \n          \"_id\" : \"persons/dave\", \n          \"_key\" : \"dave\", \n          \"_rev\" : \"859101639\", \n          \"name\" : \"Dave\" \n        } \n      ], \n      \"paths\" : [ \n        { \n          \"edges\" : [ ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"858446279\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/860150215\", \n              \"_key\" : \"860150215\", \n              \"_rev\" : \"860150215\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"858446279\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"859298247\", \n              \"name\" : \"Eve\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/860150215\", \n              \"_key\" : \"860150215\", \n              \"_rev\" : \"860150215\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/860346823\", \n              \"_key\" : \"860346823\", \n              \"_rev\" : \"860346823\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"858446279\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"859298247\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"858642887\", \n              \"name\" : \"Bob\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/860150215\", \n              \"_key\" : \"860150215\", \n              \"_rev\" : \"860150215\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/860346823\", \n              \"_key\" : \"860346823\", \n              \"_rev\" : \"860346823\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/859560391\", \n              \"_key\" : \"859560391\", \n              \"_rev\" : \"859560391\", \n              \"_from\" : \"persons/alice\", \n              \"_to\" : \"persons/bob\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"858446279\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"859298247\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"858642887\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"858446279\", \n              \"name\" : \"Alice\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/860150215\", \n              \"_key\" : \"860150215\", \n              \"_rev\" : \"860150215\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/860346823\", \n              \"_key\" : \"860346823\", \n              \"_rev\" : \"860346823\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/859756999\", \n              \"_key\" : \"859756999\", \n              \"_rev\" : \"859756999\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/charlie\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"858446279\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"859298247\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"858642887\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/charlie\", \n              \"_key\" : \"charlie\", \n              \"_rev\" : \"858905031\", \n              \"name\" : \"Charlie\" \n            } \n          ] \n        }, \n        { \n          \"edges\" : [ \n            { \n              \"_id\" : \"knows/860150215\", \n              \"_key\" : \"860150215\", \n              \"_rev\" : \"860150215\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/alice\" \n            }, \n            { \n              \"_id\" : \"knows/860346823\", \n              \"_key\" : \"860346823\", \n              \"_rev\" : \"860346823\", \n              \"_from\" : \"persons/eve\", \n              \"_to\" : \"persons/bob\" \n            }, \n            { \n              \"_id\" : \"knows/859953607\", \n              \"_key\" : \"859953607\", \n              \"_rev\" : \"859953607\", \n              \"_from\" : \"persons/bob\", \n              \"_to\" : \"persons/dave\" \n            } \n          ], \n          \"vertices\" : [ \n            { \n              \"_id\" : \"persons/alice\", \n              \"_key\" : \"alice\", \n              \"_rev\" : \"858446279\", \n              \"name\" : \"Alice\" \n            }, \n            { \n              \"_id\" : \"persons/eve\", \n              \"_key\" : \"eve\", \n              \"_rev\" : \"859298247\", \n              \"name\" : \"Eve\" \n            }, \n            { \n              \"_id\" : \"persons/bob\", \n              \"_key\" : \"bob\", \n              \"_rev\" : \"858642887\", \n              \"name\" : \"Bob\" \n            }, \n            { \n              \"_id\" : \"persons/dave\", \n              \"_key\" : \"dave\", \n              \"_rev\" : \"859101639\", \n              \"name\" : \"Dave\" \n            } \n          ] \n        } \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n

\n
Example: 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


shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF\n{ \n  \"startVertex\" : \"persons/alice\", \n  \"graphName\" : \"knows_graph\", \n  \"direction\" : \"any\", \n  \"uniqueness\" : { \n    \"vertices\" : \"none\", \n    \"edges\" : \"none\" \n  }, \n  \"maxIterations\" : 5 \n}\nEOF\n\nHTTP/1.1 500 Internal Server Error\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"error\" : true, \n  \"code\" : 500, \n  \"errorNum\" : 1909, \n  \"errorMessage\" : \"too many iterations - try increasing the value of 'maxIterations'\" \n}\n

\n

", + "parameters": [ + { + "in": "body", + "name": "Json Post Body", + "required": true, + "schema": { + "$ref": "#/definitions/JSF_HTTP_API_TRAVERSAL" + }, + "x-description-offset": 222 + } + ], + "responses": { + "200": { + "description": "If the traversal is fully executed HTTP 200 will be returned.
" + }, + "400": { + "description": "If the traversal specification is either missing or malformed, the server will respond with HTTP 400.
" + }, + "404": { + "description": "The server will responded with HTTP 404 if the specified edge collection does not exist, or the specified start vertex cannot be found.
" + }, + "500": { + "description": "The server will responded with HTTP 500 when an error occurs inside the traversal or if a traversal performs more than maxIterations iterations.
" + } + }, + "summary": "executes a traversal", + "tags": [ + "Graph Traversal" + ], + "x-examples": [], + "x-filename": "Graph Traversal - js/actions/api-traversal.js" + } + }, + "/_api/user": { + "post": { + "description": "\n\n
The following data need to be passed in a JSON representation in the body of the POST request:
  • user: The name of the user as a string. This is mandatory.
  • passwd: The user password as a string. If no password is specified, the empty string will be used. If you pass the special value ARANGODB_DEFAULT_ROOT_PASSWORD, the password will be set the value stored in the environment variable `ARANGODB_DEFAULT_ROOT_PASSWORD`. This can be used to pass an instance variable into ArangoDB. For example, the instance identifier from Amazon.
  • active: An optional flag that specifies whether the user is active. If not specified, this will default to true
  • extra: An optional JSON object with arbitrary extra data about the user
  • changePassword: An optional flag that specifies whethers the user must change the password or not. If not specified, this will default to false. If set to true, the only operations allowed are PUT /_api/user or PATCH /_api/user. All other operations executed by the user will result in an HTTP 403.
If the user can be added by the server, the server will respond with HTTP 201. In case of success, the returned JSON object has the following properties:
  • error: Boolean flag to indicate that an error occurred (false in this case)
  • code: The HTTP status code
In case of error, 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
", + "parameters": [], + "responses": { + "201": { + "description": "Returned if the user can be added by the server
" + }, + "400": { + "description": "If the JSON representation is malformed or mandatory data is missing from the request.

" + } + }, + "summary": " Create User", + "tags": [ + "User handling" + ], + "x-examples": [], + "x-filename": "User handling - js/actions/_api/user/app.js" + } + }, + "/_api/user/": { + "get": { + "description": "\n\n
Fetches data about all users.
The call will return a JSON object with at least the following attributes on success:
  • user: The name of the user as a string.
  • active: An optional flag that specifies whether the user is active.
  • extra: An optional JSON object with arbitrary extra data about the user.
  • changePassword: An optional flag that specifies whether the user must change the password or not.
", + "parameters": [], + "responses": { + "200": { + "description": "The users that were found

" + } + }, + "summary": " List available Users", + "tags": [ + "User handling" + ], + "x-examples": [], + "x-filename": "User handling - js/actions/_api/user/app.js" + } + }, + "/_api/user/{user}": { + "delete": { + "description": "\n\n
Removes an existing user, identified by user.
If the user can be removed, the server will respond with HTTP 202. In case of success, the returned JSON object has the following properties:
  • error: Boolean flag to indicate that an error occurred (false in this case)
  • code: The HTTP status code
In case of error, 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
", + "parameters": [ + { + "description": "The name of the user
", + "format": "string", + "in": "path", + "name": "user", + "required": true, + "type": "string" + } + ], + "responses": { + "202": { + "description": "Is returned if the user was removed by the server
" + }, + "404": { + "description": "The specified user does not exist

" + } + }, + "summary": " Remove User", + "tags": [ + "User handling" + ], + "x-examples": [], + "x-filename": "User handling - js/actions/_api/user/app.js" + }, + "get": { + "description": "\n\n
Fetches data about the specified user.
The call will return a JSON object with at least the following attributes on success:
  • user: The name of the user as a string.
  • active: An optional flag that specifies whether the user is active.
  • extra: An optional JSON object with arbitrary extra data about the user.
  • changePassword: An optional flag that specifies whether the user must change the password or not.
", + "parameters": [ + { + "description": "The name of the user
", + "format": "string", + "in": "path", + "name": "user", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The user was found
" + }, + "404": { + "description": "The user with the specified name does not exist

" + } + }, + "summary": " Fetch User", + "tags": [ + "User handling" + ], + "x-examples": [], + "x-filename": "User handling - js/actions/_api/user/app.js" + }, + "patch": { + "description": "\n\n
Partially updates the data of an existing user. The name of an existing user must be specified in user.
The following data can be passed in a JSON representation in the body of the POST request:
  • passwd: The user password as a string. Specifying a password is optional. If not specified, the previously existing value will not be modified.
  • active: An optional flag that specifies whether the user is active. If not specified, the previously existing value will not be modified.
  • extra: An optional JSON object with arbitrary extra data about the user. If not specified, the previously existing value will not be modified.
  • changePassword: An optional flag that specifies whether the user must change the password or not. If not specified, the previously existing value will not be modified.
If the user can be updated by the server, the server will respond with HTTP 200.
In case of success, the returned JSON object has the following properties:
  • error: Boolean flag to indicate that an error occurred (false in this case)
  • code: The HTTP status code
In case of error, 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
", + "parameters": [ + { + "description": "The name of the user
", + "format": "string", + "in": "path", + "name": "user", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Is returned if the user data can be replaced by the server
" + }, + "400": { + "description": "The JSON representation is malformed or mandatory data is missing from the request
" + }, + "404": { + "description": "The specified user does not exist

" + } + }, + "summary": " Update User", + "tags": [ + "User handling" + ], + "x-examples": [], + "x-filename": "User handling - js/actions/_api/user/app.js" + }, + "put": { + "description": "\n\n
Replaces the data of an existing user. The name of an existing user must be specified in user.
The following data can to be passed in a JSON representation in the body of the POST request:
  • passwd: The user password as a string. Specifying a password is mandatory, but the empty string is allowed for passwords
  • active: An optional flag that specifies whether the user is active. If not specified, this will default to true
  • extra: An optional JSON object with arbitrary extra data about the user
  • changePassword: An optional flag that specifies whether the user must change the password or not. If not specified, this will default to false
If the user can be replaced by the server, the server will respond with HTTP 200.
In case of success, the returned JSON object has the following properties:
  • error: Boolean flag to indicate that an error occurred (false in this case)
  • code: The HTTP status code
In case of error, 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
", + "parameters": [ + { + "description": "The name of the user
", + "format": "string", + "in": "path", + "name": "user", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Is returned if the user data can be replaced by the server
" + }, + "400": { + "description": "The JSON representation is malformed or mandatory data is missing from the request
" + }, + "404": { + "description": "The specified user does not exist

" + } + }, + "summary": " Replace User", + "tags": [ + "User handling" + ], + "x-examples": [], + "x-filename": "User handling - js/actions/_api/user/app.js" + } + }, + "/_api/version": { + "get": { + "description": "\n\nReturns the server name and version number. The response is a JSON object with the following attributes:
**A json document with these Properties is returned:**
  • version: the server version string. The string has the format \"major.*minor.*sub\". major and minor will be numeric, and sub may contain a number or a textual version.
  • details: an optional JSON object with additional details. This is returned only if the details URL parameter is set to true in the request.
  • server: will always contain arango

Example: Return the version information

shell> curl --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"server\" : \"arango\", \n  \"version\" : \"2.7.0-devel\" \n}\n

\n
Example: Return the version information with details

shell> curl --dump - http://localhost:8529/_api/version?details=true\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"server\" : \"arango\", \n  \"version\" : \"2.7.0-devel\", \n  \"details\" : { \n    \"architecture\" : \"64bit\", \n    \"build-date\" : \"2015-09-25 11:17:39\", \n    \"configure\" : \"'./configure' '--enable-relative' '--enable-maintainer-mode' '--with-backtrace' '--enable-v8-debug' 'CXXFLAGS=-O0 -ggdb -DDEBUG_CLUSTER_COMM' 'CFLAGS=-O0 -ggdb  -DDEBUG_CLUSTER_COMM'\", \n    \"env\" : \"CFLAGS='-O0 -ggdb  -DDEBUG_CLUSTER_COMM' CXXFLAGS='-O0 -ggdb -DDEBUG_CLUSTER_COMM'\", \n    \"fd-client-event-handler\" : \"poll\", \n    \"fd-setsize\" : \"1024\", \n    \"icu-version\" : \"54.1\", \n    \"libev-version\" : \"4.11\", \n    \"maintainer-mode\" : \"true\", \n    \"openssl-version\" : \"OpenSSL 1.0.2 22 Jan 2015\", \n    \"readline-version\" : \"6.3\", \n    \"repository-version\" : \"heads/devel-0-g43dd92bb4716d73c7128478b4a7cdb36fd200421\", \n    \"server-version\" : \"2.7.0-devel\", \n    \"sizeof int\" : \"4\", \n    \"sizeof void*\" : \"8\", \n    \"tcmalloc\" : \"false\", \n    \"v8-version\" : \"4.3.61\", \n    \"mode\" : \"standalone\" \n  } \n}\n

\n
", + "parameters": [ + { + "description": "If set to true, the response will contain a details attribute with additional information about included components and their versions. The attribute names and internals of the details object may vary depending on platform and ArangoDB version.
", + "in": "query", + "name": "details", + "required": false, + "type": "boolean" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "is returned in all cases.
", + "schema": { + "$ref": "#/definitions/JSF_get_api_return_rc_200" + }, + "x-description-offset": 165 + } + }, + "summary": " Return server version", + "tags": [ + "Administration" + ], + "x-examples": [], + "x-filename": "Administration - js/actions/_admin/app.js, js/actions/_admin/routing/app.js, js/actions/_admin/server/app.js, js/actions/_admin/database/app.js, arangod/RestHandler/RestShutdownHandler.cpp, arangod/RestHandler/RestAdminLogHandler.cpp, js/actions/api-tasks.js, js/actions/api-endpoint.js, arangod/RestHandler/RestVersionHandler.cpp, js/actions/api-system.js" + } + } + }, + "schemes": [ + "http" + ], + "swagger": "2.0" +} From 05155dece7a32143ed782de20ac026d5b4e99d9e Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Mon, 23 Sep 2019 00:55:07 -0400 Subject: [PATCH 03/13] Optimization: 5.735 => 5.489 --- .../internal/util/ValueTypeUtil.java | 606 +++++++++--------- 1 file changed, 301 insertions(+), 305 deletions(-) diff --git a/src/main/java/com/arangodb/velocypack/internal/util/ValueTypeUtil.java b/src/main/java/com/arangodb/velocypack/internal/util/ValueTypeUtil.java index 4292593..f3d0066 100644 --- a/src/main/java/com/arangodb/velocypack/internal/util/ValueTypeUtil.java +++ b/src/main/java/com/arangodb/velocypack/internal/util/ValueTypeUtil.java @@ -1,305 +1,301 @@ -/* - * DISCLAIMER - * - * Copyright 2016 ArangoDB GmbH, Cologne, Germany - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright holder is ArangoDB GmbH, Cologne, Germany - */ - -package com.arangodb.velocypack.internal.util; - -import java.util.HashMap; -import java.util.Map; - -import com.arangodb.velocypack.ValueType; - -/** - * @author Mark Vollmary - * - */ -public class ValueTypeUtil { - - private static final Map MAP; - - static { - MAP = new HashMap(); - - MAP.put((byte) 0x00, ValueType.NONE); - MAP.put((byte) 0x01, ValueType.ARRAY); - MAP.put((byte) 0x02, ValueType.ARRAY); - MAP.put((byte) 0x03, ValueType.ARRAY); - MAP.put((byte) 0x04, ValueType.ARRAY); - MAP.put((byte) 0x05, ValueType.ARRAY); - MAP.put((byte) 0x06, ValueType.ARRAY); - MAP.put((byte) 0x07, ValueType.ARRAY); - MAP.put((byte) 0x08, ValueType.ARRAY); - MAP.put((byte) 0x09, ValueType.ARRAY); - MAP.put((byte) 0x0a, ValueType.OBJECT); - MAP.put((byte) 0x0b, ValueType.OBJECT); - MAP.put((byte) 0x0c, ValueType.OBJECT); - MAP.put((byte) 0x0d, ValueType.OBJECT); - MAP.put((byte) 0x0e, ValueType.OBJECT); - MAP.put((byte) 0x0f, ValueType.OBJECT); - MAP.put((byte) 0x10, ValueType.OBJECT); - MAP.put((byte) 0x11, ValueType.OBJECT); - MAP.put((byte) 0x12, ValueType.OBJECT); - MAP.put((byte) 0x13, ValueType.ARRAY); - MAP.put((byte) 0x14, ValueType.OBJECT); - MAP.put((byte) 0x15, ValueType.NONE); - MAP.put((byte) 0x16, ValueType.NONE); - MAP.put((byte) 0x17, ValueType.ILLEGAL); - MAP.put((byte) 0x18, ValueType.NULL); - MAP.put((byte) 0x19, ValueType.BOOL); - MAP.put((byte) 0x1a, ValueType.BOOL); - MAP.put((byte) 0x1b, ValueType.DOUBLE); - MAP.put((byte) 0x1c, ValueType.UTC_DATE); - MAP.put((byte) 0x1d, ValueType.EXTERNAL); - MAP.put((byte) 0x1e, ValueType.MIN_KEY); - MAP.put((byte) 0x1f, ValueType.MAX_KEY); - MAP.put((byte) 0x20, ValueType.INT); - MAP.put((byte) 0x21, ValueType.INT); - MAP.put((byte) 0x22, ValueType.INT); - MAP.put((byte) 0x23, ValueType.INT); - MAP.put((byte) 0x24, ValueType.INT); - MAP.put((byte) 0x25, ValueType.INT); - MAP.put((byte) 0x26, ValueType.INT); - MAP.put((byte) 0x27, ValueType.INT); - MAP.put((byte) 0x28, ValueType.UINT); - MAP.put((byte) 0x29, ValueType.UINT); - MAP.put((byte) 0x2a, ValueType.UINT); - MAP.put((byte) 0x2b, ValueType.UINT); - MAP.put((byte) 0x2c, ValueType.UINT); - MAP.put((byte) 0x2d, ValueType.UINT); - MAP.put((byte) 0x2e, ValueType.UINT); - MAP.put((byte) 0x2f, ValueType.UINT); - MAP.put((byte) 0x30, ValueType.SMALLINT); - MAP.put((byte) 0x31, ValueType.SMALLINT); - MAP.put((byte) 0x32, ValueType.SMALLINT); - MAP.put((byte) 0x33, ValueType.SMALLINT); - MAP.put((byte) 0x34, ValueType.SMALLINT); - MAP.put((byte) 0x35, ValueType.SMALLINT); - MAP.put((byte) 0x36, ValueType.SMALLINT); - MAP.put((byte) 0x37, ValueType.SMALLINT); - MAP.put((byte) 0x38, ValueType.SMALLINT); - MAP.put((byte) 0x39, ValueType.SMALLINT); - MAP.put((byte) 0x3a, ValueType.SMALLINT); - MAP.put((byte) 0x3b, ValueType.SMALLINT); - MAP.put((byte) 0x3c, ValueType.SMALLINT); - MAP.put((byte) 0x3d, ValueType.SMALLINT); - MAP.put((byte) 0x3e, ValueType.SMALLINT); - MAP.put((byte) 0x3f, ValueType.SMALLINT); - MAP.put((byte) 0x40, ValueType.STRING); - MAP.put((byte) 0x41, ValueType.STRING); - MAP.put((byte) 0x42, ValueType.STRING); - MAP.put((byte) 0x43, ValueType.STRING); - MAP.put((byte) 0x44, ValueType.STRING); - MAP.put((byte) 0x45, ValueType.STRING); - MAP.put((byte) 0x46, ValueType.STRING); - MAP.put((byte) 0x47, ValueType.STRING); - MAP.put((byte) 0x48, ValueType.STRING); - MAP.put((byte) 0x49, ValueType.STRING); - MAP.put((byte) 0x4a, ValueType.STRING); - MAP.put((byte) 0x4b, ValueType.STRING); - MAP.put((byte) 0x4c, ValueType.STRING); - MAP.put((byte) 0x4d, ValueType.STRING); - MAP.put((byte) 0x4e, ValueType.STRING); - MAP.put((byte) 0x4f, ValueType.STRING); - MAP.put((byte) 0x50, ValueType.STRING); - MAP.put((byte) 0x51, ValueType.STRING); - MAP.put((byte) 0x52, ValueType.STRING); - MAP.put((byte) 0x53, ValueType.STRING); - MAP.put((byte) 0x54, ValueType.STRING); - MAP.put((byte) 0x55, ValueType.STRING); - MAP.put((byte) 0x56, ValueType.STRING); - MAP.put((byte) 0x57, ValueType.STRING); - MAP.put((byte) 0x58, ValueType.STRING); - MAP.put((byte) 0x59, ValueType.STRING); - MAP.put((byte) 0x5a, ValueType.STRING); - MAP.put((byte) 0x5b, ValueType.STRING); - MAP.put((byte) 0x5c, ValueType.STRING); - MAP.put((byte) 0x5d, ValueType.STRING); - MAP.put((byte) 0x5e, ValueType.STRING); - MAP.put((byte) 0x5f, ValueType.STRING); - MAP.put((byte) 0x60, ValueType.STRING); - MAP.put((byte) 0x61, ValueType.STRING); - MAP.put((byte) 0x62, ValueType.STRING); - MAP.put((byte) 0x63, ValueType.STRING); - MAP.put((byte) 0x64, ValueType.STRING); - MAP.put((byte) 0x65, ValueType.STRING); - MAP.put((byte) 0x66, ValueType.STRING); - MAP.put((byte) 0x67, ValueType.STRING); - MAP.put((byte) 0x68, ValueType.STRING); - MAP.put((byte) 0x69, ValueType.STRING); - MAP.put((byte) 0x6a, ValueType.STRING); - MAP.put((byte) 0x6b, ValueType.STRING); - MAP.put((byte) 0x6c, ValueType.STRING); - MAP.put((byte) 0x6d, ValueType.STRING); - MAP.put((byte) 0x6e, ValueType.STRING); - MAP.put((byte) 0x6f, ValueType.STRING); - MAP.put((byte) 0x70, ValueType.STRING); - MAP.put((byte) 0x71, ValueType.STRING); - MAP.put((byte) 0x72, ValueType.STRING); - MAP.put((byte) 0x73, ValueType.STRING); - MAP.put((byte) 0x74, ValueType.STRING); - MAP.put((byte) 0x75, ValueType.STRING); - MAP.put((byte) 0x76, ValueType.STRING); - MAP.put((byte) 0x77, ValueType.STRING); - MAP.put((byte) 0x78, ValueType.STRING); - MAP.put((byte) 0x79, ValueType.STRING); - MAP.put((byte) 0x7a, ValueType.STRING); - MAP.put((byte) 0x7b, ValueType.STRING); - MAP.put((byte) 0x7c, ValueType.STRING); - MAP.put((byte) 0x7d, ValueType.STRING); - MAP.put((byte) 0x7e, ValueType.STRING); - MAP.put((byte) 0x7f, ValueType.STRING); - MAP.put((byte) 0x80, ValueType.STRING); - MAP.put((byte) 0x81, ValueType.STRING); - MAP.put((byte) 0x82, ValueType.STRING); - MAP.put((byte) 0x83, ValueType.STRING); - MAP.put((byte) 0x84, ValueType.STRING); - MAP.put((byte) 0x85, ValueType.STRING); - MAP.put((byte) 0x86, ValueType.STRING); - MAP.put((byte) 0x87, ValueType.STRING); - MAP.put((byte) 0x88, ValueType.STRING); - MAP.put((byte) 0x89, ValueType.STRING); - MAP.put((byte) 0x8a, ValueType.STRING); - MAP.put((byte) 0x8b, ValueType.STRING); - MAP.put((byte) 0x8c, ValueType.STRING); - MAP.put((byte) 0x8d, ValueType.STRING); - MAP.put((byte) 0x8e, ValueType.STRING); - MAP.put((byte) 0x8f, ValueType.STRING); - MAP.put((byte) 0x90, ValueType.STRING); - MAP.put((byte) 0x91, ValueType.STRING); - MAP.put((byte) 0x92, ValueType.STRING); - MAP.put((byte) 0x93, ValueType.STRING); - MAP.put((byte) 0x94, ValueType.STRING); - MAP.put((byte) 0x95, ValueType.STRING); - MAP.put((byte) 0x96, ValueType.STRING); - MAP.put((byte) 0x97, ValueType.STRING); - MAP.put((byte) 0x98, ValueType.STRING); - MAP.put((byte) 0x99, ValueType.STRING); - MAP.put((byte) 0x9a, ValueType.STRING); - MAP.put((byte) 0x9b, ValueType.STRING); - MAP.put((byte) 0x9c, ValueType.STRING); - MAP.put((byte) 0x9d, ValueType.STRING); - MAP.put((byte) 0x9e, ValueType.STRING); - MAP.put((byte) 0x9f, ValueType.STRING); - MAP.put((byte) 0xa0, ValueType.STRING); - MAP.put((byte) 0xa1, ValueType.STRING); - MAP.put((byte) 0xa2, ValueType.STRING); - MAP.put((byte) 0xa3, ValueType.STRING); - MAP.put((byte) 0xa4, ValueType.STRING); - MAP.put((byte) 0xa5, ValueType.STRING); - MAP.put((byte) 0xa6, ValueType.STRING); - MAP.put((byte) 0xa7, ValueType.STRING); - MAP.put((byte) 0xa8, ValueType.STRING); - MAP.put((byte) 0xa9, ValueType.STRING); - MAP.put((byte) 0xaa, ValueType.STRING); - MAP.put((byte) 0xab, ValueType.STRING); - MAP.put((byte) 0xac, ValueType.STRING); - MAP.put((byte) 0xad, ValueType.STRING); - MAP.put((byte) 0xae, ValueType.STRING); - MAP.put((byte) 0xaf, ValueType.STRING); - MAP.put((byte) 0xb0, ValueType.STRING); - MAP.put((byte) 0xb1, ValueType.STRING); - MAP.put((byte) 0xb2, ValueType.STRING); - MAP.put((byte) 0xb3, ValueType.STRING); - MAP.put((byte) 0xb4, ValueType.STRING); - MAP.put((byte) 0xb5, ValueType.STRING); - MAP.put((byte) 0xb6, ValueType.STRING); - MAP.put((byte) 0xb7, ValueType.STRING); - MAP.put((byte) 0xb8, ValueType.STRING); - MAP.put((byte) 0xb9, ValueType.STRING); - MAP.put((byte) 0xba, ValueType.STRING); - MAP.put((byte) 0xbb, ValueType.STRING); - MAP.put((byte) 0xbc, ValueType.STRING); - MAP.put((byte) 0xbd, ValueType.STRING); - MAP.put((byte) 0xbe, ValueType.STRING); - MAP.put((byte) 0xbf, ValueType.STRING); - MAP.put((byte) 0xc0, ValueType.BINARY); - MAP.put((byte) 0xc1, ValueType.BINARY); - MAP.put((byte) 0xc2, ValueType.BINARY); - MAP.put((byte) 0xc3, ValueType.BINARY); - MAP.put((byte) 0xc4, ValueType.BINARY); - MAP.put((byte) 0xc5, ValueType.BINARY); - MAP.put((byte) 0xc6, ValueType.BINARY); - MAP.put((byte) 0xc7, ValueType.BINARY); - MAP.put((byte) 0xc8, ValueType.BCD); - MAP.put((byte) 0xc9, ValueType.BCD); - MAP.put((byte) 0xca, ValueType.BCD); - MAP.put((byte) 0xcb, ValueType.BCD); - MAP.put((byte) 0xcc, ValueType.BCD); - MAP.put((byte) 0xcd, ValueType.BCD); - MAP.put((byte) 0xce, ValueType.BCD); - MAP.put((byte) 0xcf, ValueType.BCD); - MAP.put((byte) 0xd0, ValueType.BCD); - MAP.put((byte) 0xd1, ValueType.BCD); - MAP.put((byte) 0xd2, ValueType.BCD); - MAP.put((byte) 0xd3, ValueType.BCD); - MAP.put((byte) 0xd4, ValueType.BCD); - MAP.put((byte) 0xd5, ValueType.BCD); - MAP.put((byte) 0xd6, ValueType.BCD); - MAP.put((byte) 0xd7, ValueType.BCD); - MAP.put((byte) 0xd8, ValueType.NONE); - MAP.put((byte) 0xd9, ValueType.NONE); - MAP.put((byte) 0xda, ValueType.NONE); - MAP.put((byte) 0xdb, ValueType.NONE); - MAP.put((byte) 0xdc, ValueType.NONE); - MAP.put((byte) 0xdd, ValueType.NONE); - MAP.put((byte) 0xde, ValueType.NONE); - MAP.put((byte) 0xdf, ValueType.NONE); - MAP.put((byte) 0xe0, ValueType.NONE); - MAP.put((byte) 0xe1, ValueType.NONE); - MAP.put((byte) 0xe2, ValueType.NONE); - MAP.put((byte) 0xe3, ValueType.NONE); - MAP.put((byte) 0xe4, ValueType.NONE); - MAP.put((byte) 0xe5, ValueType.NONE); - MAP.put((byte) 0xe6, ValueType.NONE); - MAP.put((byte) 0xe7, ValueType.NONE); - MAP.put((byte) 0xe8, ValueType.NONE); - MAP.put((byte) 0xe9, ValueType.NONE); - MAP.put((byte) 0xea, ValueType.NONE); - MAP.put((byte) 0xeb, ValueType.NONE); - MAP.put((byte) 0xec, ValueType.NONE); - MAP.put((byte) 0xed, ValueType.NONE); - MAP.put((byte) 0xee, ValueType.NONE); - MAP.put((byte) 0xef, ValueType.NONE); - MAP.put((byte) 0xf0, ValueType.CUSTOM); - MAP.put((byte) 0xf1, ValueType.CUSTOM); - MAP.put((byte) 0xf2, ValueType.CUSTOM); - MAP.put((byte) 0xf3, ValueType.CUSTOM); - MAP.put((byte) 0xf4, ValueType.CUSTOM); - MAP.put((byte) 0xf5, ValueType.CUSTOM); - MAP.put((byte) 0xf6, ValueType.CUSTOM); - MAP.put((byte) 0xf7, ValueType.CUSTOM); - MAP.put((byte) 0xf8, ValueType.CUSTOM); - MAP.put((byte) 0xf9, ValueType.CUSTOM); - MAP.put((byte) 0xfa, ValueType.CUSTOM); - MAP.put((byte) 0xfb, ValueType.CUSTOM); - MAP.put((byte) 0xfc, ValueType.CUSTOM); - MAP.put((byte) 0xfd, ValueType.CUSTOM); - MAP.put((byte) 0xfe, ValueType.CUSTOM); - MAP.put((byte) 0xff, ValueType.CUSTOM); - } - - private ValueTypeUtil() { - super(); - } - - public static ValueType get(final byte key) { - return MAP.get(key); - } - -} +/* + * DISCLAIMER + * + * Copyright 2016 ArangoDB GmbH, Cologne, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright holder is ArangoDB GmbH, Cologne, Germany + */ + +package com.arangodb.velocypack.internal.util; + +import java.util.HashMap; +import java.util.Map; + +import com.arangodb.velocypack.ValueType; + +/** + * @author Mark Vollmary + * + */ +public class ValueTypeUtil { + + private static final ValueType[] MAP = { + ValueType.NONE, // 0x00 + ValueType.ARRAY, // 0x01 + ValueType.ARRAY, // 0x02 + ValueType.ARRAY, // 0x03 + ValueType.ARRAY, // 0x04 + ValueType.ARRAY, // 0x05 + ValueType.ARRAY, // 0x06 + ValueType.ARRAY, // 0x07 + ValueType.ARRAY, // 0x08 + ValueType.ARRAY, // 0x09 + ValueType.OBJECT, // 0x0a + ValueType.OBJECT, // 0x0b + ValueType.OBJECT, // 0x0c + ValueType.OBJECT, // 0x0d + ValueType.OBJECT, // 0x0e + ValueType.OBJECT, // 0x0f + ValueType.OBJECT, // 0x10 + ValueType.OBJECT, // 0x11 + ValueType.OBJECT, // 0x12 + ValueType.ARRAY, // 0x13 + ValueType.OBJECT, // 0x14 + ValueType.NONE, // 0x15 + ValueType.NONE, // 0x16 + ValueType.ILLEGAL, // 0x17 + ValueType.NULL, // 0x18 + ValueType.BOOL, // 0x19 + ValueType.BOOL, // 0x1a + ValueType.DOUBLE, // 0x1b + ValueType.UTC_DATE, // 0x1c + ValueType.EXTERNAL, // 0x1d + ValueType.MIN_KEY, // 0x1e + ValueType.MAX_KEY, // 0x1f + ValueType.INT, // 0x20 + ValueType.INT, // 0x21 + ValueType.INT, // 0x22 + ValueType.INT, // 0x23 + ValueType.INT, // 0x24 + ValueType.INT, // 0x25 + ValueType.INT, // 0x26 + ValueType.INT, // 0x27 + ValueType.UINT, // 0x28 + ValueType.UINT, // 0x29 + ValueType.UINT, // 0x2a + ValueType.UINT, // 0x2b + ValueType.UINT, // 0x2c + ValueType.UINT, // 0x2d + ValueType.UINT, // 0x2e + ValueType.UINT, // 0x2f + ValueType.SMALLINT, // 0x30 + ValueType.SMALLINT, // 0x31 + ValueType.SMALLINT, // 0x32 + ValueType.SMALLINT, // 0x33 + ValueType.SMALLINT, // 0x34 + ValueType.SMALLINT, // 0x35 + ValueType.SMALLINT, // 0x36 + ValueType.SMALLINT, // 0x37 + ValueType.SMALLINT, // 0x38 + ValueType.SMALLINT, // 0x39 + ValueType.SMALLINT, // 0x3a + ValueType.SMALLINT, // 0x3b + ValueType.SMALLINT, // 0x3c + ValueType.SMALLINT, // 0x3d + ValueType.SMALLINT, // 0x3e + ValueType.SMALLINT, // 0x3f + ValueType.STRING, // 0x40 + ValueType.STRING, // 0x41 + ValueType.STRING, // 0x42 + ValueType.STRING, // 0x43 + ValueType.STRING, // 0x44 + ValueType.STRING, // 0x45 + ValueType.STRING, // 0x46 + ValueType.STRING, // 0x47 + ValueType.STRING, // 0x48 + ValueType.STRING, // 0x49 + ValueType.STRING, // 0x4a + ValueType.STRING, // 0x4b + ValueType.STRING, // 0x4c + ValueType.STRING, // 0x4d + ValueType.STRING, // 0x4e + ValueType.STRING, // 0x4f + ValueType.STRING, // 0x50 + ValueType.STRING, // 0x51 + ValueType.STRING, // 0x52 + ValueType.STRING, // 0x53 + ValueType.STRING, // 0x54 + ValueType.STRING, // 0x55 + ValueType.STRING, // 0x56 + ValueType.STRING, // 0x57 + ValueType.STRING, // 0x58 + ValueType.STRING, // 0x59 + ValueType.STRING, // 0x5a + ValueType.STRING, // 0x5b + ValueType.STRING, // 0x5c + ValueType.STRING, // 0x5d + ValueType.STRING, // 0x5e + ValueType.STRING, // 0x5f + ValueType.STRING, // 0x60 + ValueType.STRING, // 0x61 + ValueType.STRING, // 0x62 + ValueType.STRING, // 0x63 + ValueType.STRING, // 0x64 + ValueType.STRING, // 0x65 + ValueType.STRING, // 0x66 + ValueType.STRING, // 0x67 + ValueType.STRING, // 0x68 + ValueType.STRING, // 0x69 + ValueType.STRING, // 0x6a + ValueType.STRING, // 0x6b + ValueType.STRING, // 0x6c + ValueType.STRING, // 0x6d + ValueType.STRING, // 0x6e + ValueType.STRING, // 0x6f + ValueType.STRING, // 0x70 + ValueType.STRING, // 0x71 + ValueType.STRING, // 0x72 + ValueType.STRING, // 0x73 + ValueType.STRING, // 0x74 + ValueType.STRING, // 0x75 + ValueType.STRING, // 0x76 + ValueType.STRING, // 0x77 + ValueType.STRING, // 0x78 + ValueType.STRING, // 0x79 + ValueType.STRING, // 0x7a + ValueType.STRING, // 0x7b + ValueType.STRING, // 0x7c + ValueType.STRING, // 0x7d + ValueType.STRING, // 0x7e + ValueType.STRING, // 0x7f + ValueType.STRING, // 0x80 + ValueType.STRING, // 0x81 + ValueType.STRING, // 0x82 + ValueType.STRING, // 0x83 + ValueType.STRING, // 0x84 + ValueType.STRING, // 0x85 + ValueType.STRING, // 0x86 + ValueType.STRING, // 0x87 + ValueType.STRING, // 0x88 + ValueType.STRING, // 0x89 + ValueType.STRING, // 0x8a + ValueType.STRING, // 0x8b + ValueType.STRING, // 0x8c + ValueType.STRING, // 0x8d + ValueType.STRING, // 0x8e + ValueType.STRING, // 0x8f + ValueType.STRING, // 0x90 + ValueType.STRING, // 0x91 + ValueType.STRING, // 0x92 + ValueType.STRING, // 0x93 + ValueType.STRING, // 0x94 + ValueType.STRING, // 0x95 + ValueType.STRING, // 0x96 + ValueType.STRING, // 0x97 + ValueType.STRING, // 0x98 + ValueType.STRING, // 0x99 + ValueType.STRING, // 0x9a + ValueType.STRING, // 0x9b + ValueType.STRING, // 0x9c + ValueType.STRING, // 0x9d + ValueType.STRING, // 0x9e + ValueType.STRING, // 0x9f + ValueType.STRING, // 0xa0 + ValueType.STRING, // 0xa1 + ValueType.STRING, // 0xa2 + ValueType.STRING, // 0xa3 + ValueType.STRING, // 0xa4 + ValueType.STRING, // 0xa5 + ValueType.STRING, // 0xa6 + ValueType.STRING, // 0xa7 + ValueType.STRING, // 0xa8 + ValueType.STRING, // 0xa9 + ValueType.STRING, // 0xaa + ValueType.STRING, // 0xab + ValueType.STRING, // 0xac + ValueType.STRING, // 0xad + ValueType.STRING, // 0xae + ValueType.STRING, // 0xaf + ValueType.STRING, // 0xb0 + ValueType.STRING, // 0xb1 + ValueType.STRING, // 0xb2 + ValueType.STRING, // 0xb3 + ValueType.STRING, // 0xb4 + ValueType.STRING, // 0xb5 + ValueType.STRING, // 0xb6 + ValueType.STRING, // 0xb7 + ValueType.STRING, // 0xb8 + ValueType.STRING, // 0xb9 + ValueType.STRING, // 0xba + ValueType.STRING, // 0xbb + ValueType.STRING, // 0xbc + ValueType.STRING, // 0xbd + ValueType.STRING, // 0xbe + ValueType.STRING, // 0xbf + ValueType.BINARY, // 0xc0 + ValueType.BINARY, // 0xc1 + ValueType.BINARY, // 0xc2 + ValueType.BINARY, // 0xc3 + ValueType.BINARY, // 0xc4 + ValueType.BINARY, // 0xc5 + ValueType.BINARY, // 0xc6 + ValueType.BINARY, // 0xc7 + ValueType.BCD, // 0xc8 + ValueType.BCD, // 0xc9 + ValueType.BCD, // 0xca + ValueType.BCD, // 0xcb + ValueType.BCD, // 0xcc + ValueType.BCD, // 0xcd + ValueType.BCD, // 0xce + ValueType.BCD, // 0xcf + ValueType.BCD, // 0xd0 + ValueType.BCD, // 0xd1 + ValueType.BCD, // 0xd2 + ValueType.BCD, // 0xd3 + ValueType.BCD, // 0xd4 + ValueType.BCD, // 0xd5 + ValueType.BCD, // 0xd6 + ValueType.BCD, // 0xd7 + ValueType.NONE, // 0xd8 + ValueType.NONE, // 0xd9 + ValueType.NONE, // 0xda + ValueType.NONE, // 0xdb + ValueType.NONE, // 0xdc + ValueType.NONE, // 0xdd + ValueType.NONE, // 0xde + ValueType.NONE, // 0xdf + ValueType.NONE, // 0xe0 + ValueType.NONE, // 0xe1 + ValueType.NONE, // 0xe2 + ValueType.NONE, // 0xe3 + ValueType.NONE, // 0xe4 + ValueType.NONE, // 0xe5 + ValueType.NONE, // 0xe6 + ValueType.NONE, // 0xe7 + ValueType.NONE, // 0xe8 + ValueType.NONE, // 0xe9 + ValueType.NONE, // 0xea + ValueType.NONE, // 0xeb + ValueType.NONE, // 0xec + ValueType.NONE, // 0xed + ValueType.NONE, // 0xee + ValueType.NONE, // 0xef + ValueType.CUSTOM, // 0xf0 + ValueType.CUSTOM, // 0xf1 + ValueType.CUSTOM, // 0xf2 + ValueType.CUSTOM, // 0xf3 + ValueType.CUSTOM, // 0xf4 + ValueType.CUSTOM, // 0xf5 + ValueType.CUSTOM, // 0xf6 + ValueType.CUSTOM, // 0xf7 + ValueType.CUSTOM, // 0xf8 + ValueType.CUSTOM, // 0xf9 + ValueType.CUSTOM, // 0xfa + ValueType.CUSTOM, // 0xfb + ValueType.CUSTOM, // 0xfc + ValueType.CUSTOM, // 0xfd + ValueType.CUSTOM, // 0xfe + ValueType.CUSTOM, // 0xff + }; + + private ValueTypeUtil() { + super(); + } + + public static ValueType get(final byte key) { + return MAP[(int) key & 0xff]; + } + +} From 84b0a8cd4b965985e95f3a4a61445b7ceb52d1bd Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Mon, 23 Sep 2019 21:50:10 -0400 Subject: [PATCH 04/13] VPackBuilder optimizations: 2830 => 1358 ns/op --- .../com/arangodb/velocypack/VPackBuilder.java | 26 +- .../com/arangodb/velocypack/VPackSlice.java | 14 +- .../arangodb/velocypack/VPackStringSlice.java | 38 ++ .../internal/util/ValueLengthUtil.java | 521 +++++++++--------- .../java/com/arangodb/velocypack/Bench.java | 24 +- 5 files changed, 344 insertions(+), 279 deletions(-) create mode 100644 src/main/java/com/arangodb/velocypack/VPackStringSlice.java diff --git a/src/main/java/com/arangodb/velocypack/VPackBuilder.java b/src/main/java/com/arangodb/velocypack/VPackBuilder.java index 7d83c08..6c97c5e 100644 --- a/src/main/java/com/arangodb/velocypack/VPackBuilder.java +++ b/src/main/java/com/arangodb/velocypack/VPackBuilder.java @@ -216,7 +216,7 @@ public void append(final VPackBuilder builder, final VPackSlice value) throws VP private int size; private final List stack; // Start positions of open // objects/arrays - private final Map> index; // Indices for starts + private List[] index; // Indices for starts // of // subindex private boolean keyWritten; // indicates that in the current object the key @@ -233,7 +233,7 @@ public VPackBuilder(final BuilderOptions options) { size = 0; buffer = new byte[10]; stack = new ArrayList(); - index = new HashMap>(); + index = new List[4]; } public BuilderOptions getOptions() { @@ -670,7 +670,11 @@ private void addObject(final boolean unindexed) { private void addCompoundValue(final byte head) { // an Array or Object is started: stack.add(size); - index.put(stack.size() - 1, new ArrayList()); + if (index.length < stack.size()) { + // ensureCapacity + index = Arrays.copyOf(index, index.length * 2); + } + index[stack.size() - 1] = new ArrayList(); add(head); // Will be filled later with bytelength and nr subs size += 8; @@ -682,12 +686,12 @@ private void appendLength(final long length) { } private void reportAdd() { - final Collection depth = index.get(stack.size() - 1); + final Collection depth = index[stack.size() - 1]; depth.add(size - stack.get(stack.size() - 1)); } private void cleanupAdd() { - final List depth = index.get(stack.size() - 1); + final List depth = index[stack.size() - 1]; depth.remove(depth.size() - 1); } @@ -708,7 +712,7 @@ protected VPackBuilder close(final boolean sort) } final byte head = head(); final boolean isArray = head == 0x06 || head == 0x13; - final List in = index.get(stack.size() - 1); + final List in = index[stack.size() - 1]; final int tos = stack.get(stack.size() - 1); if (in.isEmpty()) { return closeEmptyArrayOrObject(tos, isArray); @@ -990,10 +994,10 @@ private VPackBuilder closeArray(final int tos, final List in) { } private static class SortEntry { - private final VPackSlice slice; + private final VPackStringSlice slice; private final int offset; - public SortEntry(final VPackSlice slice, final int offset) { + public SortEntry(final VPackStringSlice slice, final int offset) { super(); this.slice = slice; this.offset = offset; @@ -1002,14 +1006,14 @@ public SortEntry(final VPackSlice slice, final int offset) { private void sortObjectIndex(final int start, final List offsets) throws VPackKeyTypeException, VPackNeedAttributeTranslatorException { - final List attributes = new ArrayList(); + final List attributes = new ArrayList(offsets.size()); for (final Integer offset : offsets) { - attributes.add(new SortEntry(new VPackSlice(buffer, start + offset).makeKey(), offset)); + attributes.add(new SortEntry(new VPackSlice(buffer, start + offset).makeKey().getAsStringSlice(), offset)); } final Comparator comparator = new Comparator() { @Override public int compare(final SortEntry o1, final SortEntry o2) { - return o1.slice.getAsString().compareTo(o2.slice.getAsString()); + return o1.slice.compareTo(o2.slice); } }; Collections.sort(attributes, comparator); diff --git a/src/main/java/com/arangodb/velocypack/VPackSlice.java b/src/main/java/com/arangodb/velocypack/VPackSlice.java index 94418ef..37be77c 100644 --- a/src/main/java/com/arangodb/velocypack/VPackSlice.java +++ b/src/main/java/com/arangodb/velocypack/VPackSlice.java @@ -28,6 +28,7 @@ import java.util.Date; import java.util.Iterator; import java.util.Map.Entry; +import java.lang.Comparable; import com.arangodb.velocypack.exception.VPackException; import com.arangodb.velocypack.exception.VPackKeyTypeException; @@ -294,6 +295,10 @@ public java.sql.Timestamp getAsSQLTimestamp() { } public String getAsString() { + return getAsStringSlice().toString(); + } + + public VPackStringSlice getAsStringSlice() { if (!isString()) { throw new VPackValueTypeException(ValueType.STRING); } @@ -308,12 +313,12 @@ private boolean isLongString() { return head() == (byte) 0xbf; } - private String getShortString() { - return new String(vpack, start + 1, length(), Charset.forName("UTF-8")); + private VPackStringSlice getShortString() { + return new VPackStringSlice(vpack, start + 1, length()); } - private String getLongString() { - return new String(vpack, start + 9, getLongStringLength(), Charset.forName("UTF-8")); + private VPackStringSlice getLongString() { + return new VPackStringSlice(vpack, start + 9, getLongStringLength()); } private int getLongStringLength() { @@ -816,4 +821,5 @@ public boolean equals(final Object obj) { return true; } + } diff --git a/src/main/java/com/arangodb/velocypack/VPackStringSlice.java b/src/main/java/com/arangodb/velocypack/VPackStringSlice.java new file mode 100644 index 0000000..a80f4d5 --- /dev/null +++ b/src/main/java/com/arangodb/velocypack/VPackStringSlice.java @@ -0,0 +1,38 @@ +package com.arangodb.velocypack; + +import java.nio.charset.StandardCharsets; + +/** + * Wrapper around a {@link ValueType.STRING} supporting fast bytewise comparison. + * + * @see https://github.com/arangodb/velocypack/blob/master/VelocyPack.md#objects + */ +public class VPackStringSlice implements Comparable { + private byte[] vpack; + /** + * Index of the string bytes within {@link vpack}, + * i.e. tag byte and length are somewhere before this index. + */ + private int start; + private int length; + + public VPackStringSlice(byte[] vpack, int start, int length) { + this.vpack = vpack; + this.start = start; + this.length = length; + } + + @Override + public int compareTo(VPackStringSlice o) { + for (int i = 0; i < length || i < o.length; i++) { + int c = vpack[start + i] - o.vpack[o.start + i]; + if (c != 0) return c; + } + return length - o.length; + } + + @Override + public String toString() { + return new String(vpack, start, length, StandardCharsets.UTF_8); + } +} diff --git a/src/main/java/com/arangodb/velocypack/internal/util/ValueLengthUtil.java b/src/main/java/com/arangodb/velocypack/internal/util/ValueLengthUtil.java index 7a0bed5..a0b1b2b 100644 --- a/src/main/java/com/arangodb/velocypack/internal/util/ValueLengthUtil.java +++ b/src/main/java/com/arangodb/velocypack/internal/util/ValueLengthUtil.java @@ -33,274 +33,271 @@ public class ValueLengthUtil { private static final int LONG_BYTES = 8; private static final int CHARACTER_BYTES = 2; - private static final Map MAP; - - static { - MAP = new HashMap(); - MAP.put((byte) 0x00, 1); - MAP.put((byte) 0x01, 1); - MAP.put((byte) 0x02, 0); - MAP.put((byte) 0x03, 0); - MAP.put((byte) 0x04, 0); - MAP.put((byte) 0x05, 0); - MAP.put((byte) 0x06, 0); - MAP.put((byte) 0x07, 0); - MAP.put((byte) 0x08, 0); - MAP.put((byte) 0x09, 0); - MAP.put((byte) 0x0a, 1); - MAP.put((byte) 0x0b, 0); - MAP.put((byte) 0x0c, 0); - MAP.put((byte) 0x0d, 0); - MAP.put((byte) 0x0e, 0); - MAP.put((byte) 0x0f, 0); - MAP.put((byte) 0x10, 0); - MAP.put((byte) 0x11, 0); - MAP.put((byte) 0x12, 0); - MAP.put((byte) 0x13, 0); - MAP.put((byte) 0x14, 0); - MAP.put((byte) 0x15, 0); - MAP.put((byte) 0x16, 0); - MAP.put((byte) 0x17, 1); - MAP.put((byte) 0x18, 1); - MAP.put((byte) 0x19, 1); - MAP.put((byte) 0x1a, 1); - MAP.put((byte) 0x1b, 1 + DOUBLE_BYTES); - MAP.put((byte) 0x1c, 1 + LONG_BYTES); - MAP.put((byte) 0x1d, 1 + CHARACTER_BYTES); - MAP.put((byte) 0x1e, 1); - MAP.put((byte) 0x1f, 1); - MAP.put((byte) 0x20, 2); - MAP.put((byte) 0x21, 3); - MAP.put((byte) 0x22, 4); - MAP.put((byte) 0x23, 5); - MAP.put((byte) 0x24, 6); - MAP.put((byte) 0x25, 7); - MAP.put((byte) 0x26, 8); - MAP.put((byte) 0x27, 9); - MAP.put((byte) 0x28, 2); - MAP.put((byte) 0x29, 3); - MAP.put((byte) 0x2a, 4); - MAP.put((byte) 0x2b, 5); - MAP.put((byte) 0x2c, 6); - MAP.put((byte) 0x2d, 7); - MAP.put((byte) 0x2e, 8); - MAP.put((byte) 0x2f, 9); - MAP.put((byte) 0x30, 1); - MAP.put((byte) 0x31, 1); - MAP.put((byte) 0x32, 1); - MAP.put((byte) 0x33, 1); - MAP.put((byte) 0x34, 1); - MAP.put((byte) 0x35, 1); - MAP.put((byte) 0x36, 1); - MAP.put((byte) 0x37, 1); - MAP.put((byte) 0x38, 1); - MAP.put((byte) 0x39, 1); - MAP.put((byte) 0x3a, 1); - MAP.put((byte) 0x3b, 1); - MAP.put((byte) 0x3c, 1); - MAP.put((byte) 0x3d, 1); - MAP.put((byte) 0x3e, 1); - MAP.put((byte) 0x3f, 1); - MAP.put((byte) 0x40, 1); - MAP.put((byte) 0x41, 2); - MAP.put((byte) 0x42, 3); - MAP.put((byte) 0x43, 4); - MAP.put((byte) 0x44, 5); - MAP.put((byte) 0x45, 6); - MAP.put((byte) 0x46, 7); - MAP.put((byte) 0x47, 8); - MAP.put((byte) 0x48, 9); - MAP.put((byte) 0x49, 10); - MAP.put((byte) 0x4a, 11); - MAP.put((byte) 0x4b, 12); - MAP.put((byte) 0x4c, 13); - MAP.put((byte) 0x4d, 14); - MAP.put((byte) 0x4e, 15); - MAP.put((byte) 0x4f, 16); - MAP.put((byte) 0x50, 17); - MAP.put((byte) 0x51, 18); - MAP.put((byte) 0x52, 19); - MAP.put((byte) 0x53, 20); - MAP.put((byte) 0x54, 21); - MAP.put((byte) 0x55, 22); - MAP.put((byte) 0x56, 23); - MAP.put((byte) 0x57, 24); - MAP.put((byte) 0x58, 25); - MAP.put((byte) 0x59, 26); - MAP.put((byte) 0x5a, 27); - MAP.put((byte) 0x5b, 28); - MAP.put((byte) 0x5c, 29); - MAP.put((byte) 0x5d, 30); - MAP.put((byte) 0x5e, 31); - MAP.put((byte) 0x5f, 32); - MAP.put((byte) 0x60, 33); - MAP.put((byte) 0x61, 34); - MAP.put((byte) 0x62, 35); - MAP.put((byte) 0x63, 36); - MAP.put((byte) 0x64, 37); - MAP.put((byte) 0x65, 38); - MAP.put((byte) 0x66, 39); - MAP.put((byte) 0x67, 40); - MAP.put((byte) 0x68, 41); - MAP.put((byte) 0x69, 42); - MAP.put((byte) 0x6a, 43); - MAP.put((byte) 0x6b, 44); - MAP.put((byte) 0x6c, 45); - MAP.put((byte) 0x6d, 46); - MAP.put((byte) 0x6e, 47); - MAP.put((byte) 0x6f, 48); - MAP.put((byte) 0x70, 49); - MAP.put((byte) 0x71, 50); - MAP.put((byte) 0x72, 51); - MAP.put((byte) 0x73, 52); - MAP.put((byte) 0x74, 53); - MAP.put((byte) 0x75, 54); - MAP.put((byte) 0x76, 55); - MAP.put((byte) 0x77, 56); - MAP.put((byte) 0x78, 57); - MAP.put((byte) 0x79, 58); - MAP.put((byte) 0x7a, 59); - MAP.put((byte) 0x7b, 60); - MAP.put((byte) 0x7c, 61); - MAP.put((byte) 0x7d, 62); - MAP.put((byte) 0x7e, 63); - MAP.put((byte) 0x7f, 64); - MAP.put((byte) 0x80, 65); - MAP.put((byte) 0x81, 66); - MAP.put((byte) 0x82, 67); - MAP.put((byte) 0x83, 68); - MAP.put((byte) 0x84, 69); - MAP.put((byte) 0x85, 70); - MAP.put((byte) 0x86, 71); - MAP.put((byte) 0x87, 72); - MAP.put((byte) 0x88, 73); - MAP.put((byte) 0x89, 74); - MAP.put((byte) 0x8a, 75); - MAP.put((byte) 0x8b, 76); - MAP.put((byte) 0x8c, 77); - MAP.put((byte) 0x8d, 78); - MAP.put((byte) 0x8e, 79); - MAP.put((byte) 0x8f, 80); - MAP.put((byte) 0x90, 81); - MAP.put((byte) 0x91, 82); - MAP.put((byte) 0x92, 83); - MAP.put((byte) 0x93, 84); - MAP.put((byte) 0x94, 85); - MAP.put((byte) 0x95, 86); - MAP.put((byte) 0x96, 87); - MAP.put((byte) 0x97, 88); - MAP.put((byte) 0x98, 89); - MAP.put((byte) 0x99, 90); - MAP.put((byte) 0x9a, 91); - MAP.put((byte) 0x9b, 92); - MAP.put((byte) 0x9c, 93); - MAP.put((byte) 0x9d, 94); - MAP.put((byte) 0x9e, 95); - MAP.put((byte) 0x9f, 96); - MAP.put((byte) 0xa0, 97); - MAP.put((byte) 0xa1, 98); - MAP.put((byte) 0xa2, 99); - MAP.put((byte) 0xa3, 100); - MAP.put((byte) 0xa4, 101); - MAP.put((byte) 0xa5, 102); - MAP.put((byte) 0xa6, 103); - MAP.put((byte) 0xa7, 104); - MAP.put((byte) 0xa8, 105); - MAP.put((byte) 0xa9, 106); - MAP.put((byte) 0xaa, 107); - MAP.put((byte) 0xab, 108); - MAP.put((byte) 0xac, 109); - MAP.put((byte) 0xad, 110); - MAP.put((byte) 0xae, 111); - MAP.put((byte) 0xaf, 112); - MAP.put((byte) 0xb0, 113); - MAP.put((byte) 0xb1, 114); - MAP.put((byte) 0xb2, 115); - MAP.put((byte) 0xb3, 116); - MAP.put((byte) 0xb4, 117); - MAP.put((byte) 0xb5, 118); - MAP.put((byte) 0xb6, 119); - MAP.put((byte) 0xb7, 120); - MAP.put((byte) 0xb8, 121); - MAP.put((byte) 0xb9, 122); - MAP.put((byte) 0xba, 123); - MAP.put((byte) 0xbb, 124); - MAP.put((byte) 0xbc, 125); - MAP.put((byte) 0xbd, 126); - MAP.put((byte) 0xbe, 127); - MAP.put((byte) 0xbf, 0); - MAP.put((byte) 0xc0, 0); - MAP.put((byte) 0xc1, 0); - MAP.put((byte) 0xc2, 0); - MAP.put((byte) 0xc3, 0); - MAP.put((byte) 0xc4, 0); - MAP.put((byte) 0xc5, 0); - MAP.put((byte) 0xc6, 0); - MAP.put((byte) 0xc7, 0); - MAP.put((byte) 0xc8, 0); - MAP.put((byte) 0xc9, 0); - MAP.put((byte) 0xca, 0); - MAP.put((byte) 0xcb, 0); - MAP.put((byte) 0xcc, 0); - MAP.put((byte) 0xcd, 0); - MAP.put((byte) 0xce, 0); - MAP.put((byte) 0xcf, 0); - MAP.put((byte) 0xd0, 0); - MAP.put((byte) 0xd1, 0); - MAP.put((byte) 0xd2, 0); - MAP.put((byte) 0xd3, 0); - MAP.put((byte) 0xd4, 0); - MAP.put((byte) 0xd5, 0); - MAP.put((byte) 0xd6, 0); - MAP.put((byte) 0xd7, 0); - MAP.put((byte) 0xd8, 0); - MAP.put((byte) 0xd9, 0); - MAP.put((byte) 0xda, 0); - MAP.put((byte) 0xdb, 0); - MAP.put((byte) 0xdc, 0); - MAP.put((byte) 0xdd, 0); - MAP.put((byte) 0xde, 0); - MAP.put((byte) 0xdf, 0); - MAP.put((byte) 0xe0, 0); - MAP.put((byte) 0xe1, 0); - MAP.put((byte) 0xe2, 0); - MAP.put((byte) 0xe3, 0); - MAP.put((byte) 0xe4, 0); - MAP.put((byte) 0xe5, 0); - MAP.put((byte) 0xe6, 0); - MAP.put((byte) 0xe7, 0); - MAP.put((byte) 0xe8, 0); - MAP.put((byte) 0xe9, 0); - MAP.put((byte) 0xea, 0); - MAP.put((byte) 0xeb, 0); - MAP.put((byte) 0xec, 0); - MAP.put((byte) 0xed, 0); - MAP.put((byte) 0xee, 0); - MAP.put((byte) 0xef, 0); - MAP.put((byte) 0xf0, 2); - MAP.put((byte) 0xf1, 3); - MAP.put((byte) 0xf2, 5); - MAP.put((byte) 0xf3, 9); - MAP.put((byte) 0xf4, 0); - MAP.put((byte) 0xf5, 0); - MAP.put((byte) 0xf6, 0); - MAP.put((byte) 0xf7, 0); - MAP.put((byte) 0xf8, 0); - MAP.put((byte) 0xf9, 0); - MAP.put((byte) 0xfa, 0); - MAP.put((byte) 0xfb, 0); - MAP.put((byte) 0xfc, 0); - MAP.put((byte) 0xfd, 0); - MAP.put((byte) 0xfe, 0); - MAP.put((byte) 0xff, 0); - } + private static final int[] MAP = { + 1, // 0x00 + 1, // 0x01 + 0, // 0x02 + 0, // 0x03 + 0, // 0x04 + 0, // 0x05 + 0, // 0x06 + 0, // 0x07 + 0, // 0x08 + 0, // 0x09 + 1, // 0x0a + 0, // 0x0b + 0, // 0x0c + 0, // 0x0d + 0, // 0x0e + 0, // 0x0f + 0, // 0x10 + 0, // 0x11 + 0, // 0x12 + 0, // 0x13 + 0, // 0x14 + 0, // 0x15 + 0, // 0x16 + 1, // 0x17 + 1, // 0x18 + 1, // 0x19 + 1, // 0x1a + 1 + DOUBLE_BYTES, // 0x1b + 1 + LONG_BYTES, // 0x1c + 1 + CHARACTER_BYTES, // 0x1d + 1, // 0x1e + 1, // 0x1f + 2, // 0x20 + 3, // 0x21 + 4, // 0x22 + 5, // 0x23 + 6, // 0x24 + 7, // 0x25 + 8, // 0x26 + 9, // 0x27 + 2, // 0x28 + 3, // 0x29 + 4, // 0x2a + 5, // 0x2b + 6, // 0x2c + 7, // 0x2d + 8, // 0x2e + 9, // 0x2f + 1, // 0x30 + 1, // 0x31 + 1, // 0x32 + 1, // 0x33 + 1, // 0x34 + 1, // 0x35 + 1, // 0x36 + 1, // 0x37 + 1, // 0x38 + 1, // 0x39 + 1, // 0x3a + 1, // 0x3b + 1, // 0x3c + 1, // 0x3d + 1, // 0x3e + 1, // 0x3f + 1, // 0x40 + 2, // 0x41 + 3, // 0x42 + 4, // 0x43 + 5, // 0x44 + 6, // 0x45 + 7, // 0x46 + 8, // 0x47 + 9, // 0x48 + 10, // 0x49 + 11, // 0x4a + 12, // 0x4b + 13, // 0x4c + 14, // 0x4d + 15, // 0x4e + 16, // 0x4f + 17, // 0x50 + 18, // 0x51 + 19, // 0x52 + 20, // 0x53 + 21, // 0x54 + 22, // 0x55 + 23, // 0x56 + 24, // 0x57 + 25, // 0x58 + 26, // 0x59 + 27, // 0x5a + 28, // 0x5b + 29, // 0x5c + 30, // 0x5d + 31, // 0x5e + 32, // 0x5f + 33, // 0x60 + 34, // 0x61 + 35, // 0x62 + 36, // 0x63 + 37, // 0x64 + 38, // 0x65 + 39, // 0x66 + 40, // 0x67 + 41, // 0x68 + 42, // 0x69 + 43, // 0x6a + 44, // 0x6b + 45, // 0x6c + 46, // 0x6d + 47, // 0x6e + 48, // 0x6f + 49, // 0x70 + 50, // 0x71 + 51, // 0x72 + 52, // 0x73 + 53, // 0x74 + 54, // 0x75 + 55, // 0x76 + 56, // 0x77 + 57, // 0x78 + 58, // 0x79 + 59, // 0x7a + 60, // 0x7b + 61, // 0x7c + 62, // 0x7d + 63, // 0x7e + 64, // 0x7f + 65, // 0x80 + 66, // 0x81 + 67, // 0x82 + 68, // 0x83 + 69, // 0x84 + 70, // 0x85 + 71, // 0x86 + 72, // 0x87 + 73, // 0x88 + 74, // 0x89 + 75, // 0x8a + 76, // 0x8b + 77, // 0x8c + 78, // 0x8d + 79, // 0x8e + 80, // 0x8f + 81, // 0x90 + 82, // 0x91 + 83, // 0x92 + 84, // 0x93 + 85, // 0x94 + 86, // 0x95 + 87, // 0x96 + 88, // 0x97 + 89, // 0x98 + 90, // 0x99 + 91, // 0x9a + 92, // 0x9b + 93, // 0x9c + 94, // 0x9d + 95, // 0x9e + 96, // 0x9f + 97, // 0xa0 + 98, // 0xa1 + 99, // 0xa2 + 100, // 0xa3 + 101, // 0xa4 + 102, // 0xa5 + 103, // 0xa6 + 104, // 0xa7 + 105, // 0xa8 + 106, // 0xa9 + 107, // 0xaa + 108, // 0xab + 109, // 0xac + 110, // 0xad + 111, // 0xae + 112, // 0xaf + 113, // 0xb0 + 114, // 0xb1 + 115, // 0xb2 + 116, // 0xb3 + 117, // 0xb4 + 118, // 0xb5 + 119, // 0xb6 + 120, // 0xb7 + 121, // 0xb8 + 122, // 0xb9 + 123, // 0xba + 124, // 0xbb + 125, // 0xbc + 126, // 0xbd + 127, // 0xbe + 0, // 0xbf + 0, // 0xc0 + 0, // 0xc1 + 0, // 0xc2 + 0, // 0xc3 + 0, // 0xc4 + 0, // 0xc5 + 0, // 0xc6 + 0, // 0xc7 + 0, // 0xc8 + 0, // 0xc9 + 0, // 0xca + 0, // 0xcb + 0, // 0xcc + 0, // 0xcd + 0, // 0xce + 0, // 0xcf + 0, // 0xd0 + 0, // 0xd1 + 0, // 0xd2 + 0, // 0xd3 + 0, // 0xd4 + 0, // 0xd5 + 0, // 0xd6 + 0, // 0xd7 + 0, // 0xd8 + 0, // 0xd9 + 0, // 0xda + 0, // 0xdb + 0, // 0xdc + 0, // 0xdd + 0, // 0xde + 0, // 0xdf + 0, // 0xe0 + 0, // 0xe1 + 0, // 0xe2 + 0, // 0xe3 + 0, // 0xe4 + 0, // 0xe5 + 0, // 0xe6 + 0, // 0xe7 + 0, // 0xe8 + 0, // 0xe9 + 0, // 0xea + 0, // 0xeb + 0, // 0xec + 0, // 0xed + 0, // 0xee + 0, // 0xef + 2, // 0xf0 + 3, // 0xf1 + 5, // 0xf2 + 9, // 0xf3 + 0, // 0xf4 + 0, // 0xf5 + 0, // 0xf6 + 0, // 0xf7 + 0, // 0xf8 + 0, // 0xf9 + 0, // 0xfa + 0, // 0xfb + 0, // 0xfc + 0, // 0xfd + 0, // 0xfe + 0, // 0xff + }; private ValueLengthUtil() { super(); } public static int get(final byte key) { - return MAP.get(key); + return MAP[key & 0xff]; } } diff --git a/src/test/java/com/arangodb/velocypack/Bench.java b/src/test/java/com/arangodb/velocypack/Bench.java index e174248..67c3e6c 100644 --- a/src/test/java/com/arangodb/velocypack/Bench.java +++ b/src/test/java/com/arangodb/velocypack/Bench.java @@ -21,7 +21,7 @@ @Measurement(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(3) +@Fork(1) public class Bench { @State(Scope.Benchmark) public static class Data { @@ -44,7 +44,7 @@ public Data() { public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder() .include(Bench.class.getSimpleName()) - .addProfiler(GCProfiler.class) +// .addProfiler(GCProfiler.class) .addProfiler(JmhFlightRecorderProfiler.class) .jvmArgs("-Xmx256m", "-Xms256m", "-XX:+UnlockCommercialFeatures") // https://stackoverflow.com/a/37857708 .resultFormat(ResultFormatType.JSON) @@ -55,9 +55,29 @@ public static void main(String[] args) throws RunnerException { } + @OutputTimeUnit(TimeUnit.NANOSECONDS) + @Benchmark + public void builder(Data data, Blackhole bh) { + VPackBuilder builder = new VPackBuilder(); + builder.add(ValueType.OBJECT); + builder.add("name", "Koko"); + builder.add("species", "Gorilla"); + builder.add("language", "GSL"); + builder.add("knownSigns", 1000); + builder.add("knownEnglishWords", 2000); + builder.add("age", 46); + builder.add("hairy", true); + builder.add("iq", 80); + builder.add("pet", "All Ball"); + builder.close(); + bh.consume(builder.slice()); + } + + @Benchmark public void fromJson(Data data, Blackhole bh) { VPackParser parser = new VPackParser.Builder().build(); + VPackSlice slice = parser.fromJson(data.str); bh.consume(slice); } From a02010cbda3c01e8eedd49013a4cc75608dd2953 Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Mon, 23 Sep 2019 23:39:32 -0400 Subject: [PATCH 05/13] Fast path for ASCII 1358 => 946 ns/op --- .../com/arangodb/velocypack/VPackBuilder.java | 73 +++++++++++++++---- 1 file changed, 59 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/arangodb/velocypack/VPackBuilder.java b/src/main/java/com/arangodb/velocypack/VPackBuilder.java index 6c97c5e..8108e0b 100644 --- a/src/main/java/com/arangodb/velocypack/VPackBuilder.java +++ b/src/main/java/com/arangodb/velocypack/VPackBuilder.java @@ -23,6 +23,7 @@ import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.math.BigInteger; +import java.nio.charset.StandardCharsets; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; @@ -46,6 +47,7 @@ import com.arangodb.velocypack.internal.DefaultVPackBuilderOptions; import com.arangodb.velocypack.internal.Value; import com.arangodb.velocypack.internal.util.NumberUtil; +import com.fasterxml.jackson.core.io.CharTypes; /** * @author Mark Vollmary @@ -546,7 +548,7 @@ private void set(final Value item) throws VPackBuilderException { throw new VPackBuilderUnexpectedValueException(ValueType.UINT, Long.class, Integer.class, BigInteger.class); } - if (-1 == vUInt.compareTo(BigInteger.ZERO)) { + if (vUInt.compareTo(BigInteger.ZERO) < 0) { throw new VPackBuilderUnexpectedValueException(ValueType.UINT, "non-negative", Long.class, Integer.class, BigInteger.class); } @@ -621,21 +623,64 @@ private void appendSQLTimestamp(final Timestamp value) { } private void appendString(final String value) throws VPackBuilderException { - try { - final byte[] bytes = value.getBytes("UTF-8"); - final int length = bytes.length; - if (length <= 126) { - // short string - add((byte) (0x40 + length)); - } else { - // long string - add((byte) 0xbf); - appendLength(length); + int tagPos = size; + int strLen = value.length(); + + // Guess whether the end result will be short or long. Assume ASCII for now. + int tagSizeLen = strLen <= 126 ? 1 : 9; + + // Fast path. Assume ASCII. + ensureCapacity(size + tagSizeLen + strLen); + + // Reserve space for the tag + length. + size += tagSizeLen; + + // Fast+tight loop for ASCII-only, no-escaping-needed output + // Implementation lifted from jackson's UTF8JsonGenerator. + int[] escCodes = CharTypes.get7BitOutputEscapes(); + int offset = 0; + while(offset < strLen) { + int ch = value.charAt(offset); + if (ch > 0x7F || escCodes[ch] != 0) { + break; // Not ASCII. } - appendString(bytes); - } catch (final UnsupportedEncodingException e) { - throw new VPackBuilderException(e); + buffer[size++] = (byte) ch; + ++offset; + } + + if (offset < strLen) { + // Not ASCII. Rewind and do the slow path. + size = tagPos; + appendUtf8String(value); + return; + } + + // ASCII. strLen == bytes len. + // Rewind size temporarily to write the header before the string data. + size = tagPos; + if (strLen <= 126) { + // short string + add((byte) (0x40 + strLen)); + } else { + // long string + add((byte) 0xbf); + appendLength(strLen); + } + size += strLen; + } + + private void appendUtf8String(String value) { + final byte[] bytes = value.getBytes(StandardCharsets.UTF_8); + final int length = bytes.length; + if (length <= 126) { + // short string + add((byte) (0x40 + length)); + } else { + // long string + add((byte) 0xbf); + appendLength(length); } + appendString(bytes); } private void appendString(final byte[] bytes) { From cdb7337c8cfbf11fd32685edf0bdb8d54b585175 Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Tue, 24 Sep 2019 00:17:57 -0400 Subject: [PATCH 06/13] 985 => 896 ns/op --- src/main/java/com/arangodb/velocypack/VPackBuilder.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/arangodb/velocypack/VPackBuilder.java b/src/main/java/com/arangodb/velocypack/VPackBuilder.java index 8108e0b..9f26772 100644 --- a/src/main/java/com/arangodb/velocypack/VPackBuilder.java +++ b/src/main/java/com/arangodb/velocypack/VPackBuilder.java @@ -1051,9 +1051,10 @@ public SortEntry(final VPackStringSlice slice, final int offset) { private void sortObjectIndex(final int start, final List offsets) throws VPackKeyTypeException, VPackNeedAttributeTranslatorException { - final List attributes = new ArrayList(offsets.size()); - for (final Integer offset : offsets) { - attributes.add(new SortEntry(new VPackSlice(buffer, start + offset).makeKey().getAsStringSlice(), offset)); + VPackBuilder.SortEntry[] attributes = new VPackBuilder.SortEntry[offsets.size()]; + for (int i = 0; i < offsets.size(); i++) { + Integer offset = offsets.get(i); + attributes[i] = new SortEntry(new VPackSlice(buffer, start + offset).makeKey().getAsStringSlice(), offset); } final Comparator comparator = new Comparator() { @Override @@ -1061,7 +1062,7 @@ public int compare(final SortEntry o1, final SortEntry o2) { return o1.slice.compareTo(o2.slice); } }; - Collections.sort(attributes, comparator); + Arrays.sort(attributes, comparator); offsets.clear(); for (final SortEntry sortEntry : attributes) { offsets.add(sortEntry.offset); From 2b3a5c7486179e4cc52ab97a4223eea7aabf45a0 Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Tue, 24 Sep 2019 00:58:34 -0400 Subject: [PATCH 07/13] VPackSlice 1000 => 745 ns/op --- .../com/arangodb/velocypack/VPackSlice.java | 6 ++- .../arangodb/velocypack/VPackStringSlice.java | 14 ++++-- .../java/com/arangodb/velocypack/Bench.java | 48 +++++++++++++------ 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/arangodb/velocypack/VPackSlice.java b/src/main/java/com/arangodb/velocypack/VPackSlice.java index 37be77c..35701a5 100644 --- a/src/main/java/com/arangodb/velocypack/VPackSlice.java +++ b/src/main/java/com/arangodb/velocypack/VPackSlice.java @@ -24,6 +24,7 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Date; import java.util.Iterator; @@ -579,6 +580,7 @@ private VPackSlice searchObjectKeyBinary( long l = 0; long r = n - 1; + byte[] attributeBytes = attribute.getBytes(StandardCharsets.UTF_8); for (;;) { // midpoint final long index = l + ((r - l) / 2); @@ -587,14 +589,14 @@ private VPackSlice searchObjectKeyBinary( final VPackSlice key = new VPackSlice(vpack, (int) (start + keyIndex)); int res = 0; if (key.isString()) { - res = key.compareString(attribute); + res = key.getAsStringSlice().compareToBytes(attributeBytes); } else if (key.isInteger()) { // translate key if (!useTranslator) { // no attribute translator throw new VPackNeedAttributeTranslatorException(); } - res = key.translateUnchecked().compareString(attribute); + res = key.translateUnchecked().getAsStringSlice().compareToBytes(attributeBytes); } else { // invalid key result = new VPackSlice(); diff --git a/src/main/java/com/arangodb/velocypack/VPackStringSlice.java b/src/main/java/com/arangodb/velocypack/VPackStringSlice.java index a80f4d5..2cad9bd 100644 --- a/src/main/java/com/arangodb/velocypack/VPackStringSlice.java +++ b/src/main/java/com/arangodb/velocypack/VPackStringSlice.java @@ -24,11 +24,19 @@ public VPackStringSlice(byte[] vpack, int start, int length) { @Override public int compareTo(VPackStringSlice o) { - for (int i = 0; i < length || i < o.length; i++) { - int c = vpack[start + i] - o.vpack[o.start + i]; + return compareToBytes(o.vpack, o.start, o.length); + } + + public int compareToBytes(byte[] other) { + return compareToBytes(other, 0, other.length); + } + + public int compareToBytes(byte[] other, int off, int oLen) { + for (int i = 0; i < length && i < oLen; i++) { + int c = (vpack[start + i] & 0xff) - (other[off + i] & 0xff); if (c != 0) return c; } - return length - o.length; + return length - oLen; } @Override diff --git a/src/test/java/com/arangodb/velocypack/Bench.java b/src/test/java/com/arangodb/velocypack/Bench.java index 67c3e6c..87e9012 100644 --- a/src/test/java/com/arangodb/velocypack/Bench.java +++ b/src/test/java/com/arangodb/velocypack/Bench.java @@ -18,7 +18,7 @@ import java.util.concurrent.TimeUnit; @Warmup(iterations = 8, time = 1, timeUnit = TimeUnit.SECONDS) -@Measurement(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) +@Measurement(iterations = 30, time = 1, timeUnit = TimeUnit.SECONDS) @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) @Fork(1) @@ -27,6 +27,7 @@ public class Bench { public static class Data { public final String str; + public final VPackSlice koko = buildKoko(); public Data() { try { @@ -39,6 +40,23 @@ public Data() { throw new RuntimeException(e); } } + + public VPackSlice buildKoko() { + VPackBuilder builder = new VPackBuilder(); + builder.add(ValueType.OBJECT); + builder.add("name", "Koko"); + builder.add("species", "Gorilla"); + builder.add("language", "GSL"); + builder.add("knownSigns", 1000); + builder.add("knownEnglishWords", 2000); + builder.add("age", 46); + builder.add("hairy", true); + builder.add("iq", 80); + builder.add("pet", "All Ball"); + builder.close(); + return builder.slice(); + } + } public static void main(String[] args) throws RunnerException { @@ -58,21 +76,23 @@ public static void main(String[] args) throws RunnerException { @OutputTimeUnit(TimeUnit.NANOSECONDS) @Benchmark public void builder(Data data, Blackhole bh) { - VPackBuilder builder = new VPackBuilder(); - builder.add(ValueType.OBJECT); - builder.add("name", "Koko"); - builder.add("species", "Gorilla"); - builder.add("language", "GSL"); - builder.add("knownSigns", 1000); - builder.add("knownEnglishWords", 2000); - builder.add("age", 46); - builder.add("hairy", true); - builder.add("iq", 80); - builder.add("pet", "All Ball"); - builder.close(); - bh.consume(builder.slice()); + bh.consume(data.buildKoko()); } + @OutputTimeUnit(TimeUnit.NANOSECONDS) + @Benchmark + public void sliceGet(Data data, Blackhole bh) { + VPackSlice koko = data.koko; + bh.consume(koko.get("name")); + bh.consume(koko.get("species")); + bh.consume(koko.get("language")); + bh.consume(koko.get("knownSigns")); + bh.consume(koko.get("knownEnglishWords")); + bh.consume(koko.get("age")); + bh.consume(koko.get("hairy")); + bh.consume(koko.get("iq")); + bh.consume(koko.get("pet")); + } @Benchmark public void fromJson(Data data, Blackhole bh) { From 877c05b2ccee69bd3d8a73ca5144753feb4f3175 Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Tue, 24 Sep 2019 01:21:25 -0400 Subject: [PATCH 08/13] VPackSlice 745 =>> 720 ns/op --- .../internal/util/ObjectArrayUtil.java | 95 +++++++++---------- 1 file changed, 44 insertions(+), 51 deletions(-) diff --git a/src/main/java/com/arangodb/velocypack/internal/util/ObjectArrayUtil.java b/src/main/java/com/arangodb/velocypack/internal/util/ObjectArrayUtil.java index b01bac5..e991d2d 100644 --- a/src/main/java/com/arangodb/velocypack/internal/util/ObjectArrayUtil.java +++ b/src/main/java/com/arangodb/velocypack/internal/util/ObjectArrayUtil.java @@ -29,66 +29,59 @@ */ public class ObjectArrayUtil { - private static final Map FIRST_SUB_MAP; - - static { - FIRST_SUB_MAP = new HashMap(); - - FIRST_SUB_MAP.put((byte) 0x00, 0); // None - FIRST_SUB_MAP.put((byte) 0x01, 1); // empty array - FIRST_SUB_MAP.put((byte) 0x02, 2); // array without index table - FIRST_SUB_MAP.put((byte) 0x03, 3); // array without index table - FIRST_SUB_MAP.put((byte) 0x04, 5); // array without index table - FIRST_SUB_MAP.put((byte) 0x05, 9); // array without index table - FIRST_SUB_MAP.put((byte) 0x06, 3); // array with index table - FIRST_SUB_MAP.put((byte) 0x07, 5); // array with index table - FIRST_SUB_MAP.put((byte) 0x08, 9); // array with index table - FIRST_SUB_MAP.put((byte) 0x09, 9); // array with index table - FIRST_SUB_MAP.put((byte) 0x0a, 1); // empty object - FIRST_SUB_MAP.put((byte) 0x0b, 3); // object with sorted index table - FIRST_SUB_MAP.put((byte) 0x0c, 5); // object with sorted index table - FIRST_SUB_MAP.put((byte) 0x0d, 9); // object with sorted index table - FIRST_SUB_MAP.put((byte) 0x0e, 9); // object with sorted index table - FIRST_SUB_MAP.put((byte) 0x0f, 3); // object with unsorted index table - FIRST_SUB_MAP.put((byte) 0x10, 5); // object with unsorted index table - FIRST_SUB_MAP.put((byte) 0x11, 9); // object with unsorted index table - FIRST_SUB_MAP.put((byte) 0x12, 9); // object with unsorted index table - } + private static final int[] FIRST_SUB_MAP = { + 0, // 0x00 None + 1, // 0x01 empty array + 2, // 0x02 array without index table + 3, // 0x03 array without index table + 5, // 0x04 array without index table + 9, // 0x05 array without index table + 3, // 0x06 array with index table + 5, // 0x07 array with index table + 9, // 0x08 array with index table + 9, // 0x09 array with index table + 1, // 0x0a empty object + 3, // 0x0b object with sorted index table + 5, // 0x0c object with sorted index table + 9, // 0x0d object with sorted index table + 9, // 0x0e object with sorted index table + 3, // 0x0f object with unsorted index table + 5, // 0x10 object with unsorted index table + 9, // 0x11 object with unsorted index table + 9 // 0x12 object with unsorted index table + }; public static int getFirstSubMap(final byte key) { - return FIRST_SUB_MAP.get(key); + return FIRST_SUB_MAP[key & 0xff]; } - private static final Map OFFSET_SIZE; - static { - OFFSET_SIZE = new HashMap(); - - OFFSET_SIZE.put((byte) 0x00, 0); // None - OFFSET_SIZE.put((byte) 0x01, 1); // empty array - OFFSET_SIZE.put((byte) 0x02, 1); // array without index table - OFFSET_SIZE.put((byte) 0x03, 2); // array without index table - OFFSET_SIZE.put((byte) 0x04, 4); // array without index table - OFFSET_SIZE.put((byte) 0x05, 8); // array without index table - OFFSET_SIZE.put((byte) 0x06, 1); // array with index table - OFFSET_SIZE.put((byte) 0x07, 2); // array with index table - OFFSET_SIZE.put((byte) 0x08, 4); // array with index table - OFFSET_SIZE.put((byte) 0x09, 8); // array with index table - OFFSET_SIZE.put((byte) 0x0a, 1); // empty object - OFFSET_SIZE.put((byte) 0x0b, 1); // object with sorted index table - OFFSET_SIZE.put((byte) 0x0c, 2); // object with sorted index table - OFFSET_SIZE.put((byte) 0x0d, 4); // object with sorted index table - OFFSET_SIZE.put((byte) 0x0e, 8); // object with sorted index table - OFFSET_SIZE.put((byte) 0x0f, 1); // object with unsorted index table - OFFSET_SIZE.put((byte) 0x10, 2); // object with unsorted index table - OFFSET_SIZE.put((byte) 0x11, 4); // object with unsorted index table - OFFSET_SIZE.put((byte) 0x12, 8); // object with unsorted index table - } + private static final int[] OFFSET_SIZE = { + 0, // 0x00 None + 1, // 0x01 empty array + 1, // 0x02 array without index table + 2, // 0x03 array without index table + 4, // 0x04 array without index table + 8, // 0x05 array without index table + 1, // 0x06 array with index table + 2, // 0x07 array with index table + 4, // 0x08 array with index table + 8, // 0x09 array with index table + 1, // 0x0a empty object + 1, // 0x0b object with sorted index table + 2, // 0x0c object with sorted index table + 4, // 0x0d object with sorted index table + 8, // 0x0e object with sorted index table + 1, // 0x0f object with unsorted index table + 2, // 0x10 object with unsorted index table + 4, // 0x11 object with unsorted index table + 8 // 0x12 object with unsorted index table + }; private ObjectArrayUtil() { super(); } public static int getOffsetSize(final byte key) { - return OFFSET_SIZE.get(key); + return OFFSET_SIZE[key & 0xff]; } } From 2026a8547c2d263b27a9476b8b78d4d3a0943d34 Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Tue, 24 Sep 2019 01:38:49 -0400 Subject: [PATCH 09/13] Revert ASCII-specific optimizations 852 => 1386 ns/op --- .../com/arangodb/velocypack/VPackBuilder.java | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/src/main/java/com/arangodb/velocypack/VPackBuilder.java b/src/main/java/com/arangodb/velocypack/VPackBuilder.java index 9f26772..4bc5270 100644 --- a/src/main/java/com/arangodb/velocypack/VPackBuilder.java +++ b/src/main/java/com/arangodb/velocypack/VPackBuilder.java @@ -623,53 +623,6 @@ private void appendSQLTimestamp(final Timestamp value) { } private void appendString(final String value) throws VPackBuilderException { - int tagPos = size; - int strLen = value.length(); - - // Guess whether the end result will be short or long. Assume ASCII for now. - int tagSizeLen = strLen <= 126 ? 1 : 9; - - // Fast path. Assume ASCII. - ensureCapacity(size + tagSizeLen + strLen); - - // Reserve space for the tag + length. - size += tagSizeLen; - - // Fast+tight loop for ASCII-only, no-escaping-needed output - // Implementation lifted from jackson's UTF8JsonGenerator. - int[] escCodes = CharTypes.get7BitOutputEscapes(); - int offset = 0; - while(offset < strLen) { - int ch = value.charAt(offset); - if (ch > 0x7F || escCodes[ch] != 0) { - break; // Not ASCII. - } - buffer[size++] = (byte) ch; - ++offset; - } - - if (offset < strLen) { - // Not ASCII. Rewind and do the slow path. - size = tagPos; - appendUtf8String(value); - return; - } - - // ASCII. strLen == bytes len. - // Rewind size temporarily to write the header before the string data. - size = tagPos; - if (strLen <= 126) { - // short string - add((byte) (0x40 + strLen)); - } else { - // long string - add((byte) 0xbf); - appendLength(strLen); - } - size += strLen; - } - - private void appendUtf8String(String value) { final byte[] bytes = value.getBytes(StandardCharsets.UTF_8); final int length = bytes.length; if (length <= 126) { From 7372b852e6d792fff0b4571132197688a026140d Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Tue, 24 Sep 2019 14:04:47 -0400 Subject: [PATCH 10/13] Remove unnecessary "throws VPackBuilderException" --- src/main/java/com/arangodb/velocypack/VPackBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/arangodb/velocypack/VPackBuilder.java b/src/main/java/com/arangodb/velocypack/VPackBuilder.java index 4bc5270..e01399a 100644 --- a/src/main/java/com/arangodb/velocypack/VPackBuilder.java +++ b/src/main/java/com/arangodb/velocypack/VPackBuilder.java @@ -622,7 +622,7 @@ private void appendSQLTimestamp(final Timestamp value) { append(value.getTime(), LONG_BYTES); } - private void appendString(final String value) throws VPackBuilderException { + private void appendString(final String value) { final byte[] bytes = value.getBytes(StandardCharsets.UTF_8); final int length = bytes.length; if (length <= 126) { From e21121088ee179ef157313bd44c65ed48f3a9009 Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Fri, 29 Nov 2019 18:21:23 -0500 Subject: [PATCH 11/13] PR comments: avoid unchecked cast for generic array. --- pom.xml | 7 +++++-- .../com/arangodb/velocypack/VPackBuilder.java | 16 ++++++---------- src/test/java/com/arangodb/velocypack/Bench.java | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 1226c03..ed2db4d 100644 --- a/pom.xml +++ b/pom.xml @@ -107,8 +107,11 @@ maven-compiler-plugin 3.2 - 1.6 - 1.6 + 1.7 + 1.7 + + -Werror + diff --git a/src/main/java/com/arangodb/velocypack/VPackBuilder.java b/src/main/java/com/arangodb/velocypack/VPackBuilder.java index e01399a..f05af65 100644 --- a/src/main/java/com/arangodb/velocypack/VPackBuilder.java +++ b/src/main/java/com/arangodb/velocypack/VPackBuilder.java @@ -218,7 +218,7 @@ public void append(final VPackBuilder builder, final VPackSlice value) throws VP private int size; private final List stack; // Start positions of open // objects/arrays - private List[] index; // Indices for starts + private List> index; // Indices for starts // of // subindex private boolean keyWritten; // indicates that in the current object the key @@ -235,7 +235,7 @@ public VPackBuilder(final BuilderOptions options) { size = 0; buffer = new byte[10]; stack = new ArrayList(); - index = new List[4]; + index = new ArrayList>(4); } public BuilderOptions getOptions() { @@ -668,11 +668,7 @@ private void addObject(final boolean unindexed) { private void addCompoundValue(final byte head) { // an Array or Object is started: stack.add(size); - if (index.length < stack.size()) { - // ensureCapacity - index = Arrays.copyOf(index, index.length * 2); - } - index[stack.size() - 1] = new ArrayList(); + index.add(stack.size() - 1, new ArrayList()); add(head); // Will be filled later with bytelength and nr subs size += 8; @@ -684,12 +680,12 @@ private void appendLength(final long length) { } private void reportAdd() { - final Collection depth = index[stack.size() - 1]; + final Collection depth = index.get(stack.size() - 1); depth.add(size - stack.get(stack.size() - 1)); } private void cleanupAdd() { - final List depth = index[stack.size() - 1]; + final List depth = index.get(stack.size() - 1); depth.remove(depth.size() - 1); } @@ -710,7 +706,7 @@ protected VPackBuilder close(final boolean sort) } final byte head = head(); final boolean isArray = head == 0x06 || head == 0x13; - final List in = index[stack.size() - 1]; + final List in = index.get(stack.size() - 1); final int tos = stack.get(stack.size() - 1); if (in.isEmpty()) { return closeEmptyArrayOrObject(tos, isArray); diff --git a/src/test/java/com/arangodb/velocypack/Bench.java b/src/test/java/com/arangodb/velocypack/Bench.java index 87e9012..6670c22 100644 --- a/src/test/java/com/arangodb/velocypack/Bench.java +++ b/src/test/java/com/arangodb/velocypack/Bench.java @@ -64,7 +64,7 @@ public static void main(String[] args) throws RunnerException { .include(Bench.class.getSimpleName()) // .addProfiler(GCProfiler.class) .addProfiler(JmhFlightRecorderProfiler.class) - .jvmArgs("-Xmx256m", "-Xms256m", "-XX:+UnlockCommercialFeatures") // https://stackoverflow.com/a/37857708 + .jvmArgs("-Xmx256m", "-Xms256m") .resultFormat(ResultFormatType.JSON) .result("target/jmh-result-" + System.currentTimeMillis() + ".json") .build(); From 9547676601ca6ef82bb82a971212d2d06024e539 Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Fri, 29 Nov 2019 18:54:55 -0500 Subject: [PATCH 12/13] PR comments: Remove spf4j-jmh. Resolve licensing concerns. --- pom.xml | 12 --------- .../java/com/arangodb/velocypack/Bench.java | 26 +++++++++++++------ 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index ed2db4d..aaa5f9f 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,6 @@ 1.3 4.12 1.21 - 8.6.19 @@ -229,11 +228,6 @@ jmh-generator-annprocess test - - org.spf4j - spf4j-jmh - test - @@ -275,12 +269,6 @@ ${jmh.version} test - - org.spf4j - spf4j-jmh - ${spf4j-jmh.version} - test - diff --git a/src/test/java/com/arangodb/velocypack/Bench.java b/src/test/java/com/arangodb/velocypack/Bench.java index 6670c22..6885939 100644 --- a/src/test/java/com/arangodb/velocypack/Bench.java +++ b/src/test/java/com/arangodb/velocypack/Bench.java @@ -3,18 +3,19 @@ import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; import org.openjdk.jmh.profile.GCProfiler; -import org.openjdk.jmh.profile.StackProfiler; import org.openjdk.jmh.results.format.ResultFormatType; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; -import org.spf4j.stackmonitor.JmhFlightRecorderProfiler; import java.io.IOException; -import java.net.URISyntaxException; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; import java.util.concurrent.TimeUnit; @Warmup(iterations = 8, time = 1, timeUnit = TimeUnit.SECONDS) @@ -59,14 +60,23 @@ public VPackSlice buildKoko() { } - public static void main(String[] args) throws RunnerException { + public static void main(String[] args) throws RunnerException, IOException { + String datetime = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(new Date()); + Path target = Files.createDirectories(Paths.get("target", "jmh-result")); + + ArrayList jvmArgs = new ArrayList<>(); + jvmArgs.add("-Xms256m"); + jvmArgs.add("-Xmx256m"); + if (Integer.parseInt(System.getProperty("java.version").split("\\.")[0]) >= 11) { + jvmArgs.add("-XX:StartFlightRecording=filename=" + target.resolve(datetime + ".jfr") + ",settings=profile"); + } + Options opt = new OptionsBuilder() .include(Bench.class.getSimpleName()) -// .addProfiler(GCProfiler.class) - .addProfiler(JmhFlightRecorderProfiler.class) - .jvmArgs("-Xmx256m", "-Xms256m") + .addProfiler(GCProfiler.class) + .jvmArgs(jvmArgs.toArray(new String[0])) .resultFormat(ResultFormatType.JSON) - .result("target/jmh-result-" + System.currentTimeMillis() + ".json") + .result(target.resolve(datetime + ".json").toString()) .build(); new Runner(opt).run(); From 47d85af04ed8689aae883cea1d68c7ef88e4cfae Mon Sep 17 00:00:00 2001 From: Doug Roper Date: Fri, 29 Nov 2019 21:04:09 -0500 Subject: [PATCH 13/13] PR comments: Fix javadoc things. --- src/main/java/com/arangodb/velocypack/VPackStringSlice.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/arangodb/velocypack/VPackStringSlice.java b/src/main/java/com/arangodb/velocypack/VPackStringSlice.java index 2cad9bd..4ba7801 100644 --- a/src/main/java/com/arangodb/velocypack/VPackStringSlice.java +++ b/src/main/java/com/arangodb/velocypack/VPackStringSlice.java @@ -3,9 +3,9 @@ import java.nio.charset.StandardCharsets; /** - * Wrapper around a {@link ValueType.STRING} supporting fast bytewise comparison. + * Wrapper around a {@link ValueType#STRING} supporting fast bytewise comparison. * - * @see https://github.com/arangodb/velocypack/blob/master/VelocyPack.md#objects + * @see VelocyPack Objects */ public class VPackStringSlice implements Comparable { private byte[] vpack;