mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel
This commit is contained in:
commit
45aff333da
28
CHANGELOG
28
CHANGELOG
|
@ -1,6 +1,34 @@
|
|||
v1.4
|
||||
----
|
||||
|
||||
* added collection detail dialog (web interface)
|
||||
|
||||
Shows collection properties, figures (datafiles, journals, attributes, etc.)
|
||||
and indexes.
|
||||
|
||||
* added documents filter (web interface)
|
||||
|
||||
Allows searching for documents based on attribute values. One or many filter
|
||||
conditions can be defined, using comparison operators such as '==', '<=', etc.
|
||||
|
||||
* improved AQL editor (web interface)
|
||||
|
||||
Editor supports keyboard shortcuts (Submit, Undo, Redo, Select).
|
||||
Editor allows saving and reusing of user-defined queries.
|
||||
Added example queries to AQL editor.
|
||||
Added comment button.
|
||||
|
||||
* added document import (web interface)
|
||||
|
||||
Allows upload of JSON-data from files. Files must have an extension of .json.
|
||||
|
||||
* added dashboard (web interface)
|
||||
|
||||
Shows the status of replication and multiple system charts, e.g.
|
||||
Virtual Memory Size, Request Time, HTTP Connections etc.
|
||||
|
||||
* added API method `/_api/graph` to query all graphs with all properties.
|
||||
|
||||
* added example queries in web interface AQL editor
|
||||
|
||||
* added arango.reconnect(<host>) method for arangosh to dynamically switch server or
|
||||
|
|
|
@ -64,6 +64,9 @@ line-wise processing.
|
|||
|
||||
To use this method, the `type` URL parameter should be set to `array`.
|
||||
|
||||
Setting the `type` URL parameter to `auto` will make the server auto-detect whether
|
||||
the data are line-wise JSON documents (type = documents) or a JSON list (type = array).
|
||||
|
||||
@EXAMPLES
|
||||
|
||||
@verbinclude api-import-documents
|
||||
|
|
|
@ -66,6 +66,10 @@ examples assume
|
|||
@anchor JSModuleGraphGraphDrop
|
||||
@copydetails JSF_Graph_prototype_drop
|
||||
|
||||
@CLEARPAGE
|
||||
@anchor JSModuleGraphGraphGetAll
|
||||
@copydetails JSF_graph_getAll
|
||||
|
||||
@CLEARPAGE
|
||||
@anchor JSModuleGraphGraphGeodesics
|
||||
@copydetails JSF_Graph_prototype_geodesics
|
||||
|
|
|
@ -13,6 +13,7 @@ TOC {#JSModuleGraphTOC}
|
|||
- @ref JSModuleGraphGraphRemoveEdge "Graph.removeEdge"
|
||||
- @ref JSModuleGraphGraphRemoveVertex "Graph.removeVertex"
|
||||
- @ref JSModuleGraphGraphDrop "Graph.drop"
|
||||
- @ref JSModuleGraphGraphGetAll "Graph.getAll"
|
||||
- @ref JSModuleGraphGraphGeodesics "Graph.geodesics"
|
||||
- @ref JSModuleGraphGraphMeasurement "Graph.measurement"
|
||||
- @ref JSModuleGraphGraphNormalizedMeasurement "Graph.normalizedMeasurement"
|
||||
|
|
|
@ -78,7 +78,6 @@ describe ArangoDB do
|
|||
return doc
|
||||
end
|
||||
|
||||
|
||||
################################################################################
|
||||
## checking graph responses
|
||||
################################################################################
|
||||
|
@ -159,6 +158,20 @@ describe ArangoDB do
|
|||
doc2.code.should eq(400)
|
||||
doc2.parsed_response['error'].should eq(true)
|
||||
end
|
||||
|
||||
it "checks get all graphs" do
|
||||
doc1 = create_graph( prefix, graph_name, vertex_collection, edge_collection )
|
||||
doc1.code.should eq(201)
|
||||
etag = doc1.headers['etag']
|
||||
|
||||
cmd = "/_api/graph"
|
||||
doc2 = ArangoDB.log_get("#{prefix}", cmd)
|
||||
|
||||
doc2.code.should eq(200)
|
||||
doc2.parsed_response['graphs'].length.should eq(1)
|
||||
doc2.parsed_response['graphs'][0]['_rev'].should eq(etag)
|
||||
doc2.parsed_response['graphs'][0]['_key'].should eq(graph_name)
|
||||
end
|
||||
|
||||
it "checks create and get graph" do
|
||||
doc1 = create_graph( prefix, graph_name, vertex_collection, edge_collection )
|
||||
|
|
|
@ -77,6 +77,23 @@ describe ArangoDB do
|
|||
doc.parsed_response['empty'].should eq(0)
|
||||
end
|
||||
|
||||
it "using different documents, type=auto" do
|
||||
cmd = api + "?collection=#{@cn}&createCollection=true&type=auto"
|
||||
body = "[ \n"
|
||||
body += "{ \"name\" : \"John\", \"age\" : 29, \"gender\" : \"male\", \"likes\" : [ \"socket\", \"bind\", \"accept\" ] },\n"
|
||||
body += "{ \"firstName\" : \"Jane\", \"lastName\" : \"Doe\", \"age\" : 35, \"gender\" : \"female\", \"livesIn\" : \"Manila\" },\n"
|
||||
body += "{ \"sample\" : \"garbage\" },\n"
|
||||
body += "{ }\n"
|
||||
body += "]\n"
|
||||
doc = ArangoDB.log_post("#{prefix}-array-different", cmd, :body => body)
|
||||
|
||||
doc.code.should eq(201)
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['created'].should eq(4)
|
||||
doc.parsed_response['errors'].should eq(0)
|
||||
doc.parsed_response['empty'].should eq(0)
|
||||
end
|
||||
|
||||
it "using whitespace" do
|
||||
cmd = api + "?collection=#{@cn}&createCollection=true&type=array"
|
||||
body = " [\n\n { \"name\" : \"John\", \"age\" : 29 }, \n \n \n \r\n \n { \"rubbish\" : \"data goes in here\" }\n\n ]"
|
||||
|
@ -176,6 +193,21 @@ describe ArangoDB do
|
|||
doc.parsed_response['empty'].should eq(0)
|
||||
end
|
||||
|
||||
it "using different documents, type=auto" do
|
||||
cmd = api + "?collection=#{@cn}&createCollection=true&type=auto"
|
||||
body = "{ \"name\" : \"John\", \"age\" : 29, \"gender\" : \"male\", \"likes\" : [ \"socket\", \"bind\", \"accept\" ] }\n"
|
||||
body += "{ \"firstName\" : \"Jane\", \"lastName\" : \"Doe\", \"age\" : 35, \"gender\" : \"female\", \"livesIn\" : \"Manila\" }\n"
|
||||
body += "{ \"sample\" : \"garbage\" }\n"
|
||||
body += "{ }"
|
||||
doc = ArangoDB.log_post("#{prefix}-self-contained-different", cmd, :body => body)
|
||||
|
||||
doc.code.should eq(201)
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['created'].should eq(4)
|
||||
doc.parsed_response['errors'].should eq(0)
|
||||
doc.parsed_response['empty'].should eq(0)
|
||||
end
|
||||
|
||||
it "using whitespace" do
|
||||
cmd = api + "?collection=#{@cn}&createCollection=true&type=documents"
|
||||
body = "\n\n { \"name\" : \"John\", \"age\" : 29 } \n \n \n \r\n \n { \"rubbish\" : \"data goes in here\" }\n\n"
|
||||
|
|
|
@ -599,12 +599,12 @@ describe ArangoDB do
|
|||
cmd = api + "/dump?collection=UnitTestsReplication"
|
||||
doc = ArangoDB.log_get("#{prefix}-dump-empty", cmd, :body => "")
|
||||
|
||||
doc.code.should eq(200)
|
||||
doc.code.should eq(204)
|
||||
|
||||
doc.headers["x-arango-replication-checkmore"].should eq("false")
|
||||
doc.headers["x-arango-replication-lastincluded"].should eq("0")
|
||||
doc.headers["content-type"].should eq("application/x-arango-dump; charset=utf-8")
|
||||
doc.response.body.should eq("")
|
||||
doc.response.body.should eq(nil)
|
||||
end
|
||||
|
||||
it "checks the dump for a non-empty collection" do
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "BasicsC/string-buffer.h"
|
||||
#include "BasicsC/tri-strings.h"
|
||||
#include "Rest/HttpRequest.h"
|
||||
#include "Utilities/ResourceHolder.h"
|
||||
#include "VocBase/document-collection.h"
|
||||
#include "VocBase/edge-collection.h"
|
||||
#include "VocBase/vocbase.h"
|
||||
|
@ -121,24 +120,24 @@ HttpHandler::status_e RestImportHandler::execute () {
|
|||
|
||||
switch (type) {
|
||||
case HttpRequest::HTTP_REQUEST_POST: {
|
||||
// extract the import type
|
||||
bool found;
|
||||
string documentType = _request->value("type", found);
|
||||
// extract the import type
|
||||
bool found;
|
||||
string documentType = _request->value("type", found);
|
||||
|
||||
if (found && documentType == "documents") {
|
||||
// lines with individual JSON documents
|
||||
res = createByDocumentsLines();
|
||||
}
|
||||
else if (found && documentType == "array") {
|
||||
// one JSON array
|
||||
res = createByDocumentsList();
|
||||
}
|
||||
else {
|
||||
// CSV
|
||||
res = createByKeyValueList();
|
||||
}
|
||||
if (found &&
|
||||
(documentType == "documents" ||
|
||||
documentType == "array" ||
|
||||
documentType == "list" ||
|
||||
documentType == "auto")) {
|
||||
res = createFromJson(documentType);
|
||||
}
|
||||
else {
|
||||
// CSV
|
||||
res = createFromKeyValueList();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
res = false;
|
||||
generateNotImplemented("ILLEGAL " + DOCUMENT_IMPORT_PATH);
|
||||
|
@ -168,11 +167,12 @@ HttpHandler::status_e RestImportHandler::execute () {
|
|||
/// @brief log an error document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void RestImportHandler::logDocument (const TRI_json_t* const json) const {
|
||||
void RestImportHandler::logDocument (TRI_json_t const* json) const {
|
||||
TRI_string_buffer_t buffer;
|
||||
|
||||
TRI_InitStringBuffer(&buffer, TRI_UNKNOWN_MEM_ZONE);
|
||||
int res = TRI_StringifyJson(&buffer, json);
|
||||
|
||||
if (res == TRI_ERROR_NO_ERROR) {
|
||||
LOGGER_WARNING("offending document: " << buffer._buffer);
|
||||
}
|
||||
|
@ -180,372 +180,90 @@ void RestImportHandler::logDocument (const TRI_json_t* const json) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates documents
|
||||
///
|
||||
/// @REST{POST /_api/import?type=documents&collection=`collection-name`}
|
||||
///
|
||||
/// Creates documents in the collection identified by `collection-name`.
|
||||
/// The JSON representations of the documents must be passed as the body of the
|
||||
/// POST request.
|
||||
///
|
||||
/// If the documents were created successfully, then a `HTTP 201` is returned.
|
||||
/// @brief process a single JSON document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestImportHandler::createByDocumentsLines () {
|
||||
size_t numCreated = 0;
|
||||
size_t numError = 0;
|
||||
size_t numEmpty = 0;
|
||||
bool RestImportHandler::handleSingleDocument (ImportTransactionType& trx,
|
||||
TRI_json_t const* json,
|
||||
const bool isEdgeCollection,
|
||||
const bool waitForSync,
|
||||
const size_t i) {
|
||||
if (json == 0 || json->_type != TRI_JSON_ARRAY) {
|
||||
LOGGER_WARNING("invalid JSON type (expecting array) at position " << i);
|
||||
|
||||
vector<string> const& suffix = _request->suffix();
|
||||
|
||||
if (suffix.size() != 0) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES,
|
||||
"superfluous suffix, expecting " + DOCUMENT_IMPORT_PATH + "?type=documents&collection=<identifier>");
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool waitForSync = extractWaitForSync();
|
||||
// document ok, now import it
|
||||
TRI_doc_mptr_t document;
|
||||
int res = TRI_ERROR_NO_ERROR;
|
||||
|
||||
// extract the collection name
|
||||
bool found;
|
||||
const string& collection = _request->value("collection", found);
|
||||
if (isEdgeCollection) {
|
||||
const char* from = extractJsonStringValue(json, TRI_VOC_ATTRIBUTE_FROM);
|
||||
const char* to = extractJsonStringValue(json, TRI_VOC_ATTRIBUTE_TO);
|
||||
|
||||
if (! found || collection.empty()) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_ARANGO_COLLECTION_PARAMETER_MISSING,
|
||||
"'collection' is missing, expecting " + DOCUMENT_IMPORT_PATH + "?collection=<identifier>");
|
||||
return false;
|
||||
}
|
||||
if (from == 0 || to == 0) {
|
||||
LOGGER_WARNING("missing '_from' or '_to' attribute at position " << i);
|
||||
|
||||
if (! checkCreateCollection(collection, TRI_COL_TYPE_DOCUMENT)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// find and load collection given by name or identifier
|
||||
SingleCollectionWriteTransaction<StandaloneTransaction<RestTransactionContext>, UINT64_MAX> trx(_vocbase, _resolver, collection);
|
||||
TRI_document_edge_t edge;
|
||||
|
||||
// .............................................................................
|
||||
// inside write transaction
|
||||
// .............................................................................
|
||||
edge._fromCid = 0;
|
||||
edge._toCid = 0;
|
||||
edge._fromKey = 0;
|
||||
edge._toKey = 0;
|
||||
|
||||
int res = trx.begin();
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
generateTransactionError(collection, res);
|
||||
return false;
|
||||
}
|
||||
int res1 = parseDocumentId(from, edge._fromCid, edge._fromKey);
|
||||
int res2 = parseDocumentId(to, edge._toCid, edge._toKey);
|
||||
|
||||
TRI_primary_collection_t* primary = trx.primaryCollection();
|
||||
const TRI_voc_cid_t cid = trx.cid();
|
||||
const bool isEdgeCollection = (primary->base._info._type == TRI_COL_TYPE_EDGE);
|
||||
|
||||
trx.lockWrite();
|
||||
|
||||
const char* ptr = _request->body();
|
||||
const char* end = ptr + _request->bodySize();
|
||||
string line;
|
||||
size_t i = 0;
|
||||
|
||||
while (ptr < end) {
|
||||
i++;
|
||||
const char* pos = strchr(ptr, '\n');
|
||||
|
||||
if (pos == 0) {
|
||||
line.assign(ptr, (size_t) (end - ptr));
|
||||
ptr = end;
|
||||
if (res1 == TRI_ERROR_NO_ERROR && res2 == TRI_ERROR_NO_ERROR) {
|
||||
res = trx.createEdge(&document, json, waitForSync, &edge);
|
||||
}
|
||||
else {
|
||||
line.assign(ptr, (size_t) (pos - ptr));
|
||||
ptr = pos + 1;
|
||||
res = (res1 != TRI_ERROR_NO_ERROR ? res1 : res2);
|
||||
}
|
||||
|
||||
StringUtils::trimInPlace(line, "\r\n\t ");
|
||||
if (line.length() == 0) {
|
||||
++numEmpty;
|
||||
continue;
|
||||
if (edge._fromKey != 0) {
|
||||
TRI_Free(TRI_CORE_MEM_ZONE, edge._fromKey);
|
||||
}
|
||||
|
||||
TRI_json_t* values = parseJsonLine(line);
|
||||
|
||||
if (values == 0 || values->_type != TRI_JSON_ARRAY) {
|
||||
LOGGER_WARNING("invalid JSON type (expecting array) at position " << i);
|
||||
++numError;
|
||||
if (edge._toKey != 0) {
|
||||
TRI_Free(TRI_CORE_MEM_ZONE, edge._toKey);
|
||||
}
|
||||
else {
|
||||
// now save the document
|
||||
TRI_doc_mptr_t document;
|
||||
|
||||
if (isEdgeCollection) {
|
||||
const char* from = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_FROM);
|
||||
|
||||
if (from == 0) {
|
||||
LOGGER_WARNING("missing '_from' attribute at position " << i);
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values);
|
||||
++numError;
|
||||
continue;
|
||||
}
|
||||
|
||||
const char* to = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_TO);
|
||||
if (to == 0) {
|
||||
LOGGER_WARNING("missing '_to' attribute at position " << i);
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values);
|
||||
++numError;
|
||||
continue;
|
||||
}
|
||||
|
||||
TRI_document_edge_t edge;
|
||||
|
||||
edge._fromCid = cid;
|
||||
edge._toCid = cid;
|
||||
edge._fromKey = 0;
|
||||
edge._toKey = 0;
|
||||
|
||||
int res1 = parseDocumentId(from, edge._fromCid, edge._fromKey);
|
||||
int res2 = parseDocumentId(to, edge._toCid, edge._toKey);
|
||||
|
||||
if (res1 == TRI_ERROR_NO_ERROR && res2 == TRI_ERROR_NO_ERROR) {
|
||||
res = trx.createEdge(&document, values, waitForSync, &edge);
|
||||
}
|
||||
else {
|
||||
res = (res1 != TRI_ERROR_NO_ERROR ? res1 : res2);
|
||||
}
|
||||
|
||||
if (edge._fromKey != 0) {
|
||||
TRI_Free(TRI_CORE_MEM_ZONE, edge._fromKey);
|
||||
}
|
||||
if (edge._toKey != 0) {
|
||||
TRI_Free(TRI_CORE_MEM_ZONE, edge._toKey);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// do not acquire an extra lock
|
||||
res = trx.createDocument(&document, values, waitForSync);
|
||||
}
|
||||
|
||||
|
||||
if (res == TRI_ERROR_NO_ERROR) {
|
||||
++numCreated;
|
||||
}
|
||||
else {
|
||||
LOGGER_WARNING("creating document failed with error: " << TRI_errno_string(res));
|
||||
logDocument(values);
|
||||
++numError;
|
||||
}
|
||||
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values);
|
||||
}
|
||||
}
|
||||
|
||||
// this will commit, even if previous errors occurred
|
||||
res = trx.commit();
|
||||
|
||||
// .............................................................................
|
||||
// outside write transaction
|
||||
// .............................................................................
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
generateTransactionError(collection, res);
|
||||
}
|
||||
else {
|
||||
// generate result
|
||||
generateDocumentsCreated(numCreated, numError, numEmpty);
|
||||
// do not acquire an extra lock
|
||||
res = trx.createDocument(&document, json, waitForSync);
|
||||
}
|
||||
|
||||
return true;
|
||||
if (res == TRI_ERROR_NO_ERROR) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LOGGER_WARNING("creating document failed with error: " << TRI_errno_string(res));
|
||||
logDocument(json);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates documents
|
||||
/// @brief creates documents from JSON
|
||||
///
|
||||
/// @REST{POST /_api/import?type=array&collection=`collection-name`}
|
||||
/// @REST{POST /_api/import?type=auto&collection=`collection-name`}
|
||||
///
|
||||
/// Creates documents in the collection identified by `collection-name`.
|
||||
/// The JSON representations of the documents must be passed as the body of the
|
||||
/// POST request.
|
||||
/// POST request. The request body can either consist of multiple lines, with
|
||||
/// each line being a single stand-alone JSON document, or a JSON list.
|
||||
///
|
||||
/// If the documents were created successfully, then a `HTTP 201` is returned.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestImportHandler::createByDocumentsList () {
|
||||
bool RestImportHandler::createFromJson (const string& type) {
|
||||
size_t numCreated = 0;
|
||||
size_t numError = 0;
|
||||
|
||||
vector<string> const& suffix = _request->suffix();
|
||||
|
||||
if (suffix.size() != 0) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES,
|
||||
"superfluous suffix, expecting " + DOCUMENT_IMPORT_PATH + "?type=array&collection=<identifier>");
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool waitForSync = extractWaitForSync();
|
||||
|
||||
// extract the collection name
|
||||
bool found;
|
||||
const string& collection = _request->value("collection", found);
|
||||
|
||||
if (! found || collection.empty()) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_ARANGO_COLLECTION_PARAMETER_MISSING,
|
||||
"'collection' is missing, expecting " + DOCUMENT_IMPORT_PATH + "?collection=<identifier>");
|
||||
return false;
|
||||
}
|
||||
|
||||
ResourceHolder holder;
|
||||
|
||||
char* errmsg = 0;
|
||||
TRI_json_t* documents = TRI_Json2String(TRI_UNKNOWN_MEM_ZONE, _request->body(), &errmsg);
|
||||
|
||||
if (! holder.registerJson(TRI_UNKNOWN_MEM_ZONE, documents)) {
|
||||
if (errmsg == 0) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_CORRUPTED_JSON,
|
||||
"cannot parse json object");
|
||||
}
|
||||
else {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_CORRUPTED_JSON,
|
||||
errmsg);
|
||||
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, errmsg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (documents->_type != TRI_JSON_LIST) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||
"expecting a JSON list in the request");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! checkCreateCollection(collection, TRI_COL_TYPE_DOCUMENT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// find and load collection given by name or identifier
|
||||
SingleCollectionWriteTransaction<StandaloneTransaction<RestTransactionContext>, UINT64_MAX> trx(_vocbase, _resolver, collection);
|
||||
|
||||
// .............................................................................
|
||||
// inside write transaction
|
||||
// .............................................................................
|
||||
|
||||
int res = trx.begin();
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
generateTransactionError(collection, res);
|
||||
return false;
|
||||
}
|
||||
|
||||
TRI_primary_collection_t* primary = trx.primaryCollection();
|
||||
const TRI_voc_cid_t cid = trx.cid();
|
||||
const bool isEdgeCollection = (primary->base._info._type == TRI_COL_TYPE_EDGE);
|
||||
|
||||
trx.lockWrite();
|
||||
|
||||
for (size_t i = 0; i < documents->_value._objects._length; ++i) {
|
||||
TRI_json_t* values = (TRI_json_t*) TRI_AtVector(&documents->_value._objects, i);
|
||||
|
||||
if (values == 0 || values->_type != TRI_JSON_ARRAY) {
|
||||
LOGGER_WARNING("invalid JSON type (expecting array) at position " << (i + 1));
|
||||
++numError;
|
||||
}
|
||||
else {
|
||||
// now save the document
|
||||
TRI_doc_mptr_t document;
|
||||
|
||||
if (isEdgeCollection) {
|
||||
const char* from = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_FROM);
|
||||
|
||||
if (from == 0) {
|
||||
LOGGER_WARNING("missing '_from' attribute at position " << (i + 1));
|
||||
++numError;
|
||||
continue;
|
||||
}
|
||||
|
||||
const char* to = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_TO);
|
||||
if (to == 0) {
|
||||
LOGGER_WARNING("missing '_to' attribute at position " << (i + 1));
|
||||
++numError;
|
||||
continue;
|
||||
}
|
||||
|
||||
TRI_document_edge_t edge;
|
||||
|
||||
edge._fromCid = cid;
|
||||
edge._toCid = cid;
|
||||
edge._fromKey = 0;
|
||||
edge._toKey = 0;
|
||||
|
||||
int res1 = parseDocumentId(from, edge._fromCid, edge._fromKey);
|
||||
int res2 = parseDocumentId(to, edge._toCid, edge._toKey);
|
||||
|
||||
if (res1 == TRI_ERROR_NO_ERROR && res2 == TRI_ERROR_NO_ERROR) {
|
||||
res = trx.createEdge(&document, values, waitForSync, &edge);
|
||||
}
|
||||
else {
|
||||
res = (res1 != TRI_ERROR_NO_ERROR ? res1 : res2);
|
||||
}
|
||||
|
||||
if (edge._fromKey != 0) {
|
||||
TRI_Free(TRI_CORE_MEM_ZONE, edge._fromKey);
|
||||
}
|
||||
if (edge._toKey != 0) {
|
||||
TRI_Free(TRI_CORE_MEM_ZONE, edge._toKey);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// do not acquire an extra lock
|
||||
res = trx.createDocument(&document, values, waitForSync);
|
||||
}
|
||||
|
||||
|
||||
if (res == TRI_ERROR_NO_ERROR) {
|
||||
++numCreated;
|
||||
}
|
||||
else {
|
||||
LOGGER_WARNING("creating document failed with error: " << TRI_errno_string(res));
|
||||
logDocument(values);
|
||||
++numError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this will commit, even if previous errors occurred
|
||||
res = trx.commit();
|
||||
|
||||
// .............................................................................
|
||||
// outside write transaction
|
||||
// .............................................................................
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
generateTransactionError(collection, res);
|
||||
}
|
||||
else {
|
||||
// generate result
|
||||
size_t numEmpty = 0;
|
||||
generateDocumentsCreated(numCreated, numError, numEmpty);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates documents
|
||||
///
|
||||
/// @REST{POST /_api/import?collection=`collection-name`}
|
||||
///
|
||||
/// Creates documents in the collection identified by `collection-name`.
|
||||
/// The JSON representations of the documents must be passed as the body of the
|
||||
/// POST request.
|
||||
///
|
||||
/// If the documents were created successfully, then a `HTTP 201` is returned.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestImportHandler::createByKeyValueList () {
|
||||
size_t numCreated = 0;
|
||||
size_t numError = 0;
|
||||
size_t numEmpty = 0;
|
||||
size_t numError = 0;
|
||||
size_t numEmpty = 0;
|
||||
|
||||
vector<string> const& suffix = _request->suffix();
|
||||
|
||||
|
@ -569,14 +287,227 @@ bool RestImportHandler::createByKeyValueList () {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (! checkCreateCollection(collection, TRI_COL_TYPE_DOCUMENT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool linewise;
|
||||
|
||||
if (type == "documents") {
|
||||
// linewise import
|
||||
linewise = true;
|
||||
}
|
||||
else if (type == "array" || type == "list") {
|
||||
// non-linewise import
|
||||
linewise = false;
|
||||
}
|
||||
else if (type == "auto") {
|
||||
linewise = true;
|
||||
|
||||
// auto detect import type by peeking at first character
|
||||
const char* ptr = _request->body();
|
||||
const char* end = ptr + _request->bodySize();
|
||||
|
||||
while (ptr < end) {
|
||||
const char c = *ptr;
|
||||
if (c == '\r' || c == '\n' || c == '\t' || c == ' ') {
|
||||
ptr++;
|
||||
continue;
|
||||
}
|
||||
else if (c == '[') {
|
||||
linewise = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_BAD_PARAMETER,
|
||||
"invalid value for 'type'");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// find and load collection given by name or identifier
|
||||
ImportTransactionType trx(_vocbase, _resolver, collection);
|
||||
|
||||
// .............................................................................
|
||||
// inside write transaction
|
||||
// .............................................................................
|
||||
|
||||
int res = trx.begin();
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
generateTransactionError(collection, res);
|
||||
return false;
|
||||
}
|
||||
|
||||
TRI_primary_collection_t* primary = trx.primaryCollection();
|
||||
const bool isEdgeCollection = (primary->base._info._type == TRI_COL_TYPE_EDGE);
|
||||
|
||||
trx.lockWrite();
|
||||
|
||||
if (linewise) {
|
||||
// each line is a separate JSON document
|
||||
const char* ptr = _request->body();
|
||||
const char* end = ptr + _request->bodySize();
|
||||
string line;
|
||||
size_t i = 0;
|
||||
|
||||
while (ptr < end) {
|
||||
// read line until done
|
||||
i++;
|
||||
const char* pos = strchr(ptr, '\n');
|
||||
|
||||
if (pos == 0) {
|
||||
line.assign(ptr, (size_t) (end - ptr));
|
||||
ptr = end;
|
||||
}
|
||||
else {
|
||||
line.assign(ptr, (size_t) (pos - ptr));
|
||||
ptr = pos + 1;
|
||||
}
|
||||
|
||||
StringUtils::trimInPlace(line, "\r\n\t ");
|
||||
if (line.length() == 0) {
|
||||
++numEmpty;
|
||||
continue;
|
||||
}
|
||||
|
||||
TRI_json_t* json = parseJsonLine(line);
|
||||
|
||||
bool success = handleSingleDocument(trx, json, isEdgeCollection, waitForSync, i);
|
||||
|
||||
if (success) {
|
||||
++numCreated;
|
||||
}
|
||||
else {
|
||||
++numError;
|
||||
}
|
||||
|
||||
if (json != 0) {
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
// the entire request body is one JSON document
|
||||
char* errmsg = 0;
|
||||
TRI_json_t* documents = TRI_Json2String(TRI_UNKNOWN_MEM_ZONE, _request->body(), &errmsg);
|
||||
|
||||
if (documents == 0) {
|
||||
if (errmsg == 0) {
|
||||
generateError(HttpResponse::BAD, TRI_ERROR_HTTP_CORRUPTED_JSON);
|
||||
}
|
||||
else {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_CORRUPTED_JSON,
|
||||
errmsg);
|
||||
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, errmsg);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (documents->_type != TRI_JSON_LIST) {
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, documents);
|
||||
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||
"expecting a JSON list in the request");
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t n = documents->_value._objects._length;
|
||||
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
TRI_json_t const* json = (TRI_json_t const*) TRI_AtVector(&documents->_value._objects, i);
|
||||
|
||||
bool success = handleSingleDocument(trx, json, isEdgeCollection, waitForSync, i + 1);
|
||||
|
||||
if (success) {
|
||||
++numCreated;
|
||||
}
|
||||
else {
|
||||
++numError;
|
||||
}
|
||||
}
|
||||
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, documents);
|
||||
}
|
||||
|
||||
|
||||
// this will commit, even if previous errors occurred
|
||||
res = trx.commit();
|
||||
|
||||
// .............................................................................
|
||||
// outside write transaction
|
||||
// .............................................................................
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
generateTransactionError(collection, res);
|
||||
}
|
||||
else {
|
||||
// generate result
|
||||
generateDocumentsCreated(numCreated, numError, numEmpty);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates documents
|
||||
///
|
||||
/// @REST{POST /_api/import?collection=`collection-name`}
|
||||
///
|
||||
/// Creates documents in the collection identified by `collection-name`.
|
||||
/// The JSON representations of the documents must be passed as the body of the
|
||||
/// POST request.
|
||||
///
|
||||
/// If the documents were created successfully, then a `HTTP 201` is returned.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestImportHandler::createFromKeyValueList () {
|
||||
size_t numCreated = 0;
|
||||
size_t numError = 0;
|
||||
size_t numEmpty = 0;
|
||||
|
||||
vector<string> const& suffix = _request->suffix();
|
||||
|
||||
if (suffix.size() != 0) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_SUPERFLUOUS_SUFFICES,
|
||||
"superfluous suffix, expecting " + DOCUMENT_IMPORT_PATH + "?collection=<identifier>");
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool waitForSync = extractWaitForSync();
|
||||
|
||||
// extract the collection name
|
||||
bool found;
|
||||
const string& collection = _request->value("collection", found);
|
||||
|
||||
if (! found || collection.empty()) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_ARANGO_COLLECTION_PARAMETER_MISSING,
|
||||
"'collection' is missing, expecting " + DOCUMENT_IMPORT_PATH + "?collection=<identifier>");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! checkCreateCollection(collection, TRI_COL_TYPE_DOCUMENT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// read line number (optional)
|
||||
const string& lineNumValue = _request->value("line", found);
|
||||
int64_t lineNumber = 0;
|
||||
const string& lineNumValue = _request->value("line", found);
|
||||
if (found) {
|
||||
lineNumber = StringUtils::int64(lineNumValue);
|
||||
}
|
||||
|
||||
|
||||
size_t start = 0;
|
||||
string body(_request->body(), _request->bodySize());
|
||||
size_t next = body.find('\n', start);
|
||||
|
@ -588,69 +519,57 @@ bool RestImportHandler::createByKeyValueList () {
|
|||
return false;
|
||||
}
|
||||
|
||||
ResourceHolder holder;
|
||||
TRI_json_t* keys = 0;
|
||||
|
||||
string line = body.substr(start, next);
|
||||
StringUtils::trimInPlace(line, "\r\n\t ");
|
||||
|
||||
// get first line
|
||||
TRI_json_t* keys = 0;
|
||||
|
||||
if (line != "") {
|
||||
keys = parseJsonLine(line);
|
||||
if (! holder.registerJson(TRI_UNKNOWN_MEM_ZONE, keys)) {
|
||||
LOGGER_WARNING("no JSON data in first line");
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||
"no JSON string list in first line found");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keys == 0 || keys->_type != TRI_JSON_LIST) {
|
||||
if (keys != 0) {
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, keys);
|
||||
}
|
||||
|
||||
if (keys->_type == TRI_JSON_LIST) {
|
||||
if (! checkKeys(keys)) {
|
||||
LOGGER_WARNING("no JSON string list in first line found");
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||
"no JSON string list in first line found");
|
||||
return false;
|
||||
}
|
||||
start = next + 1;
|
||||
}
|
||||
else {
|
||||
LOGGER_WARNING("no JSON string list in first line found");
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||
"no JSON string list in first line found");
|
||||
return false;
|
||||
}
|
||||
LOGGER_WARNING("no JSON string list found first line");
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||
"no JSON string list found in first line");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
||||
if (! checkKeys(keys)) {
|
||||
LOGGER_WARNING("no JSON string list in first line found");
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||
"no JSON string list in first line found");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! checkCreateCollection(collection, TRI_COL_TYPE_DOCUMENT)) {
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, keys);
|
||||
return false;
|
||||
}
|
||||
|
||||
start = next + 1;
|
||||
|
||||
|
||||
// find and load collection given by name or identifier
|
||||
SingleCollectionWriteTransaction<StandaloneTransaction<RestTransactionContext>, UINT64_MAX> trx(_vocbase, _resolver, collection);
|
||||
ImportTransactionType trx(_vocbase, _resolver, collection);
|
||||
|
||||
// .............................................................................
|
||||
// inside write transaction
|
||||
// .............................................................................
|
||||
|
||||
int res = trx.begin();
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, keys);
|
||||
generateTransactionError(collection, res);
|
||||
return false;
|
||||
}
|
||||
|
||||
TRI_primary_collection_t* primary = trx.primaryCollection();
|
||||
const TRI_voc_cid_t cid = trx.cid();
|
||||
const bool isEdgeCollection = (primary->base._info._type == TRI_COL_TYPE_EDGE);
|
||||
|
||||
trx.lockWrite();
|
||||
|
@ -659,8 +578,10 @@ bool RestImportHandler::createByKeyValueList () {
|
|||
// inside write transaction
|
||||
// .............................................................................
|
||||
|
||||
size_t i = (size_t) lineNumber;
|
||||
|
||||
while (next != string::npos && start < body.length()) {
|
||||
lineNumber++;
|
||||
i++;
|
||||
|
||||
next = body.find('\n', start);
|
||||
|
||||
|
@ -679,91 +600,35 @@ bool RestImportHandler::createByKeyValueList () {
|
|||
}
|
||||
|
||||
TRI_json_t* values = parseJsonLine(line);
|
||||
|
||||
if (values) {
|
||||
// got a json document or list
|
||||
TRI_json_t* json;
|
||||
|
||||
|
||||
if (values != 0) {
|
||||
// build the json object from the list
|
||||
json = createJsonObject(keys, values, line);
|
||||
TRI_json_t* json = createJsonObject(keys, values, line);
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values);
|
||||
|
||||
if (json == 0) {
|
||||
++numError;
|
||||
continue;
|
||||
|
||||
bool success = handleSingleDocument(trx, json, isEdgeCollection, waitForSync, i);
|
||||
|
||||
if (json != 0) {
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||
}
|
||||
|
||||
// now save the document
|
||||
TRI_doc_mptr_t document;
|
||||
|
||||
if (isEdgeCollection) {
|
||||
const char* from = extractJsonStringValue(json, TRI_VOC_ATTRIBUTE_FROM);
|
||||
|
||||
if (from == 0) {
|
||||
LOGGER_WARNING("missing '_from' attribute at line " << lineNumber);
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||
++numError;
|
||||
continue;
|
||||
}
|
||||
|
||||
const char* to = extractJsonStringValue(json, TRI_VOC_ATTRIBUTE_TO);
|
||||
if (to == 0) {
|
||||
LOGGER_WARNING("missing '_to' attribute at line " << lineNumber);
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||
++numError;
|
||||
continue;
|
||||
}
|
||||
|
||||
TRI_document_edge_t edge;
|
||||
|
||||
edge._fromCid = cid;
|
||||
edge._toCid = cid;
|
||||
edge._fromKey = 0;
|
||||
edge._toKey = 0;
|
||||
|
||||
int res1 = parseDocumentId(from, edge._fromCid, edge._fromKey);
|
||||
int res2 = parseDocumentId(to, edge._toCid, edge._toKey);
|
||||
|
||||
if (res1 == TRI_ERROR_NO_ERROR && res2 == TRI_ERROR_NO_ERROR) {
|
||||
res = trx.createEdge(&document, json, waitForSync, &edge);
|
||||
}
|
||||
else {
|
||||
res = (res1 != TRI_ERROR_NO_ERROR ? res1 : res2);
|
||||
}
|
||||
|
||||
if (edge._fromKey != 0) {
|
||||
TRI_Free(TRI_CORE_MEM_ZONE, edge._fromKey);
|
||||
}
|
||||
if (edge._toKey != 0) {
|
||||
TRI_Free(TRI_CORE_MEM_ZONE, edge._toKey);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// do not acquire an extra lock
|
||||
res = trx.createDocument(&document, json, waitForSync);
|
||||
}
|
||||
|
||||
|
||||
if (res == TRI_ERROR_NO_ERROR) {
|
||||
|
||||
if (success) {
|
||||
++numCreated;
|
||||
}
|
||||
else {
|
||||
LOGGER_WARNING("creating document failed with error: " << TRI_errno_string(res));
|
||||
logDocument(json);
|
||||
++numError;
|
||||
}
|
||||
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||
}
|
||||
else {
|
||||
LOGGER_WARNING("no valid JSON data in line: " << line);
|
||||
++numError;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// we'll always commit, even if previous errors occurred
|
||||
res = trx.commit();
|
||||
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, keys);
|
||||
|
||||
// .............................................................................
|
||||
// outside write transaction
|
||||
|
|
|
@ -30,6 +30,25 @@
|
|||
|
||||
#include "RestHandler/RestVocbaseBaseHandler.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private defines
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief import transaction shortcut
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define ImportTransactionType SingleCollectionWriteTransaction<StandaloneTransaction<RestTransactionContext>, UINT64_MAX>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- RestImportHandler
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -121,14 +140,24 @@ namespace triagens {
|
|||
/// @brief log an error document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void logDocument (const TRI_json_t* const) const;
|
||||
void logDocument (TRI_json_t const*) const;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief process a single JSON document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool handleSingleDocument (ImportTransactionType&,
|
||||
TRI_json_t const*,
|
||||
const bool,
|
||||
const bool,
|
||||
const size_t);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates documents by JSON objects
|
||||
/// each line of the input stream contains an individual JSON object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool createByDocumentsLines ();
|
||||
bool createFromJson (const string&);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates documents by JSON objects
|
||||
|
@ -138,10 +167,10 @@ namespace triagens {
|
|||
bool createByDocumentsList ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates a documents by JSON arrays
|
||||
/// @brief creates a documents from key/value lists
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool createByKeyValueList ();
|
||||
bool createFromKeyValueList ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates the result
|
||||
|
|
|
@ -1037,6 +1037,9 @@ void RestReplicationHandler::handleCommandInventory () {
|
|||
/// @RESTRETURNCODE{404}
|
||||
/// is returned when the collection could not be found.
|
||||
///
|
||||
/// @RESTRETURNCODE{405}
|
||||
/// is returned when an invalid HTTP method is used.
|
||||
///
|
||||
/// @RESTRETURNCODE{500}
|
||||
/// is returned if an error occurred while assembling the response.
|
||||
///
|
||||
|
@ -1187,7 +1190,52 @@ void RestReplicationHandler::handleCommandDump () {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the configuration of the replication applier
|
||||
/// @brief get the configuration of the replication applier
|
||||
///
|
||||
/// @RESTHEADER{GET /_api/replication/applier-config,returns the configuration of the replication applier}
|
||||
///
|
||||
/// @RESTDESCRIPTION
|
||||
/// Returns the configuration of the replication applier.
|
||||
///
|
||||
/// The body of the response is a JSON hash with the configuration. The
|
||||
/// following attributes may be present in the configuration:
|
||||
///
|
||||
/// - `endpoint`: the logger server to connect to (e.g. "tcp://192.168.173.13:8529").
|
||||
///
|
||||
/// - `username`: an optional ArangoDB username to use when connecting to the endpoint.
|
||||
///
|
||||
/// - `password`: the password to use when connecting to the endpoint.
|
||||
///
|
||||
/// - `connectTimeout`: the timeout (in seconds) when connecting to the endpoint.
|
||||
///
|
||||
/// - `requestTimeout`: the timeout (in seconds) for individual requests to the endpoint.
|
||||
///
|
||||
/// - `autoStart`: whether or not to auto-start the replication applier on
|
||||
/// (next and following) server starts
|
||||
///
|
||||
/// - `adaptivePolling`: whether or not the replication applier will use
|
||||
/// adaptive polling.
|
||||
///
|
||||
/// @RESTRETURNCODES
|
||||
///
|
||||
/// @RESTRETURNCODE{200}
|
||||
/// is returned if the request was executed successfully.
|
||||
///
|
||||
/// @RESTRETURNCODE{405}
|
||||
/// is returned when an invalid HTTP method is used.
|
||||
///
|
||||
/// @RESTRETURNCODE{500}
|
||||
/// is returned if an error occurred while assembling the response.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierGetConfig}
|
||||
/// var url = "/_api/replication/applier-config";
|
||||
/// var response = logCurlRequest('GET', url);
|
||||
///
|
||||
/// assert(response.code === 200);
|
||||
/// logJsonResponse(response);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void RestReplicationHandler::handleCommandApplierGetConfig () {
|
||||
|
@ -1213,7 +1261,87 @@ void RestReplicationHandler::handleCommandApplierGetConfig () {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief configure the replication applier
|
||||
/// @brief set the configuration of the replication applier
|
||||
///
|
||||
/// @RESTHEADER{PUT /_api/replication/applier-config,adjusts the configuration of the replication applier}
|
||||
///
|
||||
/// @RESTBODYPARAM{configuration,json,required}
|
||||
/// A JSON representation of the configuration.
|
||||
///
|
||||
/// @RESTDESCRIPTION
|
||||
/// Sets the configuration of the replication applier. The configuration can
|
||||
/// only be changed while the applier is not running. The updated configuration
|
||||
/// will be saved immediately but only become active with the next start of the
|
||||
/// applier.
|
||||
///
|
||||
/// The body of the request must be JSON hash with the configuration. The
|
||||
/// following attributes are allowed for the configuration:
|
||||
///
|
||||
/// - `endpoint`: the logger server to connect to (e.g. "tcp://192.168.173.13:8529").
|
||||
/// The endpoint must be specified.
|
||||
///
|
||||
/// - `username`: an optional ArangoDB username to use when connecting to the endpoint.
|
||||
///
|
||||
/// - `password`: the password to use when connecting to the endpoint.
|
||||
///
|
||||
/// - `connectTimeout`: the timeout (in seconds) when connecting to the endpoint.
|
||||
///
|
||||
/// - `requestTimeout`: the timeout (in seconds) for individual requests to the endpoint.
|
||||
///
|
||||
/// - `autoStart`: whether or not to auto-start the replication applier on
|
||||
/// (next and following) server starts
|
||||
///
|
||||
/// - `adaptivePolling`: if set to `true`, the replication applier will fall
|
||||
/// to sleep for an increasingly long period in case the logger server at the
|
||||
/// endpoint does not have any more replication events to apply. Using
|
||||
/// adaptive polling is thus useful to reduce the amount of work for both the
|
||||
/// applier and the logger server for cases when there are only infrequent
|
||||
/// changes. The downside is that when using adaptive polling, it might take
|
||||
/// longer for the replication applier to detect that there are new replication
|
||||
/// events on the logger server.
|
||||
///
|
||||
/// Setting `adaptivePolling` to false will make the replication applier
|
||||
/// contact the logger server in a constant interval, regardless of whether
|
||||
/// the logger server provides updates frequently or seldomly.
|
||||
///
|
||||
/// In case of success, the body of the response is a JSON hash with the updated
|
||||
/// configuration.
|
||||
///
|
||||
/// @RESTRETURNCODES
|
||||
///
|
||||
/// @RESTRETURNCODE{200}
|
||||
/// is returned if the request was executed successfully.
|
||||
///
|
||||
/// @RESTRETURNCODE{400}
|
||||
/// is returned if the configuration is incomplete or malformed, or if the
|
||||
/// replication applier is currently running.
|
||||
///
|
||||
/// @RESTRETURNCODE{405}
|
||||
/// is returned when an invalid HTTP method is used.
|
||||
///
|
||||
/// @RESTRETURNCODE{500}
|
||||
/// is returned if an error occurred while assembling the response.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierSetConfig}
|
||||
/// var re = require("org/arangodb/replication");
|
||||
/// re.applier.stop();
|
||||
///
|
||||
/// var url = "/_api/replication/applier-config";
|
||||
/// var body = {
|
||||
/// endpoint: "tcp://127.0.0.1:8529",
|
||||
/// username: "replicationApplier",
|
||||
/// password: "applier1234@foxx",
|
||||
/// autoStart: false,
|
||||
/// adaptivePolling: true
|
||||
/// };
|
||||
///
|
||||
/// var response = logCurlRequest('PUT', url, JSON.stringify(body));
|
||||
///
|
||||
/// assert(response.code === 200);
|
||||
/// logJsonResponse(response);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void RestReplicationHandler::handleCommandApplierSetConfig () {
|
||||
|
@ -1229,9 +1357,21 @@ void RestReplicationHandler::handleCommandApplierSetConfig () {
|
|||
return;
|
||||
}
|
||||
|
||||
TRI_json_t const* value;
|
||||
const string endpoint = JsonHelper::getStringValue(json, "endpoint", "");
|
||||
|
||||
config._endpoint = TRI_DuplicateString2Z(TRI_CORE_MEM_ZONE, endpoint.c_str(), endpoint.size());
|
||||
config._endpoint = TRI_DuplicateString2Z(TRI_CORE_MEM_ZONE, endpoint.c_str(), endpoint.size());
|
||||
|
||||
value = JsonHelper::getArrayElement(json, "username");
|
||||
if (JsonHelper::isString(value)) {
|
||||
config._username = TRI_DuplicateString2Z(TRI_CORE_MEM_ZONE, value->_value._string.data, value->_value._string.length - 1);
|
||||
}
|
||||
|
||||
value = JsonHelper::getArrayElement(json, "password");
|
||||
if (JsonHelper::isString(value)) {
|
||||
config._password = TRI_DuplicateString2Z(TRI_CORE_MEM_ZONE, value->_value._string.data, value->_value._string.length - 1);
|
||||
}
|
||||
|
||||
config._requestTimeout = JsonHelper::getDoubleValue(json, "requestTimeout", config._requestTimeout);
|
||||
config._connectTimeout = JsonHelper::getDoubleValue(json, "connectTimeout", config._connectTimeout);
|
||||
config._ignoreErrors = JsonHelper::getUInt64Value(json, "ignoreErrors", config._ignoreErrors);
|
||||
|
@ -1246,15 +1386,72 @@ void RestReplicationHandler::handleCommandApplierSetConfig () {
|
|||
TRI_DestroyConfigurationReplicationApplier(&config);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
generateError(HttpResponse::SERVER_ERROR, res);
|
||||
if (res == TRI_ERROR_REPLICATION_INVALID_CONFIGURATION ||
|
||||
res == TRI_ERROR_REPLICATION_RUNNING) {
|
||||
generateError(HttpResponse::BAD, res);
|
||||
}
|
||||
else {
|
||||
generateError(HttpResponse::SERVER_ERROR, res);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
handleCommandApplierGetState();
|
||||
|
||||
handleCommandApplierGetConfig();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief start the replication applier
|
||||
///
|
||||
/// @RESTHEADER{PUT /_api/replication/applier-start,starts the replication applier}
|
||||
///
|
||||
/// @RESTDESCRIPTION
|
||||
/// Starts the replication applier. This will return immediately if the
|
||||
/// replication applier is already running.
|
||||
///
|
||||
/// If the replication applier is not already running, the applier configuration
|
||||
/// will be checked, and if it is complete, the applier will be started in a
|
||||
/// background thread. This means that even if the applier will encounter any
|
||||
/// errors while running, they will not be reported in the response to this
|
||||
/// method.
|
||||
///
|
||||
/// To detect replication applier errors after the applier was started, use the
|
||||
/// `/_api/replication/applier-state` API instead.
|
||||
///
|
||||
/// @RESTRETURNCODES
|
||||
///
|
||||
/// @RESTRETURNCODE{200}
|
||||
/// is returned if the request was executed successfully.
|
||||
///
|
||||
/// @RESTRETURNCODE{400}
|
||||
/// is returned if the replication applier is not fully configured or the
|
||||
/// configuration is invalid.
|
||||
///
|
||||
/// @RESTRETURNCODE{405}
|
||||
/// is returned when an invalid HTTP method is used.
|
||||
///
|
||||
/// @RESTRETURNCODE{500}
|
||||
/// is returned if an error occurred while assembling the response.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierStart}
|
||||
/// var re = require("org/arangodb/replication");
|
||||
/// re.applier.stop();
|
||||
/// re.applier.properties({
|
||||
/// endpoint: "tcp://127.0.0.1:8529",
|
||||
/// username: "replicationApplier",
|
||||
/// password: "applier1234@foxx",
|
||||
/// autoStart: false,
|
||||
/// adaptivePolling: true
|
||||
/// });
|
||||
///
|
||||
/// var url = "/_api/replication/applier-start";
|
||||
/// var response = logCurlRequest('PUT', url, "");
|
||||
/// re.applier.stop();
|
||||
///
|
||||
/// assert(response.code === 200);
|
||||
/// logJsonResponse(response);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void RestReplicationHandler::handleCommandApplierStart () {
|
||||
|
@ -1274,7 +1471,13 @@ void RestReplicationHandler::handleCommandApplierStart () {
|
|||
int res = TRI_StartReplicationApplier(_vocbase->_replicationApplier, fullSync);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
generateError(HttpResponse::SERVER_ERROR, res);
|
||||
if (res == TRI_ERROR_REPLICATION_INVALID_CONFIGURATION ||
|
||||
res == TRI_ERROR_REPLICATION_RUNNING) {
|
||||
generateError(HttpResponse::BAD, res);
|
||||
}
|
||||
else {
|
||||
generateError(HttpResponse::SERVER_ERROR, res);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1282,7 +1485,46 @@ void RestReplicationHandler::handleCommandApplierStart () {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief stop the replication applier
|
||||
/// @brief stops the replication applier
|
||||
///
|
||||
/// @RESTHEADER{PUT /_api/replication/applier-stop,stops the replication applier}
|
||||
///
|
||||
/// @RESTDESCRIPTION
|
||||
/// Stops the replication applier. This will return immediately if the
|
||||
/// replication applier is not running.
|
||||
///
|
||||
/// @RESTRETURNCODES
|
||||
///
|
||||
/// @RESTRETURNCODE{200}
|
||||
/// is returned if the request was executed successfully.
|
||||
///
|
||||
/// @RESTRETURNCODE{405}
|
||||
/// is returned when an invalid HTTP method is used.
|
||||
///
|
||||
/// @RESTRETURNCODE{500}
|
||||
/// is returned if an error occurred while assembling the response.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierStop}
|
||||
/// var re = require("org/arangodb/replication");
|
||||
/// re.applier.stop();
|
||||
/// re.applier.properties({
|
||||
/// endpoint: "tcp://127.0.0.1:8529",
|
||||
/// username: "replicationApplier",
|
||||
/// password: "applier1234@foxx",
|
||||
/// autoStart: false,
|
||||
/// adaptivePolling: true
|
||||
/// });
|
||||
///
|
||||
/// re.applier.start();
|
||||
/// var url = "/_api/replication/applier-stop";
|
||||
/// var response = logCurlRequest('PUT', url, "");
|
||||
/// re.applier.stop();
|
||||
///
|
||||
/// assert(response.code === 200);
|
||||
/// logJsonResponse(response);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void RestReplicationHandler::handleCommandApplierStop () {
|
||||
|
@ -1299,7 +1541,105 @@ void RestReplicationHandler::handleCommandApplierStop () {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the state of the replication applier
|
||||
/// @brief returns the state of the replication applier
|
||||
///
|
||||
/// @RESTHEADER{GET /_api/replication/applier-state,returns the state of the replication applier}
|
||||
///
|
||||
/// @RESTDESCRIPTION
|
||||
/// Returns the state of the replication applier, regardless of whether the
|
||||
/// applier is currently running or not.
|
||||
///
|
||||
/// The response is a JSON hash with the following attributes:
|
||||
///
|
||||
/// - `state`: a JSON hash with the following sub-attributes:
|
||||
///
|
||||
/// - `running`: whether or not the applier is active and running
|
||||
///
|
||||
/// - `lastAppliedContinuousTick`: the last tick value from the continuous
|
||||
/// replication log the applier has applied.
|
||||
///
|
||||
/// - `lastProcessedContinuousTick`: the last tick value from the continuous
|
||||
/// replication log the applier has processed.
|
||||
///
|
||||
/// Regularly, the last applied and last processed tick values should be
|
||||
/// identical. For transactional operations, the replication applier will first
|
||||
/// process incoming log events before applying them, so the processed tick
|
||||
/// value might be higher than the applied tick value. This will be the case
|
||||
/// until the applier encounters the `transaction commit` log event for the
|
||||
/// transaction.
|
||||
///
|
||||
/// - `lastAvailableContinuousTick`: the last tick value the logger server can
|
||||
/// provide.
|
||||
///
|
||||
/// - `time`: the time on the applier server.
|
||||
///
|
||||
/// - `progress`: a JSON hash with details about the replication applier progress.
|
||||
/// It contains the following sub-attributes if there is progress to report:
|
||||
///
|
||||
/// - `message`: a textual description of the progress
|
||||
///
|
||||
/// - `time`: the date and time the progress was logged
|
||||
///
|
||||
/// - `lastError`: a JSON hash with details about the last error that happened on
|
||||
/// the applier. It contains the following sub-attributes if there was an error:
|
||||
///
|
||||
/// - `errorNum`: a numerical error code
|
||||
///
|
||||
/// - `errorMessage`: a textual error description
|
||||
///
|
||||
/// - `time`: the date and time the error occurred
|
||||
///
|
||||
/// In case no error has occurred, `lastError` will be empty.
|
||||
///
|
||||
/// - `server`: a JSON hash with the following sub-attributes:
|
||||
///
|
||||
/// - `version`: the applier server's version
|
||||
///
|
||||
/// - `serverId`: the applier server's id
|
||||
///
|
||||
/// - `endpoint`: the endpoint the applier is connected to (if applier is
|
||||
/// active) or will connect to (if applier is currently inactive)
|
||||
///
|
||||
/// @RESTRETURNCODES
|
||||
///
|
||||
/// @RESTRETURNCODE{200}
|
||||
/// is returned if the request was executed successfully.
|
||||
///
|
||||
/// @RESTRETURNCODE{405}
|
||||
/// is returned when an invalid HTTP method is used.
|
||||
///
|
||||
/// @RESTRETURNCODE{500}
|
||||
/// is returned if an error occurred while assembling the response.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// Fetching the state of an inactive applier:
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierStateNotRunning}
|
||||
/// var re = require("org/arangodb/replication");
|
||||
/// re.applier.stop();
|
||||
///
|
||||
/// var url = "/_api/replication/applier-state";
|
||||
/// var response = logCurlRequest('GET', url);
|
||||
///
|
||||
/// assert(response.code === 200);
|
||||
/// logJsonResponse(response);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
///
|
||||
/// Fetching the state of an active applier:
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_RUN{RestReplicationApplierStateRunning}
|
||||
/// var re = require("org/arangodb/replication");
|
||||
/// re.applier.stop();
|
||||
/// re.applier.start();
|
||||
///
|
||||
/// var url = "/_api/replication/applier-state";
|
||||
/// var response = logCurlRequest('GET', url);
|
||||
/// re.applier.stop();
|
||||
///
|
||||
/// assert(response.code === 200);
|
||||
/// logJsonResponse(response);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void RestReplicationHandler::handleCommandApplierGetState () {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"notes": "Creates an new collection with a given name. The request must contain an object with the following attributes. <br><br>- <em>name</em>: The name of the collection.<br><br>- <em>waitForSync</em> (optional, default: false): If <em>true</em> then the data is synchronised to disk before returning from a create or update of a document. <br><br>- <em>doCompact</em> (optional, default is <em>true</em>): whether or not the collection will be compacted. <br><br>- <em>journalSize</em> (optional, default is a @ref CommandLineArangod \"configuration parameter\"): The maximal size of a journal or datafile. Note that this also limits the maximal size of a single object. Must be at least 1MB. <br><br>- <em>isSystem</em> (optional, default is <em>false</em>): If <em>true</em>, create a system collection. In this case <em>collection-name</em> 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. <br><br>- <em>isVolatile</em> (optional, default is <em>false</em>): If <em>true</em> then the collection data is kept in-memory only and not made persistent. Unloading the collection will cause the collection data to be discarded. Stopping or re-starting the server will also cause full loss of data in the collection. Setting this option will make the resulting collection be slightly faster than regular collections because ArangoDB does not enforce any synchronisation to disk and does not calculate any CRC checksums for datafiles (as there are no datafiles). <br><br> This option should threrefore be used for cache-type collections only, and not for data that cannot be re-created otherwise. <br><br>- <em>keyOptions</em> (optional) additional options for key generation. If specified, then <em>keyOptions</em> should be a JSON array containing the following attributes (note: some of them are optional): - <em>type</em>: specifies the type of the key generator. The currently available generators are <em>traditional</em> and <em>autoincrement</em>. - <em>allowUserKeys</em>: if set to <em>true</em>, then it is allowed to supply own key values in the <em>_key</em> attribute of a document. If set to <em>false</em>, then the key generator will solely be responsible for generating keys and supplying own key values in the <em>_key</em> attribute of documents is considered an error. - <em>increment</em>: increment value for <em>autoincrement</em> key generator. Not used for other key generator types. - <em>offset</em>: initial offset value for <em>autoincrement</em> key generator. Not used for other key generator types. <br><br>- <em>type</em> (optional, default is <em>2</em>): the type of the collection to create. The following values for <em>type</em> are valid: - <em>2</em>: document collection - <em>3</em>: edges collection <br><br>",
|
||||
"summary": "creates a collection",
|
||||
"httpMethod": "POST",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionBasics\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionBasics\n\n{ \n \"id\" : \"23563747\", \n \"name\" : \"testCollectionBasics\", \n \"waitForSync\" : false, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\nunix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionEdges\",\"type\":3}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionEdges\n\n{ \n \"id\" : \"24546787\", \n \"name\" : \"testCollectionEdges\", \n \"waitForSync\" : false, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"status\" : 3, \n \"type\" : 3, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br><br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionUsers\",\"keyOptions\":{\"type\":\"autoincrement\",\"increment\":5,\"allowUserKeys\":true}}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionUsers\n\n{ \n \"id\" : \"25464291\", \n \"name\" : \"testCollectionUsers\", \n \"waitForSync\" : false, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionBasics\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionBasics\n\n{ \n \"id\" : \"17552594\", \n \"name\" : \"testCollectionBasics\", \n \"waitForSync\" : false, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\nunix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionEdges\",\"type\":3}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionEdges\n\n{ \n \"id\" : \"18535634\", \n \"name\" : \"testCollectionEdges\", \n \"waitForSync\" : false, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"status\" : 3, \n \"type\" : 3, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br><br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/collection\n{\"name\":\"testCollectionUsers\",\"keyOptions\":{\"type\":\"autoincrement\",\"increment\":5,\"allowUserKeys\":true}}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/testCollectionUsers\n\n{ \n \"id\" : \"19453138\", \n \"name\" : \"testCollectionUsers\", \n \"waitForSync\" : false, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createsACollection"
|
||||
}
|
||||
],
|
||||
|
@ -41,7 +41,7 @@
|
|||
"notes": "Returns an object with an attribute <em>collections</em> containing a list of all collection descriptions. The same information is also available in the <em>names</em> as hash map with the collection names as keys. <br><br>By providing the optional URL parameter <em>excludeSystem</em> with a value of <em>true</em>, all system collections will be excluded from the response. <br><br>",
|
||||
"summary": "reads all collections",
|
||||
"httpMethod": "GET",
|
||||
"examples": "Return information about all collections: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"collections\" : [ \n { \n \"id\" : \"19303907\", \n \"name\" : \"demo\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"8097251\", \n \"name\" : \"_trx\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"8818147\", \n \"name\" : \"_replication\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"20811235\", \n \"name\" : \"animals\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"4689379\", \n \"name\" : \"_structures\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"5475811\", \n \"name\" : \"_aal\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"6393315\", \n \"name\" : \"_aqlfunctions\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"1478115\", \n \"name\" : \"_graphs\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"7114211\", \n \"name\" : \"_fishbowl\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"2919907\", \n \"name\" : \"_routing\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"101859\", \n \"name\" : \"_users\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"2264547\", \n \"name\" : \"_modules\", \n \"status\" : 3, \n \"type\" : 2 \n } \n ], \n \"names\" : { \n \"demo\" : { \n \"id\" : \"19303907\", \n \"name\" : \"demo\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_trx\" : { \n \"id\" : \"8097251\", \n \"name\" : \"_trx\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_replication\" : { \n \"id\" : \"8818147\", \n \"name\" : \"_replication\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"animals\" : { \n \"id\" : \"20811235\", \n \"name\" : \"animals\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_structures\" : { \n \"id\" : \"4689379\", \n \"name\" : \"_structures\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_aal\" : { \n \"id\" : \"5475811\", \n \"name\" : \"_aal\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_aqlfunctions\" : { \n \"id\" : \"6393315\", \n \"name\" : \"_aqlfunctions\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_graphs\" : { \n \"id\" : \"1478115\", \n \"name\" : \"_graphs\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_fishbowl\" : { \n \"id\" : \"7114211\", \n \"name\" : \"_fishbowl\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_routing\" : { \n \"id\" : \"2919907\", \n \"name\" : \"_routing\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_users\" : { \n \"id\" : \"101859\", \n \"name\" : \"_users\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_modules\" : { \n \"id\" : \"2264547\", \n \"name\" : \"_modules\", \n \"status\" : 3, \n \"type\" : 2 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "Return information about all collections: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"collections\" : [ \n { \n \"id\" : \"1496274\", \n \"name\" : \"_graphs\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"120018\", \n \"name\" : \"_users\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"2938066\", \n \"name\" : \"_routing\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"2282706\", \n \"name\" : \"_modules\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"8049874\", \n \"name\" : \"_trx\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"8836306\", \n \"name\" : \"_replication\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"4707538\", \n \"name\" : \"_structures\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"5493970\", \n \"name\" : \"_aal\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"13292754\", \n \"name\" : \"demo\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"7001298\", \n \"name\" : \"_fishbowl\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"6345938\", \n \"name\" : \"_aqlfunctions\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n { \n \"id\" : \"14800082\", \n \"name\" : \"animals\", \n \"status\" : 3, \n \"type\" : 2 \n } \n ], \n \"names\" : { \n \"_graphs\" : { \n \"id\" : \"1496274\", \n \"name\" : \"_graphs\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_users\" : { \n \"id\" : \"120018\", \n \"name\" : \"_users\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_routing\" : { \n \"id\" : \"2938066\", \n \"name\" : \"_routing\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_modules\" : { \n \"id\" : \"2282706\", \n \"name\" : \"_modules\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_trx\" : { \n \"id\" : \"8049874\", \n \"name\" : \"_trx\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_replication\" : { \n \"id\" : \"8836306\", \n \"name\" : \"_replication\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_structures\" : { \n \"id\" : \"4707538\", \n \"name\" : \"_structures\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_aal\" : { \n \"id\" : \"5493970\", \n \"name\" : \"_aal\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"demo\" : { \n \"id\" : \"13292754\", \n \"name\" : \"demo\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_fishbowl\" : { \n \"id\" : \"7001298\", \n \"name\" : \"_fishbowl\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"_aqlfunctions\" : { \n \"id\" : \"6345938\", \n \"name\" : \"_aqlfunctions\", \n \"status\" : 3, \n \"type\" : 2 \n }, \n \"animals\" : { \n \"id\" : \"14800082\", \n \"name\" : \"animals\", \n \"status\" : 3, \n \"type\" : 2 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "readsAllCollections"
|
||||
}
|
||||
],
|
||||
|
@ -99,7 +99,7 @@
|
|||
"notes": "In addition to the above, the result will always contain the <em>waitForSync</em>, <em>doCompact</em>, <em>journalSize</em>, and <em>isVolatile</em> properties. This is achieved by forcing a load of the underlying collection. <br><br>- <em>waitForSync</em>: If <em>true</em> then creating or changing a document will wait until the data has been synchronised to disk. <br><br>- <em>doCompact</em>: Whether or not the collection will be compacted.<br><br>- <em>journalSize</em>: The maximal size setting for journals / datafiles.<br><br>- <em>isVolatile</em>: If <em>true</em> then the collection data will be kept in memory only and ArangoDB will not write or sync the data to disk. <br><br>",
|
||||
"summary": "reads the properties of a collection",
|
||||
"httpMethod": "GET",
|
||||
"examples": "Using an identifier: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/26119651/properties\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/properties\n\n{ \n \"id\" : \"26119651\", \n \"name\" : \"products\", \n \"doCompact\" : true, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"journalSize\" : 1048576, \n \"keyOptions\" : { \n \"type\" : \"traditional\", \n \"allowUserKeys\" : true \n }, \n \"waitForSync\" : true, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Using a name: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/products/properties\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/properties\n\n{ \n \"id\" : \"26775011\", \n \"name\" : \"products\", \n \"doCompact\" : true, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"journalSize\" : 1048576, \n \"keyOptions\" : { \n \"type\" : \"traditional\", \n \"allowUserKeys\" : true \n }, \n \"waitForSync\" : true, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "Using an identifier: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/20174034/properties\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/properties\n\n{ \n \"id\" : \"20174034\", \n \"name\" : \"products\", \n \"doCompact\" : true, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"journalSize\" : 1048576, \n \"keyOptions\" : { \n \"type\" : \"traditional\", \n \"allowUserKeys\" : true \n }, \n \"waitForSync\" : true, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Using a name: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/products/properties\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/properties\n\n{ \n \"id\" : \"20829394\", \n \"name\" : \"products\", \n \"doCompact\" : true, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"journalSize\" : 1048576, \n \"keyOptions\" : { \n \"type\" : \"traditional\", \n \"allowUserKeys\" : true \n }, \n \"waitForSync\" : true, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "readsThePropertiesOfACollection"
|
||||
}
|
||||
],
|
||||
|
@ -130,7 +130,7 @@
|
|||
"notes": "In addition to the above, the result also contains the number of documents. Note that this will always load the collection into memory. <br><br>- <em>count</em>: The number of documents inside the collection.<br><br>",
|
||||
"summary": "returns the number of documents in a collection",
|
||||
"httpMethod": "GET",
|
||||
"examples": "Using an identifier and requesting the number of documents: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/27430371/count\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/count\n\n{ \n \"id\" : \"27430371\", \n \"name\" : \"products\", \n \"doCompact\" : true, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"journalSize\" : 1048576, \n \"keyOptions\" : { \n \"type\" : \"traditional\", \n \"allowUserKeys\" : true \n }, \n \"waitForSync\" : true, \n \"count\" : 100, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "Using an identifier and requesting the number of documents: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/21484754/count\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/count\n\n{ \n \"id\" : \"21484754\", \n \"name\" : \"products\", \n \"doCompact\" : true, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"journalSize\" : 1048576, \n \"keyOptions\" : { \n \"type\" : \"traditional\", \n \"allowUserKeys\" : true \n }, \n \"waitForSync\" : true, \n \"count\" : 100, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "returnsTheNumberOfDocumentsInACollection"
|
||||
}
|
||||
],
|
||||
|
@ -161,7 +161,7 @@
|
|||
"notes": "In addition to the above, the result also contains the number of documents and additional statistical information about the collection. Note that this will always load the collection into memory. <br><br>- <em>count</em>: The number of documents inside the collection.<br><br>- <em>figures.alive.count</em>: The number of living documents.<br><br>- <em>figures.alive.size</em>: The total size in bytes used by all living documents. <br><br>- <em>figures.dead.count</em>: The number of dead documents.<br><br>- <em>figures.dead.size</em>: The total size in bytes used by all dead documents. <br><br>- <em>figures.dead.deletion</em>: The total number of deletion markers.<br><br>- <em>figures.datafiles.count</em>: The number of active datafiles.- <em>figures.datafiles.fileSize</em>: The total filesize of datafiles.<br><br>- <em>figures.journals.count</em>: The number of journal files.- <em>figures.journals.fileSize</em>: The total filesize of journal files.<br><br>- <em>figures.shapes.count</em>: The total number of shapes used in the collection (this includes shapes that are not in use anymore) <br><br>- <em>figures.attributes.count</em>: The total number of attributes used in the collection (this includes attributes that are not in use anymore) <br><br>- <em>journalSize</em>: The maximal size of the journal in bytes.<br><br>Note: the filesizes of shapes and compactor files are not reported. <br><br>",
|
||||
"summary": "returns the stats for a collection",
|
||||
"httpMethod": "GET",
|
||||
"examples": "Using an identifier and requesting the figures of the collection: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/48008675/figures\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/figures\n\n{ \n \"id\" : \"48008675\", \n \"name\" : \"products\", \n \"doCompact\" : true, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"journalSize\" : 1048576, \n \"keyOptions\" : { \n \"type\" : \"traditional\", \n \"allowUserKeys\" : true \n }, \n \"waitForSync\" : true, \n \"count\" : 0, \n \"figures\" : { \n \"alive\" : { \n \"count\" : 0, \n \"size\" : 0 \n }, \n \"dead\" : { \n \"count\" : 0, \n \"size\" : 0, \n \"deletion\" : 0 \n }, \n \"datafiles\" : { \n \"count\" : 0, \n \"fileSize\" : 0 \n }, \n \"journals\" : { \n \"count\" : 0, \n \"fileSize\" : 0 \n }, \n \"shapes\" : { \n \"count\" : 6 \n }, \n \"attributes\" : { \n \"count\" : 0 \n } \n }, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "Using an identifier and requesting the figures of the collection: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/42063058/figures\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nlocation: /_api/collection/products/figures\n\n{ \n \"id\" : \"42063058\", \n \"name\" : \"products\", \n \"doCompact\" : true, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"journalSize\" : 1048576, \n \"keyOptions\" : { \n \"type\" : \"traditional\", \n \"allowUserKeys\" : true \n }, \n \"waitForSync\" : true, \n \"count\" : 0, \n \"figures\" : { \n \"alive\" : { \n \"count\" : 0, \n \"size\" : 0 \n }, \n \"dead\" : { \n \"count\" : 0, \n \"size\" : 0, \n \"deletion\" : 0 \n }, \n \"datafiles\" : { \n \"count\" : 0, \n \"fileSize\" : 0 \n }, \n \"journals\" : { \n \"count\" : 0, \n \"fileSize\" : 0 \n }, \n \"shapes\" : { \n \"count\" : 6 \n }, \n \"attributes\" : { \n \"count\" : 0 \n } \n }, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "returnsTheStatsForACollection"
|
||||
}
|
||||
],
|
||||
|
@ -192,7 +192,7 @@
|
|||
"notes": "In addition to the above, the result will also contain the collection's revision id. The revision id is a server-generated string that clients can use to check whether data in a collection has changed since the last revision check. <br><br>- <em>revision</em>: The collection revision id as a string.<br><br>",
|
||||
"summary": "return a collection revision id",
|
||||
"httpMethod": "GET",
|
||||
"examples": "Retrieving the revision of a collection <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/48795107/revision\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"48795107\", \n \"name\" : \"products\", \n \"status\" : 3, \n \"type\" : 2, \n \"revision\" : \"0\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "Retrieving the revision of a collection <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/42915026/revision\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"42915026\", \n \"name\" : \"products\", \n \"status\" : 3, \n \"type\" : 2, \n \"revision\" : \"0\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "returnACollectionRevisionId"
|
||||
}
|
||||
],
|
||||
|
@ -230,7 +230,7 @@
|
|||
"notes": "Will calculate checksum of the meta-data (keys and revision ids) and optionally document data in the collection. <br><br>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. <br><br>By default, the checksum will only be calculated on the <em>_key</em> and <em>_rev</em> system attributes of the documents contained in the collection. For edge collections, the system attributes <em>_from</em> and <em>_to</em> will also be included in the calculation. <br><br>By providing the optional URL parameter <em>withData</em> with a value of <em>true</em>, the user-defined document attributes will be included in the calculation too. Note that including user-defined attributes will make the checksumming slower. <br><br>- <em>checksum</em>: The calculated checksum as a number.<br><br>- <em>revision</em>: The collection revision id as a string.<br><br>",
|
||||
"summary": "returns a checksum for the collection",
|
||||
"httpMethod": "GET",
|
||||
"examples": "Retrieving the checksum of a collection: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/49581539/checksum\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"49581539\", \n \"name\" : \"products\", \n \"status\" : 3, \n \"type\" : 2, \n \"checksum\" : 6064344, \n \"revision\" : \"50564579\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "Retrieving the checksum of a collection: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/collection/43635922/checksum\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"43635922\", \n \"name\" : \"products\", \n \"status\" : 3, \n \"type\" : 2, \n \"checksum\" : 4087899028, \n \"revision\" : \"44618962\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "returnsAChecksumForTheCollection"
|
||||
}
|
||||
],
|
||||
|
@ -261,7 +261,7 @@
|
|||
"notes": "Loads a collection into memory. Returns the collection on success. <br><br>The request might optionally contain the following attribute: <br><br>- <em>count</em>: If set, this controls whether the return value should include the number of documents in the collection. Setting <em>count</em> to <em>false</em> may speed up loading a collection. The default value for <em>count</em> is <em>true</em>. <br><br>On success an object with the following attributes is returned: <br><br>- <em>id</em>: The identifier of the collection.<br><br>- <em>name</em>: The name of the collection.<br><br>- <em>count</em>: The number of documents inside the collection. This is only returned if the <em>count</em> input parameters is set to <em>true</em> or has not been specified. <br><br>- <em>status</em>: The status of the collection as number.<br><br>- <em>type</em>: The collection type. Valid types are: - 2: document collection - 3: edges collection <br><br>",
|
||||
"summary": "loads a collection",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/collection/50695651/load\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"50695651\", \n \"name\" : \"products\", \n \"count\" : 0, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/collection/44750034/load\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"44750034\", \n \"name\" : \"products\", \n \"count\" : 0, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "loadsACollection"
|
||||
}
|
||||
],
|
||||
|
@ -292,7 +292,7 @@
|
|||
"notes": "Removes a collection from memory. This call does not delete any documents. You can use the collection afterwards; in which case it will be loaded into memory, again. On success an object with the following attributes is returned: <br><br>- <em>id</em>: The identifier of the collection.<br><br>- <em>name</em>: The name of the collection.<br><br>- <em>status</em>: The status of the collection as number.<br><br>- <em>type</em>: The collection type. Valid types are: - 2: document collection - 3: edges collection <br><br>",
|
||||
"summary": "unloads a collection",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/collection/51416547/unload\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"51416547\", \n \"name\" : \"products\", \n \"status\" : 2, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/collection/45536466/unload\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"45536466\", \n \"name\" : \"products\", \n \"status\" : 2, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "unloadsACollection"
|
||||
}
|
||||
],
|
||||
|
@ -314,7 +314,7 @@
|
|||
"notes": "Removes all documents from the collection, but leaves the indexes intact. <br><br>",
|
||||
"summary": "truncates a collection",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/collection/52137443/truncate\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"52137443\", \n \"name\" : \"products\", \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/collection/46191826/truncate\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"46191826\", \n \"name\" : \"products\", \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "truncatesACollection"
|
||||
}
|
||||
],
|
||||
|
@ -336,7 +336,7 @@
|
|||
"notes": "Changes the properties of a collection. Expects an object with the attribute(s) <br><br>- <em>waitForSync</em>: If <em>true</em> then creating or changing a document will wait until the data has been synchronised to disk. <br><br>- <em>journalSize</em>: Size (in bytes) for new journal files that are created for the collection. <br><br>If returns an object with the attributes <br><br>- <em>id</em>: The identifier of the collection.<br><br>- <em>name</em>: The name of the collection.<br><br>- <em>waitForSync</em>: The new value.<br><br>- <em>journalSize</em>: The new value.<br><br>- <em>status</em>: The status of the collection as number.<br><br>- <em>type</em>: The collection type. Valid types are: - 2: document collection - 3: edges collection <br><br>Note: some other collection properties, such as <em>type</em> or <em>isVolatile</em> cannot be changed once the collection is created. <br><br>",
|
||||
"summary": "changes the properties of a collection",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/collection/52858339/properties\n{\"waitForSync\":true}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"52858339\", \n \"name\" : \"products\", \n \"doCompact\" : true, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"journalSize\" : 1048576, \n \"keyOptions\" : { \n \"type\" : \"traditional\", \n \"allowUserKeys\" : true \n }, \n \"waitForSync\" : true, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/collection/46978258/properties\n{\"waitForSync\":true}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"46978258\", \n \"name\" : \"products\", \n \"doCompact\" : true, \n \"isVolatile\" : false, \n \"isSystem\" : false, \n \"journalSize\" : 1048576, \n \"keyOptions\" : { \n \"type\" : \"traditional\", \n \"allowUserKeys\" : true \n }, \n \"waitForSync\" : true, \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "changesThePropertiesOfACollection"
|
||||
}
|
||||
],
|
||||
|
@ -358,7 +358,7 @@
|
|||
"notes": "Renames a collection. Expects an object with the attribute(s) <br><br>- <em>name</em>: The new name.<br><br>If returns an object with the attributes <br><br>- <em>id</em>: The identifier of the collection.<br><br>- <em>name</em>: The new name of the collection.<br><br>- <em>status</em>: The status of the collection as number.<br><br>- <em>type</em>: The collection type. Valid types are: - 2: document collection - 3: edges collection <br><br>",
|
||||
"summary": "renames a collection",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/collection/53579235/rename\n{\"name\":\"newname\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"53579235\", \n \"name\" : \"newname\", \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/collection/47633618/rename\n{\"name\":\"newname\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"47633618\", \n \"name\" : \"newname\", \n \"status\" : 3, \n \"type\" : 2, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "renamesACollection"
|
||||
}
|
||||
],
|
||||
|
@ -389,7 +389,7 @@
|
|||
"notes": "Deletes a collection identified by <em>collection-name</em>. <br><br>If the collection was successfully deleted then, an object is returned with the following attributes: <br><br>- <em>error</em>: <em>false</em><br><br>- <em>id</em>: The identifier of the deleted collection.<br><br>",
|
||||
"summary": "deletes a collection",
|
||||
"httpMethod": "DELETE",
|
||||
"examples": "Using an identifier: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/collection/54234595\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"54234595\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Using a name: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/collection/products1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"54889955\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "Using an identifier: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/collection/48354514\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"48354514\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Using a name: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/collection/products1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"49075410\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "deletesACollection"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"notes": "The query details include the query string plus optional query options and bind parameters. These values need to be passed in a JSON representation in the body of the POST request. <br><br>The following attributes can be used inside the JSON object: <br><br>- <em>query</em>: contains the query string to be executed (mandatory)<br><br>- <em>count</em>: boolean flag that indicates whether the number of documents in the result set should be returned in the \"count\" attribute of the result (optional). Calculating the \"count\" attribute might in the future have a performance impact for some queries so this option is turned off by default, and \"count\" is only returned when requested. <br><br>- <em>batchSize</em>: 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. <br><br>- <em>bindVars</em>: key/value list of bind parameters (optional). <br><br>If the result set can be created by the server, the server will respond with <em>HTTP 201</em>. The body of the response will contain a JSON object with the result set. <br><br>The JSON object has the following properties: <br><br>- <em>error</em>: boolean flag to indicate that an error occurred (<em>false</em> in this case) <br><br>- <em>code</em>: the HTTP status code<br><br>- <em>result</em>: an array of result documents (might be empty if query has no results)<br><br>- <em>hasMore</em>: a boolean indicator whether there are more results available on the server <br><br>- <em>count</em>: the total number of result documents available (only available if the query was executed with the <em>count</em> attribute set. <br><br>- <em>id</em>: id of temporary cursor created on the server (optional, see above)<br><br>If the JSON representation is malformed or the query specification is missing from the request, the server will respond with <em>HTTP 400</em>. <br><br>The body of the response will contain a JSON object with additional error details. The object has the following attributes: <br><br>- <em>error</em>: boolean flag to indicate that an error occurred (<em>true</em> in this case)<br><br>- <em>code</em>: the HTTP status code<br><br>- <em>errorNum</em>: the server error number<br><br>- <em>errorMessage</em>: a descriptive error message<br><br>If the query specification is complete, the server will process the query. If an error occurs during query processing, the server will respond with <em>HTTP 400</em>. Again, the body of the response will contain details about the error. <br><br>A list of query errors can be found the manual here. <br><br>",
|
||||
"summary": "creates a cursor",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Executes a query and extract the result in a single go: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 2 RETURN p\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/56462819\", \n \"_rev\" : \"56462819\", \n \"_key\" : \"56462819\", \n \"hello1\" : \"world1\" \n }, \n { \n \"_id\" : \"products/56856035\", \n \"_rev\" : \"56856035\", \n \"_key\" : \"56856035\", \n \"hello2\" : \"world1\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Executes a query and extract part of the result: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 5 RETURN p\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/58953187\", \n \"_rev\" : \"58953187\", \n \"_key\" : \"58953187\", \n \"hello4\" : \"world1\" \n }, \n { \n \"_id\" : \"products/57904611\", \n \"_rev\" : \"57904611\", \n \"_key\" : \"57904611\", \n \"hello1\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"59477475\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Bad queries: Missing body: <br><br><pre><code class=\"json\" >unix> curl -X POST --dump - http://localhost:8529/_api/cursor\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 1502, \n \"errorMessage\" : \"query is empty\" \n}\n\n</code></pre><br>Unknown collection: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR u IN unknowncoll LIMIT 2 RETURN u\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 1203, \n \"errorMessage\" : \"cannot execute query: collection not found: 'unknowncoll'\" \n}\n\n</code></pre><br>",
|
||||
"examples": "Executes a query and extract the result in a single go: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 2 RETURN p\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/50648274\", \n \"_rev\" : \"50648274\", \n \"_key\" : \"50648274\", \n \"hello1\" : \"world1\" \n }, \n { \n \"_id\" : \"products/50975954\", \n \"_rev\" : \"50975954\", \n \"_key\" : \"50975954\", \n \"hello2\" : \"world1\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Executes a query and extract part of the result: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 5 RETURN p\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/52745426\", \n \"_rev\" : \"52745426\", \n \"_key\" : \"52745426\", \n \"hello3\" : \"world1\" \n }, \n { \n \"_id\" : \"products/53073106\", \n \"_rev\" : \"53073106\", \n \"_key\" : \"53073106\", \n \"hello4\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"53597394\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Bad queries: Missing body: <br><br><pre><code class=\"json\" >unix> curl -X POST --dump - http://localhost:8529/_api/cursor\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 1502, \n \"errorMessage\" : \"query is empty\" \n}\n\n</code></pre><br>Unknown collection: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR u IN unknowncoll LIMIT 2 RETURN u\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 1203, \n \"errorMessage\" : \"cannot execute query: collection not found: 'unknowncoll'\" \n}\n\n</code></pre><br>",
|
||||
"nickname": "createsACursor"
|
||||
}
|
||||
],
|
||||
|
@ -63,7 +63,7 @@
|
|||
"notes": "<br><br>If the cursor is still alive, returns an object with the following attributes. <br><br>- <em>id</em>: the <em>cursor-identifier</em>- <em>result</em>: a list of documents for the current batch- <em>hasMore</em>: <em>false</em> if this was the last batch- <em>count</em>: if present the total number of elements<br><br>Note that even if <em>hasMore</em> returns <em>true</em>, the next call might still return no documents. If, however, <em>hasMore</em> is <em>false</em>, then the cursor is exhausted. Once the <em>hasMore</em> attribute has a value of <em>false</em>, the client can stop. <br><br>",
|
||||
"summary": "reads next batch from a cursor",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "Valid request for next batch: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 5 RETURN p\",\"count\":true,\"batchSize\":2}\n\nunix> curl -X PUT --dump - http://localhost:8529/_api/cursor/61967843\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/60460515\", \n \"_rev\" : \"60460515\", \n \"_key\" : \"60460515\", \n \"hello1\" : \"world1\" \n }, \n { \n \"_id\" : \"products/61771235\", \n \"_rev\" : \"61771235\", \n \"_key\" : \"61771235\", \n \"hello5\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"61967843\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Missing identifier <br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/cursor\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 400, \n \"errorMessage\" : \"bad parameter\" \n}\n\n</code></pre><br>Unknown identifier <br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/cursor/123123\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 1600, \n \"errorMessage\" : \"cursor not found\" \n}\n\n</code></pre><br>",
|
||||
"examples": "Valid request for next batch: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 5 RETURN p\",\"count\":true,\"batchSize\":2}\n\nunix> curl -X PUT --dump - http://localhost:8529/_api/cursor/56087762\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/55563474\", \n \"_rev\" : \"55563474\", \n \"_key\" : \"55563474\", \n \"hello4\" : \"world1\" \n }, \n { \n \"_id\" : \"products/54580434\", \n \"_rev\" : \"54580434\", \n \"_key\" : \"54580434\", \n \"hello1\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"56087762\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Missing identifier <br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/cursor\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 400, \n \"errorMessage\" : \"bad parameter\" \n}\n\n</code></pre><br>Unknown identifier <br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/cursor/123123\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 1600, \n \"errorMessage\" : \"cursor not found\" \n}\n\n</code></pre><br>",
|
||||
"nickname": "readsNextBatchFromACursor"
|
||||
}
|
||||
],
|
||||
|
@ -94,7 +94,7 @@
|
|||
"notes": "Deletes the cursor and frees the resources associated with it. <br><br>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. <br><br>Note: the server will also destroy abandoned cursors automatically after a certain server-controlled timeout to avoid resource leakage. <br><br>",
|
||||
"summary": "deletes a cursor",
|
||||
"httpMethod": "DELETE",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 5 RETURN p\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/62950883\", \n \"_rev\" : \"62950883\", \n \"_key\" : \"62950883\", \n \"hello1\" : \"world1\" \n }, \n { \n \"_id\" : \"products/63933923\", \n \"_rev\" : \"63933923\", \n \"_key\" : \"63933923\", \n \"hello4\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"64458211\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\nunix> curl -X DELETE --dump - http://localhost:8529/_api/cursor/64458211\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR p IN products LIMIT 5 RETURN p\",\"count\":true,\"batchSize\":2}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/58053842\", \n \"_rev\" : \"58053842\", \n \"_key\" : \"58053842\", \n \"hello4\" : \"world1\" \n }, \n { \n \"_id\" : \"products/57398482\", \n \"_rev\" : \"57398482\", \n \"_key\" : \"57398482\", \n \"hello2\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"58578130\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\nunix> curl -X DELETE --dump - http://localhost:8529/_api/cursor/58578130\n\n</code></pre><br>",
|
||||
"nickname": "deletesACursor"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
"notes": "Creates a new document in the collection named <em>collection</em>. A JSON representation of the document must be passed as the body of the POST request. <br><br>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. <br><br>The body of the response contains a JSON object with the following attributes: <br><br>- <em>_id</em> contains the document handle of the newly created document- <em>_key</em> contains the document key- <em>_rev</em> contains the document revision<br><br>If the collection parameter <em>waitForSync</em> is <em>false</em>, then the call returns as soon as the document has been accepted. It will not wait until the document has been synced to disk. <br><br>Optionally, the URL parameter <em>waitForSync</em> can be used to force synchronisation of the document creation operation to disk even in case that the <em>waitForSync</em> flag had been disabled for the entire collection. Thus, the <em>waitForSync</em> URL parameter can be used to force synchronisation of just this specific operations. To use this, set the <em>waitForSync</em> parameter to <em>true</em>. If the <em>waitForSync</em> parameter is not specified or set to <em>false</em>, then the collection's default <em>waitForSync</em> behavior is applied. The <em>waitForSync</em> URL parameter cannot be used to disable synchronisation for collections that have a default <em>waitForSync</em> value of <em>true</em>. <br><br>",
|
||||
"summary": "creates a document",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Create a document given a collection named <em>products</em>. Note that the revision identifier might or might not by equal to the auto-generated key. <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: \"292523491\"\nlocation: /_api/document/products/292523491\n\n{ \n \"error\" : false, \n \"_id\" : \"products/292523491\", \n \"_rev\" : \"292523491\", \n \"_key\" : \"292523491\" \n}\n\n</code></pre><br>Create a document in a collection named <em>products</em> with a collection-level <em>waitForSync</em> value of <em>false</em>. <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"293506531\"\nlocation: /_api/document/products/293506531\n\n{ \n \"error\" : false, \n \"_id\" : \"products/293506531\", \n \"_rev\" : \"293506531\", \n \"_key\" : \"293506531\" \n}\n\n</code></pre><br>Create a document in a collection with a collection-level <em>waitForSync</em> value of <em>false</em>, but using the <em>waitForSync</em> URL parameter. <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products&waitForSync=true\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: \"294555107\"\nlocation: /_api/document/products/294555107\n\n{ \n \"error\" : false, \n \"_id\" : \"products/294555107\", \n \"_rev\" : \"294555107\", \n \"_key\" : \"294555107\" \n}\n\n</code></pre><br>Create a document in a new, named collection <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products&createCollection=true\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"295603683\"\nlocation: /_api/document/products/295603683\n\n{ \n \"error\" : false, \n \"_id\" : \"products/295603683\", \n \"_rev\" : \"295603683\", \n \"_key\" : \"295603683\" \n}\n\n</code></pre><br>Unknown collection name: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"collection /_api/collection/products not found\", \n \"code\" : 404, \n \"errorNum\" : 1203 \n}\n\n</code></pre><br>Illegal document: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ 1: \"World\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"expecting attribute name\", \n \"code\" : 400, \n \"errorNum\" : 600 \n}\n\n</code></pre><br>",
|
||||
"examples": "Create a document given a collection named <em>products</em>. Note that the revision identifier might or might not by equal to the auto-generated key. <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: \"291296466\"\nlocation: /_api/document/products/291296466\n\n{ \n \"error\" : false, \n \"_id\" : \"products/291296466\", \n \"_rev\" : \"291296466\", \n \"_key\" : \"291296466\" \n}\n\n</code></pre><br>Create a document in a collection named <em>products</em> with a collection-level <em>waitForSync</em> value of <em>false</em>. <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"292345042\"\nlocation: /_api/document/products/292345042\n\n{ \n \"error\" : false, \n \"_id\" : \"products/292345042\", \n \"_rev\" : \"292345042\", \n \"_key\" : \"292345042\" \n}\n\n</code></pre><br>Create a document in a collection with a collection-level <em>waitForSync</em> value of <em>false</em>, but using the <em>waitForSync</em> URL parameter. <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products&waitForSync=true\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: \"293393618\"\nlocation: /_api/document/products/293393618\n\n{ \n \"error\" : false, \n \"_id\" : \"products/293393618\", \n \"_rev\" : \"293393618\", \n \"_key\" : \"293393618\" \n}\n\n</code></pre><br>Create a document in a new, named collection <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products&createCollection=true\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"294442194\"\nlocation: /_api/document/products/294442194\n\n{ \n \"error\" : false, \n \"_id\" : \"products/294442194\", \n \"_rev\" : \"294442194\", \n \"_key\" : \"294442194\" \n}\n\n</code></pre><br>Unknown collection name: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ \"Hello\": \"World\" }\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"collection /_api/collection/products not found\", \n \"code\" : 404, \n \"errorNum\" : 1203 \n}\n\n</code></pre><br>Illegal document: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products\n{ 1: \"World\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"expecting attribute name\", \n \"code\" : 400, \n \"errorNum\" : 600 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createsADocument"
|
||||
}
|
||||
],
|
||||
|
@ -106,7 +106,7 @@
|
|||
"notes": "Returns the document identified by <em>document-handle</em>. The returned document contains two special attributes: <em>_id</em> containing the document handle and <em>_rev</em> containing the revision. <br><br>",
|
||||
"summary": "reads a document",
|
||||
"httpMethod": "GET",
|
||||
"examples": "Use a document handle: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/document/products/296652259\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"296652259\"\n\n{ \n \"hello\" : \"world\", \n \"_id\" : \"products/296652259\", \n \"_rev\" : \"296652259\", \n \"_key\" : \"296652259\" \n}\n\n</code></pre><br>Use a document handle and an etag: <br><br><pre><code class=\"json\" >unix> curl --header 'If-None-Match:\"297766371\"' --dump - http://localhost:8529/_api/document/products/297766371\n\n</code></pre><br>Unknown document handle: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/document/products/unknownhandle\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"document /_api/document/products/unknownhandle not found\", \n \"code\" : 404, \n \"errorNum\" : 1202 \n}\n\n</code></pre><br>",
|
||||
"examples": "Use a document handle: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/document/products/295490770\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"295490770\"\n\n{ \n \"hello\" : \"world\", \n \"_id\" : \"products/295490770\", \n \"_rev\" : \"295490770\", \n \"_key\" : \"295490770\" \n}\n\n</code></pre><br>Use a document handle and an etag: <br><br><pre><code class=\"json\" >unix> curl --header 'If-None-Match:\"296604882\"' --dump - http://localhost:8529/_api/document/products/296604882\n\n</code></pre><br>Unknown document handle: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/document/products/unknownhandle\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"document /_api/document/products/unknownhandle not found\", \n \"code\" : 404, \n \"errorNum\" : 1202 \n}\n\n</code></pre><br>",
|
||||
"nickname": "readsADocument"
|
||||
}
|
||||
],
|
||||
|
@ -137,7 +137,7 @@
|
|||
"notes": "Returns a list of all URI for all documents from the collection identified by <em>collection</em>. <br><br>",
|
||||
"summary": "reads all documents from collection",
|
||||
"httpMethod": "GET",
|
||||
"examples": "Returns a collection. <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/document/?collection=products\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"documents\" : [ \n \"/_api/document/products/299339235\", \n \"/_api/document/products/299666915\", \n \"/_api/document/products/298946019\" \n ] \n}\n\n</code></pre><br>Collection does not exist. <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/document/?collection=doesnotexist\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"collection /_api/collection/doesnotexist not found\", \n \"code\" : 404, \n \"errorNum\" : 1203 \n}\n\n</code></pre><br>",
|
||||
"examples": "Returns a collection. <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/document/?collection=products\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"documents\" : [ \n \"/_api/document/products/298177746\", \n \"/_api/document/products/297784530\", \n \"/_api/document/products/298505426\" \n ] \n}\n\n</code></pre><br>Collection does not exist. <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/document/?collection=doesnotexist\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"collection /_api/collection/doesnotexist not found\", \n \"code\" : 404, \n \"errorNum\" : 1203 \n}\n\n</code></pre><br>",
|
||||
"nickname": "readsAllDocumentsFromCollection"
|
||||
}
|
||||
],
|
||||
|
@ -194,7 +194,7 @@
|
|||
"notes": "Like <em>GET</em>, 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. <br><br>",
|
||||
"summary": "reads a document header",
|
||||
"httpMethod": "HEAD",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X HEAD --dump - http://localhost:8529/_api/document/products/300715491\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X HEAD --dump - http://localhost:8529/_api/document/products/299554002\n\n</code></pre><br>",
|
||||
"nickname": "readsADocumentHeader"
|
||||
}
|
||||
],
|
||||
|
@ -261,7 +261,7 @@
|
|||
"notes": "Completely updates (i.e. replaces) the document identified by <em>document-handle</em>. If the document exists and can be updated, then a <em>HTTP 201</em> is returned and the \"ETag\" header field contains the new revision of the document. <br><br>If the new document passed in the body of the request contains the <em>document-handle</em> in the attribute <em>_id</em> and the revision in <em>_rev</em>, these attributes will be ignored. Only the URI and the \"ETag\" header are relevant in order to avoid confusion when using proxies. <br><br>Optionally, the URL parameter <em>waitForSync</em> can be used to force synchronisation of the document replacement operation to disk even in case that the <em>waitForSync</em> flag had been disabled for the entire collection. Thus, the <em>waitForSync</em> URL parameter can be used to force synchronisation of just specific operations. To use this, set the <em>waitForSync</em> parameter to <em>true</em>. If the <em>waitForSync</em> parameter is not specified or set to <em>false</em>, then the collection's default <em>waitForSync</em> behavior is applied. The <em>waitForSync</em> URL parameter cannot be used to disable synchronisation for collections that have a default <em>waitForSync</em> value of <em>true</em>. <br><br>The body of the response contains a JSON object with the information about the handle and the revision. The attribute <em>_id</em> contains the known <em>document-handle</em> of the updated document, the attribute <em>_rev</em> contains the new document revision. <br><br>If the document does not exist, then a <em>HTTP 404</em> is returned and the body of the response contains an error document. <br><br>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 <em>rev</em> URL query parameter- specifying the target revision in the <em>if-match</em> HTTP header<br><br>Specifying a target revision is optional, however, if done, only one of the described mechanisms must be used (either the <em>rev</em> URL parameter or the <em>if-match</em> HTTP header). Regardless which mechanism is used, the parameter needs to contain the target document revision id as returned in the <em>_rev</em> attribute of a document or by an HTTP <em>etag</em> header. <br><br>For example, to conditionally replace a document based on a specific revision id, you the following request: <br><br>- PUT /_api/document/<em>document-handle</em>?rev=<em>etag</em><br><br>If a target revision id is provided in the request (e.g. via the <em>etag</em> value in the <em>rev</em> 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 <em>HTTP 412</em> conflict is returned and no replacement is performed. <br><br>The conditional update behavior can be overriden with the <em>policy</em> URL query parameter: <br><br>- PUT /_api/document/<em>document-handle</em>?policy=<em>policy</em><br><br>If <em>policy</em> is set to <em>error</em>, 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. <br><br>If <em>policy</em> is set to <em>last</em>, 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 <em>last</em> `policy` to force replacements. <br><br>",
|
||||
"summary": "replaces a document",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "Using document handle: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/301829603\n{\"Hello\": \"you\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"302222819\"\nlocation: /_api/document/products/301829603\n\n{ \n \"error\" : false, \n \"_id\" : \"products/301829603\", \n \"_rev\" : \"302222819\", \n \"_key\" : \"301829603\" \n}\n\n</code></pre><br>Unknown document handle: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/303205859\n{}\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"document /_api/document/products/303205859 not found\", \n \"code\" : 404, \n \"errorNum\" : 1202 \n}\n\n</code></pre><br>Produce a revision conflict: <br><br><pre><code class=\"json\" >unix> curl -X PUT --header 'If-Match:\"304975331\"' --data @- --dump - http://localhost:8529/_api/document/products/304582115\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/304582115\", \n \"_rev\" : \"304582115\", \n \"_key\" : \"304582115\" \n}\n\n</code></pre><br>Last write wins: <br><br><pre><code class=\"json\" >unix> curl -X PUT --header 'If-Match:\"306548195\"' --data @- --dump - http://localhost:8529/_api/document/products/306154979?policy=last\n{}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"306810339\"\nlocation: /_api/document/products/306154979\n\n{ \n \"error\" : false, \n \"_id\" : \"products/306154979\", \n \"_rev\" : \"306810339\", \n \"_key\" : \"306154979\" \n}\n\n</code></pre><br>Alternative to header field: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/307793379?rev=308186595\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/307793379\", \n \"_rev\" : \"307793379\", \n \"_key\" : \"307793379\" \n}\n\n</code></pre><br>",
|
||||
"examples": "Using document handle: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/300668114\n{\"Hello\": \"you\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"301061330\"\nlocation: /_api/document/products/300668114\n\n{ \n \"error\" : false, \n \"_id\" : \"products/300668114\", \n \"_rev\" : \"301061330\", \n \"_key\" : \"300668114\" \n}\n\n</code></pre><br>Unknown document handle: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/302044370\n{}\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"document /_api/document/products/302044370 not found\", \n \"code\" : 404, \n \"errorNum\" : 1202 \n}\n\n</code></pre><br>Produce a revision conflict: <br><br><pre><code class=\"json\" >unix> curl -X PUT --header 'If-Match:\"303813842\"' --data @- --dump - http://localhost:8529/_api/document/products/303420626\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/303420626\", \n \"_rev\" : \"303420626\", \n \"_key\" : \"303420626\" \n}\n\n</code></pre><br>Last write wins: <br><br><pre><code class=\"json\" >unix> curl -X PUT --header 'If-Match:\"305386706\"' --data @- --dump - http://localhost:8529/_api/document/products/304993490?policy=last\n{}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"305648850\"\nlocation: /_api/document/products/304993490\n\n{ \n \"error\" : false, \n \"_id\" : \"products/304993490\", \n \"_rev\" : \"305648850\", \n \"_key\" : \"304993490\" \n}\n\n</code></pre><br>Alternative to header field: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/306631890?rev=307025106\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/306631890\", \n \"_rev\" : \"306631890\", \n \"_key\" : \"306631890\" \n}\n\n</code></pre><br>",
|
||||
"nickname": "replacesADocument"
|
||||
}
|
||||
],
|
||||
|
@ -334,7 +334,7 @@
|
|||
"notes": "Partially updates the document identified by <em>document-handle</em>. 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. <br><br>Setting an attribute value to <em>null</em> in the patch document will cause a value of <em>null</em> be saved for the attribute by default. <br><br>Optionally, the URL parameter <em>waitForSync</em> can be used to force synchronisation of the document update operation to disk even in case that the <em>waitForSync</em> flag had been disabled for the entire collection. Thus, the <em>waitForSync</em> URL parameter can be used to force synchronisation of just specific operations. To use this, set the <em>waitForSync</em> parameter to <em>true</em>. If the <em>waitForSync</em> parameter is not specified or set to <em>false</em>, then the collection's default <em>waitForSync</em> behavior is applied. The <em>waitForSync</em> URL parameter cannot be used to disable synchronisation for collections that have a default <em>waitForSync</em> value of <em>true</em>. <br><br>The body of the response contains a JSON object with the information about the handle and the revision. The attribute <em>_id</em> contains the known <em>document-handle</em> of the updated document, the attribute <em>_rev</em> contains the new document revision. <br><br>If the document does not exist, then a <em>HTTP 404</em> is returned and the body of the response contains an error document. <br><br>You can conditionally update a document based on a target revision id by using either the <em>rev</em> URL parameter or the <em>if-match</em> HTTP header. To control the update behavior in case there is a revision mismatch, you can use the <em>policy</em> parameter. This is the same as when replacing documents (see replacing documents for details). <br><br>",
|
||||
"summary": "patches a document",
|
||||
"httpMethod": "PATCH",
|
||||
"examples": "patches an existing document with new content. <br><br><pre><code class=\"json\" >unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/309366243\n{\"hello\":\"world\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"309759459\"\nlocation: /_api/document/products/309366243\n\n{ \n \"error\" : false, \n \"_id\" : \"products/309366243\", \n \"_rev\" : \"309759459\", \n \"_key\" : \"309366243\" \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/309366243\n{\"numbers\":{\"one\":1,\"two\":2,\"three\":3,\"empty\":null}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"310349283\"\nlocation: /_api/document/products/309366243\n\n{ \n \"error\" : false, \n \"_id\" : \"products/309366243\", \n \"_rev\" : \"310349283\", \n \"_key\" : \"309366243\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/309366243\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"310349283\"\n\n{ \n \"one\" : \"world\", \n \"hello\" : \"world\", \n \"numbers\" : { \n \"empty\" : null, \n \"one\" : 1, \n \"two\" : 2, \n \"three\" : 3 \n }, \n \"_id\" : \"products/309366243\", \n \"_rev\" : \"310349283\", \n \"_key\" : \"309366243\" \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/309366243?keepNull=false\n{\"hello\":null,\"numbers\":{\"four\":4}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"310808035\"\nlocation: /_api/document/products/309366243\n\n{ \n \"error\" : false, \n \"_id\" : \"products/309366243\", \n \"_rev\" : \"310808035\", \n \"_key\" : \"309366243\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/309366243\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"310808035\"\n\n{ \n \"one\" : \"world\", \n \"numbers\" : { \n \"empty\" : null, \n \"one\" : 1, \n \"two\" : 2, \n \"three\" : 3, \n \"four\" : 4 \n }, \n \"_id\" : \"products/309366243\", \n \"_rev\" : \"310808035\", \n \"_key\" : \"309366243\" \n}\n\n</code></pre><br>",
|
||||
"examples": "patches an existing document with new content. <br><br><pre><code class=\"json\" >unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/308204754\n{\"hello\":\"world\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"308597970\"\nlocation: /_api/document/products/308204754\n\n{ \n \"error\" : false, \n \"_id\" : \"products/308204754\", \n \"_rev\" : \"308597970\", \n \"_key\" : \"308204754\" \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/308204754\n{\"numbers\":{\"one\":1,\"two\":2,\"three\":3,\"empty\":null}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"309187794\"\nlocation: /_api/document/products/308204754\n\n{ \n \"error\" : false, \n \"_id\" : \"products/308204754\", \n \"_rev\" : \"309187794\", \n \"_key\" : \"308204754\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/308204754\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"309187794\"\n\n{ \n \"one\" : \"world\", \n \"hello\" : \"world\", \n \"numbers\" : { \n \"empty\" : null, \n \"one\" : 1, \n \"two\" : 2, \n \"three\" : 3 \n }, \n \"_id\" : \"products/308204754\", \n \"_rev\" : \"309187794\", \n \"_key\" : \"308204754\" \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/document/products/308204754?keepNull=false\n{\"hello\":null,\"numbers\":{\"four\":4}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"309646546\"\nlocation: /_api/document/products/308204754\n\n{ \n \"error\" : false, \n \"_id\" : \"products/308204754\", \n \"_rev\" : \"309646546\", \n \"_key\" : \"308204754\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/308204754\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"309646546\"\n\n{ \n \"one\" : \"world\", \n \"numbers\" : { \n \"empty\" : null, \n \"one\" : 1, \n \"two\" : 2, \n \"three\" : 3, \n \"four\" : 4 \n }, \n \"_id\" : \"products/308204754\", \n \"_rev\" : \"309646546\", \n \"_key\" : \"308204754\" \n}\n\n</code></pre><br>",
|
||||
"nickname": "patchesADocument"
|
||||
}
|
||||
],
|
||||
|
@ -397,7 +397,7 @@
|
|||
"notes": "The body of the response contains a JSON object with the information about the handle and the revision. The attribute <em>_id</em> contains the known <em>document-handle</em> of the updated document, the attribute <em>_rev</em> contains the known document revision. <br><br>If the <em>waitForSync</em> parameter is not specified or set to <em>false</em>, then the collection's default <em>waitForSync</em> behavior is applied. The <em>waitForSync</em> URL parameter cannot be used to disable synchronisation for collections that have a default <em>waitForSync</em> value of <em>true</em>. <br><br>",
|
||||
"summary": "deletes a document",
|
||||
"httpMethod": "DELETE",
|
||||
"examples": "Using document handle: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/document/products/311922147\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"_id\" : \"products/311922147\", \n \"_rev\" : \"311922147\", \n \"_key\" : \"311922147\" \n}\n\n</code></pre><br>Unknown document handle: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/document/products/313167331\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"document /_api/document/products/313167331 not found\", \n \"code\" : 404, \n \"errorNum\" : 1202 \n}\n\n</code></pre><br>Revision conflict: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --header 'If-Match:\"314871267\"' --dump - http://localhost:8529/_api/document/products/314478051\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/314478051\", \n \"_rev\" : \"314478051\", \n \"_key\" : \"314478051\" \n}\n\n</code></pre><br>",
|
||||
"examples": "Using document handle: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/document/products/310760658\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"_id\" : \"products/310760658\", \n \"_rev\" : \"310760658\", \n \"_key\" : \"310760658\" \n}\n\n</code></pre><br>Unknown document handle: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/document/products/312005842\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"document /_api/document/products/312005842 not found\", \n \"code\" : 404, \n \"errorNum\" : 1202 \n}\n\n</code></pre><br>Revision conflict: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --header 'If-Match:\"313709778\"' --dump - http://localhost:8529/_api/document/products/313316562\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/313316562\", \n \"_rev\" : \"313316562\", \n \"_key\" : \"313316562\" \n}\n\n</code></pre><br>",
|
||||
"nickname": "deletesADocument"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
"notes": "<em>from</em> handle and <em>to</em> handle are immutable once the edge has been created. <br><br>In all other respects the method works like <em>POST /document</em>, see the manual for details. <br><br>",
|
||||
"summary": "creates an edge",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Create an edge and reads it back: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/edge/?collection=edges&from=vertices/1&to=vertices/2\n{\"name\":\"Emil\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"318016995\"\nlocation: /_api/document/edges/318016995\n\n{ \n \"error\" : false, \n \"_id\" : \"edges/318016995\", \n \"_rev\" : \"318016995\", \n \"_key\" : \"318016995\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/edge/edges/318016995\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"318016995\"\n\n{ \n \"name\" : \"Emil\", \n \"_id\" : \"edges/318016995\", \n \"_rev\" : \"318016995\", \n \"_key\" : \"318016995\", \n \"_from\" : \"vertices/1\", \n \"_to\" : \"vertices/2\" \n}\n\n</code></pre><br>",
|
||||
"examples": "Create an edge and reads it back: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/edge/?collection=edges&from=vertices/1&to=vertices/2\n{\"name\":\"Emil\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"316855506\"\nlocation: /_api/document/edges/316855506\n\n{ \n \"error\" : false, \n \"_id\" : \"edges/316855506\", \n \"_rev\" : \"316855506\", \n \"_key\" : \"316855506\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/edge/edges/316855506\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"316855506\"\n\n{ \n \"name\" : \"Emil\", \n \"_id\" : \"edges/316855506\", \n \"_rev\" : \"316855506\", \n \"_key\" : \"316855506\", \n \"_from\" : \"vertices/1\", \n \"_to\" : \"vertices/2\" \n}\n\n</code></pre><br>",
|
||||
"nickname": "createsAnEdge"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"notes": "Returns the list of edges starting or ending in the vertex identified by <em>vertex-handle</em>. <br><br>",
|
||||
"summary": "reads in- or outbound edges",
|
||||
"httpMethod": "GET",
|
||||
"examples": "Any direction <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"edges\" : [ \n { \n \"_id\" : \"edges/6\", \n \"_rev\" : \"69176803\", \n \"_key\" : \"6\", \n \"_from\" : \"vertices/2\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v2 -> v1\" \n }, \n { \n \"_id\" : \"edges/7\", \n \"_rev\" : \"69766627\", \n \"_key\" : \"7\", \n \"_from\" : \"vertices/4\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v4 -> v1\" \n }, \n { \n \"_id\" : \"edges/5\", \n \"_rev\" : \"68586979\", \n \"_key\" : \"5\", \n \"_from\" : \"vertices/1\", \n \"_to\" : \"vertices/3\", \n \"$label\" : \"v1 -> v3\" \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>In edges <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=in\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"edges\" : [ \n { \n \"_id\" : \"edges/6\", \n \"_rev\" : \"74681827\", \n \"_key\" : \"6\", \n \"_from\" : \"vertices/2\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v2 -> v1\" \n }, \n { \n \"_id\" : \"edges/7\", \n \"_rev\" : \"75271651\", \n \"_key\" : \"7\", \n \"_from\" : \"vertices/4\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v4 -> v1\" \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Out edges <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=out\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"edges\" : [ \n { \n \"_id\" : \"edges/5\", \n \"_rev\" : \"79597027\", \n \"_key\" : \"5\", \n \"_from\" : \"vertices/1\", \n \"_to\" : \"vertices/3\", \n \"$label\" : \"v1 -> v3\" \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "Any direction <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"edges\" : [ \n { \n \"_id\" : \"edges/6\", \n \"_rev\" : \"63296722\", \n \"_key\" : \"6\", \n \"_from\" : \"vertices/2\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v2 -> v1\" \n }, \n { \n \"_id\" : \"edges/7\", \n \"_rev\" : \"63886546\", \n \"_key\" : \"7\", \n \"_from\" : \"vertices/4\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v4 -> v1\" \n }, \n { \n \"_id\" : \"edges/5\", \n \"_rev\" : \"62706898\", \n \"_key\" : \"5\", \n \"_from\" : \"vertices/1\", \n \"_to\" : \"vertices/3\", \n \"$label\" : \"v1 -> v3\" \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>In edges <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=in\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"edges\" : [ \n { \n \"_id\" : \"edges/6\", \n \"_rev\" : \"68801746\", \n \"_key\" : \"6\", \n \"_from\" : \"vertices/2\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v2 -> v1\" \n }, \n { \n \"_id\" : \"edges/7\", \n \"_rev\" : \"69391570\", \n \"_key\" : \"7\", \n \"_from\" : \"vertices/4\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v4 -> v1\" \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Out edges <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=out\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"edges\" : [ \n { \n \"_id\" : \"edges/5\", \n \"_rev\" : \"73716946\", \n \"_key\" : \"5\", \n \"_from\" : \"vertices/1\", \n \"_to\" : \"vertices/3\", \n \"$label\" : \"v1 -> v3\" \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "readsIn-OrOutboundEdges"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
"notes": "Creates a new graph. <br><br>Returns an object with an attribute <em>graph</em> containing a list of all graph properties. <br><br>",
|
||||
"summary": "create graph",
|
||||
"httpMethod": "POST",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/\n{\"_key\":\"graph\",\"vertices\":\"vertices\",\"edges\":\"edges\"}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: 85167587\n\n{ \n \"graph\" : { \n \"_id\" : \"_graphs/graph\", \n \"_rev\" : \"85167587\", \n \"_key\" : \"graph\", \n \"edges\" : \"edges\", \n \"vertices\" : \"vertices\" \n }, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/\n{\"_key\":\"graph\",\"vertices\":\"vertices\",\"edges\":\"edges\"}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\netag: 79287506\n\n{ \n \"graph\" : { \n \"_id\" : \"_graphs/graph\", \n \"_rev\" : \"79287506\", \n \"_key\" : \"graph\", \n \"edges\" : \"edges\", \n \"vertices\" : \"vertices\" \n }, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createGraph"
|
||||
}
|
||||
],
|
||||
|
@ -49,19 +49,19 @@
|
|||
{
|
||||
"errorResponses": [
|
||||
{
|
||||
"reason": "is returned if the graph was found ",
|
||||
"reason": "is returned if the graph was found (in case <em>graph-name</em> was specified) or the list of graphs was assembled successfully (in case <em>graph-name</em> was not specified). ",
|
||||
"code": "200"
|
||||
},
|
||||
{
|
||||
"reason": "is returned if the graph was not found. The response body contains an error document in this case. ",
|
||||
"reason": "is returned if the graph was not found. This response code may only be returned if <em>graph-name</em> is specified in the request. The response body contains an error document in this case. ",
|
||||
"code": "404"
|
||||
},
|
||||
{
|
||||
"reason": "\"If-None-Match\" header is given and the current graph has not a different version ",
|
||||
"reason": "\"If-None-Match\" header is given and the current graph has not a different version. This response code may only be returned if <em>graph-name</em> is specified in the request. ",
|
||||
"code": "304"
|
||||
},
|
||||
{
|
||||
"reason": "\"If-Match\" header or <em>rev</em> is given and the current graph has a different version ",
|
||||
"reason": "\"If-Match\" header or <em>rev</em> is given and the current graph has a different version. This response code may only be returned if <em>graph-name</em> is specified in the request. ",
|
||||
"code": "412"
|
||||
}
|
||||
],
|
||||
|
@ -69,28 +69,28 @@
|
|||
{
|
||||
"dataType": "String",
|
||||
"paramType": "path",
|
||||
"required": "true",
|
||||
"required": "false",
|
||||
"name": "graph-name",
|
||||
"description": "The name of the graph "
|
||||
"description": "The name of the graph. "
|
||||
},
|
||||
{
|
||||
"dataType": "String",
|
||||
"paramType": "header",
|
||||
"name": "If-None-Match",
|
||||
"description": "If the \"If-None-Match\" header is given, then it must contain exactly one etag. The document is returned, if it has a different revision than the given etag. Otherwise a <em>HTTP 304</em> is returned. "
|
||||
"description": "If <em>graph-name</em> is specified, then this header can be used to check whether a specific graph has changed or not. "
|
||||
},
|
||||
{
|
||||
"dataType": "String",
|
||||
"paramType": "header",
|
||||
"name": "If-Match",
|
||||
"description": "If the \"If-Match\" header is given, then it must contain exactly one etag. The document is returned, if it has the same revision ad the given etag. Otherwise a <em>HTTP 412</em> is returned. As an alternative you can supply the etag in an attribute <em>rev</em> in the URL. "
|
||||
"description": "If <em>graph-name</em> is specified, then this header can be used to check whether a specific graph has changed or not. "
|
||||
}
|
||||
],
|
||||
"notes": "<br><br>Returns an object with an attribute <em>graph</em> containing a list of all graph properties. <br><br>",
|
||||
"summary": "get graph properties",
|
||||
"notes": "<br><br>If <em>graph-name</em> is specified, returns an object with an attribute <em>graph</em> containing a JSON hash with all properties of the specified graph. <br><br>If <em>graph-name</em> is not specified, returns a list of graph objects. <br><br>",
|
||||
"summary": "get the properties of a specific or all graphs",
|
||||
"httpMethod": "GET",
|
||||
"examples": "get graph by name <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/graph/graph\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 87264739\n\n{ \n \"graph\" : { \n \"_id\" : \"_graphs/graph\", \n \"_rev\" : \"87264739\", \n \"_key\" : \"graph\", \n \"edges\" : \"edges\", \n \"vertices\" : \"vertices\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "getGraphProperties"
|
||||
"examples": "get graph by name <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/graph/graph\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 81384658\n\n{ \n \"graph\" : { \n \"_id\" : \"_graphs/graph\", \n \"_rev\" : \"81384658\", \n \"_key\" : \"graph\", \n \"edges\" : \"edges\", \n \"vertices\" : \"vertices\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>get all graphs <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/graph\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"graphs\" : [ \n { \n \"_id\" : \"_graphs/graph2\", \n \"_rev\" : \"85513426\", \n \"_key\" : \"graph2\", \n \"edges\" : \"edges2\", \n \"vertices\" : \"vertices2\" \n }, \n { \n \"_id\" : \"_graphs/graph1\", \n \"_rev\" : \"83612882\", \n \"_key\" : \"graph1\", \n \"edges\" : \"edges1\", \n \"vertices\" : \"vertices1\" \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "getThePropertiesOfASpecificOrAllGraphs"
|
||||
}
|
||||
],
|
||||
"path": "/_api/graph/{graph-name}"
|
||||
|
@ -178,7 +178,7 @@
|
|||
"notes": "Creates a vertex in a graph. <br><br>Returns an object with an attribute <em>vertex</em> containing a list of all vertex properties. <br><br>",
|
||||
"summary": "create vertex",
|
||||
"httpMethod": "POST",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertex\n{\"_key\":\"v1\",\"optional1\":\"val1\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 92245475\n\n{ \n \"vertex\" : { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"92245475\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val1\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertex\n{\"_key\":\"v1\",\"optional1\":\"val1\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 90887378\n\n{ \n \"vertex\" : { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"90887378\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val1\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createVertex"
|
||||
}
|
||||
],
|
||||
|
@ -235,7 +235,7 @@
|
|||
"notes": "Returns an object with an attribute <em>vertex</em> containing a list of all vertex properties. <br><br>",
|
||||
"summary": "get vertex",
|
||||
"httpMethod": "GET",
|
||||
"examples": "get vertex properties by name <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 94801379\n\n{ \n \"vertex\" : { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"94801379\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val1\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "get vertex properties by name <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 93508818\n\n{ \n \"vertex\" : { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"93508818\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val1\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "getVertex"
|
||||
}
|
||||
],
|
||||
|
@ -356,7 +356,7 @@
|
|||
"notes": "Replaces the vertex properties. <br><br>Returns an object with an attribute <em>vertex</em> containing a list of all vertex properties. <br><br>",
|
||||
"summary": "update vertex",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":\"val2\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 101223907\n\n{ \n \"vertex\" : { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"101223907\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val2\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":\"val2\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 99865810\n\n{ \n \"vertex\" : { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"99865810\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val2\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"nickname": "updateVertex"
|
||||
}
|
||||
],
|
||||
|
@ -426,7 +426,7 @@
|
|||
"notes": "Partially updates the vertex properties. <br><br>Setting an attribute value to <em>null</em> in the patch document will cause a value of <em>null</em> be saved for the attribute by default. If the intention is to delete existing attributes with the patch command, the URL parameter <em>keepNull</em> can be used with a value of <em>false</em>. 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 <em>null</em>. Returns an object with an attribute <em>vertex</em> containing a list of all vertex properties. <br><br>",
|
||||
"summary": "update vertex",
|
||||
"httpMethod": "PATCH",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":\"vertexPatch\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 104369635\n\n{ \n \"vertex\" : { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"104369635\", \n \"_key\" : \"v1\", \n \"optional1\" : \"vertexPatch\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":null}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 104893923\n\n{ \n \"vertex\" : { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"104893923\", \n \"_key\" : \"v1\", \n \"optional1\" : null \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":\"vertexPatch\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 103011538\n\n{ \n \"vertex\" : { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"103011538\", \n \"_key\" : \"v1\", \n \"optional1\" : \"vertexPatch\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\nunix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/vertex/v1\n{\"optional1\":null}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 103535826\n\n{ \n \"vertex\" : { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"103535826\", \n \"_key\" : \"v1\", \n \"optional1\" : null \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"nickname": "updateVertex"
|
||||
}
|
||||
],
|
||||
|
@ -460,7 +460,7 @@
|
|||
"notes": "Returns a cursor. <br><br>The call expects a JSON hash array as body to filter the result: <br><br>- <em>batchSize</em>: the batch size of the returned cursor- <em>limit</em>: limit the result size- <em>count</em>: return the total number of results (default \"false\")- <em>filter</em>: a optional filter<br><br>The attributes of filter - <em>properties</em>: filter by an array of vertex properties<br><br>The attributes of a property filter - <em>key</em>: filter the result vertices by a key value pair- <em>value</em>: the value of the <em>key</em>- <em>compare</em>: a compare operator<br><br>",
|
||||
"summary": "get vertices",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Select all vertices <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices\n{\"batchSize\":100}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"vertices/v5\", \n \"_rev\" : \"108826083\", \n \"_key\" : \"v5\", \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"vertices/v4\", \n \"_rev\" : \"108498403\", \n \"_key\" : \"v4\", \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"107449827\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"vertices/v3\", \n \"_rev\" : \"108170723\", \n \"_key\" : \"v3\", \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"vertices/v2\", \n \"_rev\" : \"107843043\", \n \"_key\" : \"v2\", \n \"optional1\" : \"val1\" \n } \n ], \n \"hasMore\" : false, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Select all vertices <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices\n{\"batchSize\":100}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"vertices/v5\", \n \"_rev\" : \"107467986\", \n \"_key\" : \"v5\", \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"vertices/v4\", \n \"_rev\" : \"107140306\", \n \"_key\" : \"v4\", \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"106157266\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"vertices/v3\", \n \"_rev\" : \"106812626\", \n \"_key\" : \"v3\", \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"vertices/v2\", \n \"_rev\" : \"106484946\", \n \"_key\" : \"v2\", \n \"optional1\" : \"val1\" \n } \n ], \n \"hasMore\" : false, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "getVertices"
|
||||
}
|
||||
],
|
||||
|
@ -494,7 +494,7 @@
|
|||
"notes": "Returns a cursor. <br><br>The call expects a JSON hash array as body to filter the result: <br><br>- <em>batchSize</em>: the batch size of the returned cursor- <em>limit</em>: limit the result size- <em>count</em>: return the total number of results (default \"false\")- <em>filter</em>: a optional filter<br><br>The attributes of filter - <em>direction</em>: Filter for inbound (value \"in\") or outbound (value \"out\") neighbors. Default value is \"any\". - <em>labels</em>: filter by an array of edge labels (empty array means no restriction)- <em>properties</em>: filter neighbors by an array of edge properties<br><br>The attributes of a property filter - <em>key</em>: filter the result vertices by a key value pair- <em>value</em>: the value of the <em>key</em>- <em>compare</em>: a compare operator<br><br>",
|
||||
"summary": "get vertices",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Select all vertices <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices/v2\n{\"batchSize\" : 100, \"filter\" : {\"direction\" : \"any\", \"properties\":[] }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"111513059\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"vertices/v4\", \n \"_rev\" : \"112561635\", \n \"_key\" : \"v4\", \n \"optional1\" : \"val1\" \n } \n ], \n \"hasMore\" : false, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Select vertices by direction and property filter <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices/v2\n{\"batchSize\" : 100, \"filter\" : {\"direction\" : \"out\", \"properties\":[ { \"key\": \"optional1\", \"value\": \"val2\", \"compare\" : \"==\" }, ] }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"vertices/v4\", \n \"_rev\" : \"119442915\", \n \"_key\" : \"v4\", \n \"optional1\" : \"val2\" \n }, \n { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"118459875\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val1\" \n } \n ], \n \"hasMore\" : false, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Select all vertices <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices/v2\n{\"batchSize\" : 100, \"filter\" : {\"direction\" : \"any\", \"properties\":[] }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"110154962\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"vertices/v4\", \n \"_rev\" : \"111203538\", \n \"_key\" : \"v4\", \n \"optional1\" : \"val1\" \n } \n ], \n \"hasMore\" : false, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Select vertices by direction and property filter <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/vertices/v2\n{\"batchSize\" : 100, \"filter\" : {\"direction\" : \"out\", \"properties\":[ { \"key\": \"optional1\", \"value\": \"val2\", \"compare\" : \"==\" }, ] }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"vertices/v4\", \n \"_rev\" : \"118084818\", \n \"_key\" : \"v4\", \n \"optional1\" : \"val2\" \n }, \n { \n \"_id\" : \"vertices/v1\", \n \"_rev\" : \"117101778\", \n \"_key\" : \"v1\", \n \"optional1\" : \"val1\" \n } \n ], \n \"hasMore\" : false, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "getVertices"
|
||||
}
|
||||
],
|
||||
|
@ -538,7 +538,7 @@
|
|||
"notes": "Creates an edge in a graph. <br><br>The call expects a JSON hash array as body with the edge properties: <br><br>- <em>_key</em>: The name of the edge.- <em>_from</em>: The name of the from vertex.- <em>_to</em>: The name of the to vertex.- <em>$label</em>: A label for the edge (optional).- further optional attributes.<br><br>Returns an object with an attribute <em>edge</em> containing the list of all edge properties. <br><br>",
|
||||
"summary": "create edge",
|
||||
"httpMethod": "POST",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edge\n{\"_key\":\"edge1\",\"_from\":\"vert2\",\"_to\":\"vert1\",\"optional1\":\"val1\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 126389731\n\n{ \n \"edge\" : { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"126389731\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/vert2\", \n \"_to\" : \"vertices/vert1\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edge\n{\"_key\":\"edge1\",\"_from\":\"vert2\",\"_to\":\"vert1\",\"optional1\":\"val1\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 125031634\n\n{ \n \"edge\" : { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"125031634\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/vert2\", \n \"_to\" : \"vertices/vert1\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createEdge"
|
||||
}
|
||||
],
|
||||
|
@ -595,7 +595,7 @@
|
|||
"notes": "Returns an object with an attribute <em>edge</em> containing a list of all edge properties. <br><br>",
|
||||
"summary": "get edge",
|
||||
"httpMethod": "GET",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 130059747\n\n{ \n \"edge\" : { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"130059747\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/vert1\", \n \"_to\" : \"vertices/vert2\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: 128701650\n\n{ \n \"edge\" : { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"128701650\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/vert1\", \n \"_to\" : \"vertices/vert2\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "getEdge"
|
||||
}
|
||||
],
|
||||
|
@ -716,7 +716,7 @@
|
|||
"notes": "Replaces the optional edge properties. <br><br>The call expects a JSON hash array as body with the new edge properties. <br><br>Returns an object with an attribute <em>edge</em> containing a list of all edge properties. <br><br>",
|
||||
"summary": "update edge",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n{\"optional1\":\"val2\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 138448355\n\n{ \n \"edge\" : { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"138448355\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/vert1\", \n \"_to\" : \"vertices/vert2\", \n \"$label\" : null, \n \"optional1\" : \"val2\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n{\"optional1\":\"val2\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 137090258\n\n{ \n \"edge\" : { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"137090258\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/vert1\", \n \"_to\" : \"vertices/vert2\", \n \"$label\" : null, \n \"optional1\" : \"val2\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"nickname": "updateEdge"
|
||||
}
|
||||
],
|
||||
|
@ -786,7 +786,7 @@
|
|||
"notes": "Partially updates the edge properties. <br><br>Setting an attribute value to <em>null</em> in the patch document will cause a value of <em>null</em> be saved for the attribute by default. If the intention is to delete existing attributes with the patch command, the URL parameter <em>keepNull</em> can be used with a value of <em>false</em>. 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 <em>null</em>. <br><br>Returns an object with an attribute <em>edge</em> containing a list of all edge properties. <br><br>",
|
||||
"summary": "update edge",
|
||||
"httpMethod": "PATCH",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n{\"optional3\":\"val3\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 142708195\n\n{ \n \"edge\" : { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"142708195\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/vert1\", \n \"_to\" : \"vertices/vert2\", \n \"$label\" : null, \n \"optional1\" : \"val1\", \n \"optional3\" : \"val3\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PATCH --data @- --dump - http://localhost:8529/_api/graph/graph/edge/edge1\n{\"optional3\":\"val3\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: 141350098\n\n{ \n \"edge\" : { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"141350098\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/vert1\", \n \"_to\" : \"vertices/vert2\", \n \"$label\" : null, \n \"optional1\" : \"val1\", \n \"optional3\" : \"val3\" \n }, \n \"error\" : false, \n \"code\" : 202 \n}\n\n</code></pre><br>",
|
||||
"nickname": "updateEdge"
|
||||
}
|
||||
],
|
||||
|
@ -820,7 +820,7 @@
|
|||
"notes": "Returns a cursor. <br><br>The call expects a JSON hash array as body to filter the result: <br><br>- <em>batchSize</em>: the batch size of the returned cursor- <em>limit</em>: limit the result size- <em>count</em>: return the total number of results (default \"false\")- <em>filter</em>: a optional filter<br><br>The attributes of filter - <em>labels</em>: filter by an array of edge labels- <em>properties</em>: filter by an array of edge properties<br><br>The attributes of a property filter - <em>key</em>: filter the result edges by a key value pair- <em>value</em>: the value of the <em>key</em>- <em>compare</em>: a compare operator<br><br>",
|
||||
"summary": "get edges",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Select all edges <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edges\n{\"batchSize\":100}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"edges/edge4\", \n \"_rev\" : \"149196259\", \n \"_key\" : \"edge4\", \n \"_from\" : \"vertices/v1\", \n \"_to\" : \"vertices/v5\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"147426787\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/v1\", \n \"_to\" : \"vertices/v2\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"edges/edge2\", \n \"_rev\" : \"148016611\", \n \"_key\" : \"edge2\", \n \"_from\" : \"vertices/v1\", \n \"_to\" : \"vertices/v3\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"edges/edge3\", \n \"_rev\" : \"148606435\", \n \"_key\" : \"edge3\", \n \"_from\" : \"vertices/v2\", \n \"_to\" : \"vertices/v4\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n } \n ], \n \"hasMore\" : false, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Select all edges <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edges\n{\"batchSize\":100}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"edges/edge4\", \n \"_rev\" : \"147838162\", \n \"_key\" : \"edge4\", \n \"_from\" : \"vertices/v1\", \n \"_to\" : \"vertices/v5\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"146068690\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/v1\", \n \"_to\" : \"vertices/v2\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"edges/edge2\", \n \"_rev\" : \"146658514\", \n \"_key\" : \"edge2\", \n \"_from\" : \"vertices/v1\", \n \"_to\" : \"vertices/v3\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"edges/edge3\", \n \"_rev\" : \"147248338\", \n \"_key\" : \"edge3\", \n \"_from\" : \"vertices/v2\", \n \"_to\" : \"vertices/v4\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n } \n ], \n \"hasMore\" : false, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "getEdges"
|
||||
}
|
||||
],
|
||||
|
@ -861,7 +861,7 @@
|
|||
"notes": "<br><br>Returns a cursor. <br><br>The call expects a JSON hash array as body to filter the result: <br><br>- <em>batchSize</em>: the batch size of the returned cursor- <em>limit</em>: limit the result size- <em>count</em>: return the total number of results (default \"false\")- <em>filter</em>: a optional filter<br><br>The attributes of filter - <em>direction</em>: Filter for inbound (value \"in\") or outbound (value \"out\") neighbors. Default value is \"any\". - <em>labels</em>: filter by an array of edge labels- <em>properties</em>: filter neighbors by an array of properties<br><br>The attributes of a property filter - <em>key</em>: filter the result vertices by a key value pair- <em>value</em>: the value of the <em>key</em>- <em>compare</em>: a compare operator<br><br>",
|
||||
"summary": "get edges",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Select all edges <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edges/v2\n{\"batchSize\" : 100, \"filter\" : { \"direction\" : \"any\" }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"154045923\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/v1\", \n \"_to\" : \"vertices/v2\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"edges/edge3\", \n \"_rev\" : \"155225571\", \n \"_key\" : \"edge3\", \n \"_from\" : \"vertices/v2\", \n \"_to\" : \"vertices/v4\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n } \n ], \n \"hasMore\" : false, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Select all edges <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/graph/graph/edges/v2\n{\"batchSize\" : 100, \"filter\" : { \"direction\" : \"any\" }}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"edges/edge1\", \n \"_rev\" : \"152687826\", \n \"_key\" : \"edge1\", \n \"_from\" : \"vertices/v1\", \n \"_to\" : \"vertices/v2\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n }, \n { \n \"_id\" : \"edges/edge3\", \n \"_rev\" : \"153867474\", \n \"_key\" : \"edge3\", \n \"_from\" : \"vertices/v2\", \n \"_to\" : \"vertices/v4\", \n \"$label\" : null, \n \"optional1\" : \"val1\" \n } \n ], \n \"hasMore\" : false, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "getEdges"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
"notes": "<br><br>Creates a cap constraint (the manual) for the collection <em>collection-name</em>, if it does not already exist. Expects an object containing the index details. <br><br>- <em>type</em>: must be equal to <em>\"cap\"</em>.<br><br>- <em>size</em>: The maximal number of documents for the collection.<br><br>- <em>byteSize</em>: The maximal size of the active document data in the collection.<br><br>Note that the cap constraint does not index particular attributes of the documents in a collection, but limits the number of documents in the collection to a maximum value. The cap constraint thus does not support attribute names specified in the <em>fields</em> attribute nor uniqueness of any kind via the <em>unique</em> attribute. <br><br>It is allowed to specify either <em>size</em> or <em>byteSize</em>, or both at the same time. If both are specified, then the automatic document removal will be triggered by the first non-met constraint. <br><br>",
|
||||
"summary": "creates a cap constraint",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Creating a cap constraint <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{\"type\":\"cap\",\"size\":10}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/158698979\", \n \"type\" : \"cap\", \n \"unique\" : false, \n \"size\" : 10, \n \"byteSize\" : 0, \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Creating a cap constraint <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{\"type\":\"cap\",\"size\":10}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/157340882\", \n \"type\" : \"cap\", \n \"unique\" : false, \n \"size\" : 10, \n \"byteSize\" : 0, \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createsACapConstraint"
|
||||
}
|
||||
],
|
||||
|
@ -134,7 +134,7 @@
|
|||
"notes": "<br><br>Creates a geo-spatial index in the collection <em>collection-name</em>, if it does not already exist. Expects an object containing the index details. <br><br>- <em>type</em>: must be equal to <em>\"geo\"</em>.<br><br>- <em>fields</em>: A list with one or two attribute paths. <br><br> If it is a list with one attribute path <em>location</em>, then a geo-spatial index on all documents is created using <em>location</em> as path to the coordinates. The value of the attribute must be a list with at least two double values. The list must contain the latitude (first value) and the longitude (second value). All documents, which do not have the attribute path or with value that are not suitable, are ignored. <br><br> If it is a list with two attribute paths <em>latitude</em> and <em>longitude</em>, then a geo-spatial index on all documents is created using <em>latitude</em> and <em>longitude</em> as paths the latitude and the longitude. The value of the attribute <em>latitude</em> and of the attribute <em>longitude</em> must a double. All documents, which do not have the attribute paths or which values are not suitable, are ignored. <br><br>- <em>geoJson</em>: If a geo-spatial index on a <em>location</em> is constructed and <em>geoJson</em> is <em>true</em>, then the order within the list is longitude followed by latitude. This corresponds to the format described in http://geojson.org/geojson-spec.html#positions <br><br>- <em>constraint</em>: If <em>constraint</em> is <em>true</em>, then a geo-spatial constraint is created. The constraint is a non-unique variant of the index. Note that it is also possible to set the <em>unique</em> attribute instead of the <em>constraint</em> attribute. <br><br>- <em>ignoreNull</em>: If a geo-spatial constraint is created and <em>ignoreNull</em> is true, then documents with a null in <em>location</em> or at least one null in <em>latitude</em> or <em>longitude</em> are ignored. <br><br>",
|
||||
"summary": "creates a geo-spatial index",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Creating a geo index with a location attribute: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"geo\", \"fields\" : [ \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/159550947\", \n \"type\" : \"geo1\", \n \"unique\" : false, \n \"geoJson\" : false, \n \"constraint\" : false, \n \"fields\" : [ \n \"b\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Creating a geo index with latitude and longitude attributes: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"geo\", \"fields\" : [ \"e\", \"f\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/160402915\", \n \"type\" : \"geo2\", \n \"unique\" : false, \n \"constraint\" : false, \n \"fields\" : [ \n \"e\", \n \"f\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Creating a geo index with a location attribute: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"geo\", \"fields\" : [ \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/158127314\", \n \"type\" : \"geo1\", \n \"unique\" : false, \n \"geoJson\" : false, \n \"constraint\" : false, \n \"fields\" : [ \n \"b\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Creating a geo index with latitude and longitude attributes: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"geo\", \"fields\" : [ \"e\", \"f\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/159044818\", \n \"type\" : \"geo2\", \n \"unique\" : false, \n \"constraint\" : false, \n \"fields\" : [ \n \"e\", \n \"f\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createsAGeo-spatialIndex"
|
||||
}
|
||||
],
|
||||
|
@ -180,7 +180,7 @@
|
|||
"notes": "<br><br>Creates a hash index for the collection <em>collection-name</em>, if it does not already exist. The call expects an object containing the index details. <br><br>- <em>type</em>: must be equal to <em>\"hash\"</em>.<br><br>- <em>fields</em>: A list of attribute paths.<br><br>- <em>unique</em>: If <em>true</em>, then create a unique index.<br><br>",
|
||||
"summary": "creates a hash index",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Creating an unique constraint: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"hash\", \"unique\" : true, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/161320419\", \n \"type\" : \"hash\", \n \"unique\" : true, \n \"fields\" : [ \n \"a\", \n \"b\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Creating a hash index: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"hash\", \"unique\" : false, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/162172387\", \n \"type\" : \"hash\", \n \"unique\" : false, \n \"fields\" : [ \n \"a\", \n \"b\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Creating an unique constraint: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"hash\", \"unique\" : true, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/159896786\", \n \"type\" : \"hash\", \n \"unique\" : true, \n \"fields\" : [ \n \"a\", \n \"b\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Creating a hash index: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"hash\", \"unique\" : false, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/160814290\", \n \"type\" : \"hash\", \n \"unique\" : false, \n \"fields\" : [ \n \"a\", \n \"b\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createsAHashIndex"
|
||||
}
|
||||
],
|
||||
|
@ -226,7 +226,7 @@
|
|||
"notes": "<br><br>Creates a skip-list index for the collection <em>collection-name</em>, if it does not already exist. The call expects an object containing the index details. <br><br>- <em>type</em>: must be equal to <em>\"skiplist\"</em>.<br><br>- <em>fields</em>: A list of attribute paths.<br><br>- <em>unique</em>: If <em>true</em>, then create a unique index.<br><br>",
|
||||
"summary": "creates a skip list",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Creating a skiplist: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"skiplist\", \"unique\" : false, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/163089891\", \n \"type\" : \"skiplist\", \n \"unique\" : false, \n \"fields\" : [ \n \"a\", \n \"b\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Creating a skiplist: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\": \"skiplist\", \"unique\" : false, \"fields\" : [ \"a\", \"b\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/161666258\", \n \"type\" : \"skiplist\", \n \"unique\" : false, \n \"fields\" : [ \n \"a\", \n \"b\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createsASkipList"
|
||||
}
|
||||
],
|
||||
|
@ -268,7 +268,7 @@
|
|||
"notes": "<br><br>Creates a fulltext index for the collection <em>collection-name</em>, if it does not already exist. The call expects an object containing the index details. <br><br>- <em>type</em>: must be equal to <em>\"fulltext\"</em>.<br><br>- <em>fields</em>: A list of attribute names. Currently, the list is limited to exactly one attribute, so the value of <em>fields</em> should look like this for example: <em>[ \"text\" ]</em>. <br><br>- <em>minLength</em>: 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. <br><br>",
|
||||
"summary": "creates a fulltext index",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Creating a fulltext index: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\" : \"fulltext\", \"fields\" : [ \"text\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/163876323\", \n \"type\" : \"fulltext\", \n \"unique\" : false, \n \"minLength\" : 2, \n \"fields\" : [ \n \"text\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Creating a fulltext index: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\" : \"fulltext\", \"fields\" : [ \"text\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/162518226\", \n \"type\" : \"fulltext\", \n \"unique\" : false, \n \"minLength\" : 2, \n \"fields\" : [ \n \"text\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createsAFulltextIndex"
|
||||
}
|
||||
],
|
||||
|
@ -310,7 +310,7 @@
|
|||
"notes": "<br><br>Creates a bitarray index for the collection <em>collection-name</em>, if it does not already exist. The call expects an object containing the index details. <br><br>- <em>type</em>: must be equal to <em>\"bitarray\"</em>.<br><br>- <em>fields</em>: A list of pairs. A pair consists of an attribute path followed by a list of values.<br><br>- <em>unique</em>: Must always be set to <em>false</em>.<br><br>",
|
||||
"summary": "creates a bitarray index",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Creating a bitarray index: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\" : \"bitarray\", \"unique\" : false, \"fields\" : [ \"x\", [0,1,[]], \"y\", [\"a\",\"b\",[]] ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/164793827\", \n \"type\" : \"bitarray\", \n \"unique\" : false, \n \"fields\" : [ \n [ \n \"x\", \n [ \n 0, \n 1, \n [ ] \n ] \n ], \n [ \n \"y\", \n [ \n \"a\", \n \"b\", \n [ ] \n ] \n ] \n ], \n \"undefined\" : false, \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Creating a bitarray index: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\" : \"bitarray\", \"unique\" : false, \"fields\" : [ \"x\", [0,1,[]], \"y\", [\"a\",\"b\",[]] ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/163370194\", \n \"type\" : \"bitarray\", \n \"unique\" : false, \n \"fields\" : [ \n [ \n \"x\", \n [ \n 0, \n 1, \n [ ] \n ] \n ], \n [ \n \"y\", \n [ \n \"a\", \n \"b\", \n [ ] \n ] \n ] \n ], \n \"undefined\" : false, \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "createsABitarrayIndex"
|
||||
}
|
||||
],
|
||||
|
@ -375,7 +375,7 @@
|
|||
"notes": "<br><br>Deletes an index with <em>index-handle</em>. <br><br>",
|
||||
"summary": "deletes an index",
|
||||
"httpMethod": "DELETE",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/index/products/165645795\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/165645795\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/index/products/164287698\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/164287698\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "deletesAnIndex"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
"notes": "<br><br>To validate a query string without executing it, the query string can be passed to the server via an HTTP POST request. <br><br>These query string needs to be passed in the attribute <em>query</em> of a JSON object as the body of the POST request. <br><br>",
|
||||
"summary": "parses a query",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Valid query: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/query\n{ \"query\" : \"FOR p IN products FILTER p.name == @name LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"bindVars\" : [ \n \"name\" \n ], \n \"collections\" : [ \n \"products\" \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Invalid query: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/query\n{ \"query\" : \"FOR p IN products FILTER p.name = @name LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 1501, \n \"errorMessage\" : \"syntax error, unexpected assignment near '= @name LIMIT 2 RETURN p.n' at position 1:33\" \n}\n\n</code></pre><br>",
|
||||
"examples": "Valid query: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/query\n{ \"query\" : \"FOR p IN products FILTER p.name == @name LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"bindVars\" : [ \n \"name\" \n ], \n \"collections\" : [ \n \"products\" \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Invalid query: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/query\n{ \"query\" : \"FOR p IN products FILTER p.name = @name LIMIT 2 RETURN p.n\" }\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 1501, \n \"errorMessage\" : \"syntax error, unexpected assignment near '= @name LIMIT 2 RETURN p.n' at positio...\" \n}\n\n</code></pre><br>",
|
||||
"nickname": "parsesAQuery"
|
||||
}
|
||||
],
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -32,7 +32,7 @@
|
|||
"notes": "<br><br>Returns all documents of a collections. The call expects a JSON object as body with the following attributes: <br><br>- <em>collection</em>: The name of the collection to query.<br><br>- <em>skip</em>: The number of documents to skip in the query (optional).<br><br>- <em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. (optional) <br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
|
||||
"summary": "executes simple query ALL",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "Limit the amount of documents using <em>limit</em> <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/all\n{ \"collection\": \"products\", \"skip\": 2, \"limit\" : 2 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/166628835\", \n \"_rev\" : \"166628835\", \n \"_key\" : \"166628835\", \n \"Hello1\" : \"World1\" \n }, \n { \n \"_id\" : \"products/167022051\", \n \"_rev\" : \"167022051\", \n \"_key\" : \"167022051\", \n \"Hello2\" : \"World2\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Using a <em>batchSize</em> value <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/all\n{ \"collection\": \"products\", \"batchSize\" : 3 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/170495459\", \n \"_rev\" : \"170495459\", \n \"_key\" : \"170495459\", \n \"Hello5\" : \"World5\" \n }, \n { \n \"_id\" : \"products/169512419\", \n \"_rev\" : \"169512419\", \n \"_key\" : \"169512419\", \n \"Hello2\" : \"World2\" \n }, \n { \n \"_id\" : \"products/169119203\", \n \"_rev\" : \"169119203\", \n \"_key\" : \"169119203\", \n \"Hello1\" : \"World1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"170692067\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Limit the amount of documents using <em>limit</em> <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/all\n{ \"collection\": \"products\", \"skip\": 2, \"limit\" : 2 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/165598418\", \n \"_rev\" : \"165598418\", \n \"_key\" : \"165598418\", \n \"Hello2\" : \"World2\" \n }, \n { \n \"_id\" : \"products/166253778\", \n \"_rev\" : \"166253778\", \n \"_key\" : \"166253778\", \n \"Hello4\" : \"World4\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Using a <em>batchSize</em> value <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/all\n{ \"collection\": \"products\", \"batchSize\" : 3 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/168088786\", \n \"_rev\" : \"168088786\", \n \"_key\" : \"168088786\", \n \"Hello2\" : \"World2\" \n }, \n { \n \"_id\" : \"products/168416466\", \n \"_rev\" : \"168416466\", \n \"_key\" : \"168416466\", \n \"Hello3\" : \"World3\" \n }, \n { \n \"_id\" : \"products/168744146\", \n \"_rev\" : \"168744146\", \n \"_key\" : \"168744146\", \n \"Hello4\" : \"World4\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"169268434\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesSimpleQueryAll"
|
||||
}
|
||||
],
|
||||
|
@ -67,7 +67,7 @@
|
|||
"notes": "<br><br>Returns a random document of a collection. The call expects a JSON object as body with the following attributes: <br><br>- <em>collection</em>: The identifier or name of the collection to query.<br><br>Returns a JSON object with the document stored in the attribute <em>document</em> if the collection contains at least one document. If the collection is empty, the attrbute contains null. <br><br>",
|
||||
"summary": "executes simple query ANY",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/any\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"document\" : { \n \"_id\" : \"products/172658147\", \n \"_rev\" : \"172658147\", \n \"_key\" : \"172658147\", \n \"Hello4\" : \"World4\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/any\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"document\" : { \n \"_id\" : \"products/170251474\", \n \"_rev\" : \"170251474\", \n \"_key\" : \"170251474\", \n \"Hello1\" : \"World1\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesSimpleQueryAny"
|
||||
}
|
||||
],
|
||||
|
@ -102,7 +102,7 @@
|
|||
"notes": "<br><br>The default will find at most 100 documents near a given coordinate. The returned list is sorted according to the distance, with the nearest document coming first. If there are near documents of equal distance, documents are chosen randomly from this set until the limit is reached. <br><br>In order to use the <em>near</em> operator, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more then one geo-spatial index, you can use the <em>geo</em> field to select a particular index. <br><br>The call expects a JSON hash array as body with the following attributes: <br><br>- <em>collection</em>: The name of the collection to query.<br><br>- <em>latitude</em>: The latitude of the coordinate.<br><br>- <em>longitude</em>: The longitude of the coordinate.<br><br>- <em>distance</em>: If given, the attribute key used to store the distance. (optional) <br><br>- <em>skip</em>: The number of documents to skip in the query. (optional)<br><br>- <em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. The default is 100. (optional) <br><br>- <em>geo</em>: If given, the identifier of the geo-index to use. (optional)<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
|
||||
"summary": "executes simple query NEAR",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "Without distance: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/175476195\", \n \"_rev\" : \"175476195\", \n \"_key\" : \"175476195\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/175082979\", \n \"_rev\" : \"175082979\", \n \"_key\" : \"175082979\", \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>With distance: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/178490851\", \n \"_rev\" : \"178490851\", \n \"_key\" : \"178490851\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/178884067\", \n \"_rev\" : \"178884067\", \n \"_key\" : \"178884067\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/178294243\", \n \"_rev\" : \"178294243\", \n \"_key\" : \"178294243\", \n \"distance\" : 444.779706578235, \n \"name\" : \"Name/-0.004/\", \n \"loc\" : [ \n -0.004, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 3, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Without distance: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/174052562\", \n \"_rev\" : \"174052562\", \n \"_key\" : \"174052562\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/173659346\", \n \"_rev\" : \"173659346\", \n \"_key\" : \"173659346\", \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>With distance: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/177067218\", \n \"_rev\" : \"177067218\", \n \"_key\" : \"177067218\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/177460434\", \n \"_rev\" : \"177460434\", \n \"_key\" : \"177460434\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/176870610\", \n \"_rev\" : \"176870610\", \n \"_key\" : \"176870610\", \n \"distance\" : 444.779706578235, \n \"name\" : \"Name/-0.004/\", \n \"loc\" : [ \n -0.004, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 3, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesSimpleQueryNear"
|
||||
}
|
||||
],
|
||||
|
@ -137,7 +137,7 @@
|
|||
"notes": "<br><br>This will find all documents with in a given radius around the coordinate (<em>latitude</em>, <em>longitude</em>). The returned list is sorted by distance. <br><br>In order to use the <em>within</em> operator, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more then one geo-spatial index, you can use the <em>geo</em> field to select a particular index. <br><br>The call expects a JSON hash array as body with the following attributes: <br><br>- <em>collection</em>: The name of the collection to query.<br><br>- <em>latitude</em>: The latitude of the coordinate.<br><br>- <em>longitude</em>: The longitude of the coordinate.<br><br>- <em>radius</em>: The maximal radius (in meters).<br><br>- <em>distance</em>: If given, the result attribute key used to store the distance values (optional). If specified, distances are returned in meters. <br><br>- <em>skip</em>: The documents to skip in the query. (optional)<br><br>- <em>limit</em>: The maximal amount of documents to return. (optional)<br><br>- <em>geo</em>: If given, the identifier of the geo-index to use. (optional)<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
|
||||
"summary": "executes simple query WITHIN",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "Without distance: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2, \"radius\" : 500 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/182291939\", \n \"_rev\" : \"182291939\", \n \"_key\" : \"182291939\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/181898723\", \n \"_rev\" : \"181898723\", \n \"_key\" : \"181898723\", \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>With distance: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\", \"radius\" : 300 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/185306595\", \n \"_rev\" : \"185306595\", \n \"_key\" : \"185306595\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/185699811\", \n \"_rev\" : \"185699811\", \n \"_key\" : \"185699811\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/185109987\", \n \"_rev\" : \"185109987\", \n \"_key\" : \"185109987\", \n \"distance\" : 444.779706578235, \n \"name\" : \"Name/-0.004/\", \n \"loc\" : [ \n -0.004, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 3, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Without distance: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2, \"radius\" : 500 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/180868306\", \n \"_rev\" : \"180868306\", \n \"_key\" : \"180868306\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/180475090\", \n \"_rev\" : \"180475090\", \n \"_key\" : \"180475090\", \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>With distance: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\", \"radius\" : 300 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/183882962\", \n \"_rev\" : \"183882962\", \n \"_key\" : \"183882962\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/184276178\", \n \"_rev\" : \"184276178\", \n \"_key\" : \"184276178\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/183686354\", \n \"_rev\" : \"183686354\", \n \"_key\" : \"183686354\", \n \"distance\" : 444.779706578235, \n \"name\" : \"Name/-0.004/\", \n \"loc\" : [ \n -0.004, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 3, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesSimpleQueryWithin"
|
||||
}
|
||||
],
|
||||
|
@ -172,7 +172,7 @@
|
|||
"notes": "<br><br>This will find all documents from the collection that match the fulltext query specified in <em>query</em>. <br><br>In order to use the <em>fulltext</em> operator, a fulltext index must be defined for the collection and the specified attribute. <br><br>The call expects a JSON hash array as body with the following attributes: <br><br>- <em>collection</em>: The name of the collection to query.<br><br>- <em>attribute</em>: The attribute that contains the texts.<br><br>- <em>query</em>: The fulltext query.<br><br>- <em>skip</em>: The documents to skip in the query. (optional)<br><br>- <em>limit</em>: The maximal amount of documents to return. (optional)<br><br>- <em>index</em>: If given, the identifier of the fulltext-index to use. (optional)<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
|
||||
"summary": "executes simple query FULLTEXT",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/fulltext\n{ \"collection\": \"products\", \"attribute\" : \"text\", \"query\" : \"word\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/187731427\", \n \"_rev\" : \"187731427\", \n \"_key\" : \"187731427\", \n \"text\" : \"this text contains word\" \n }, \n { \n \"_id\" : \"products/187928035\", \n \"_rev\" : \"187928035\", \n \"_key\" : \"187928035\", \n \"text\" : \"this text also has a word\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/fulltext\n{ \"collection\": \"products\", \"attribute\" : \"text\", \"query\" : \"word\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/186307794\", \n \"_rev\" : \"186307794\", \n \"_key\" : \"186307794\", \n \"text\" : \"this text contains word\" \n }, \n { \n \"_id\" : \"products/186504402\", \n \"_rev\" : \"186504402\", \n \"_key\" : \"186504402\", \n \"text\" : \"this text also has a word\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesSimpleQueryFulltext"
|
||||
}
|
||||
],
|
||||
|
@ -207,7 +207,7 @@
|
|||
"notes": "<br><br>This will find all documents matching a given example. <br><br>The call expects a JSON hash array as body with the following attributes: <br><br>- <em>collection</em>: The name of the collection to query.<br><br>- <em>example</em>: The example.<br><br>- <em>skip</em>: The documents to skip in the query. (optional)<br><br>- <em>limit</em>: The maximal amount of documents to return. (optional)<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
|
||||
"summary": "executes simple query by-example",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "Matching an attribute: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"i\" : 1 } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/190287331\", \n \"_rev\" : \"190287331\", \n \"_key\" : \"190287331\", \n \"i\" : 1 \n }, \n { \n \"_id\" : \"products/189697507\", \n \"_rev\" : \"189697507\", \n \"_key\" : \"189697507\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/190483939\", \n \"_rev\" : \"190483939\", \n \"_key\" : \"190483939\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n { \n \"_id\" : \"products/190025187\", \n \"_rev\" : \"190025187\", \n \"_key\" : \"190025187\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 4, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Matching an attribute which is a sub-document: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"a.j\" : 1 } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/192253411\", \n \"_rev\" : \"192253411\", \n \"_key\" : \"192253411\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/191925731\", \n \"_rev\" : \"191925731\", \n \"_key\" : \"191925731\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Matching an attribute within a sub-document: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/194481635\", \n \"_rev\" : \"194481635\", \n \"_key\" : \"194481635\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 1, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "Matching an attribute: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"i\" : 1 } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/189060306\", \n \"_rev\" : \"189060306\", \n \"_key\" : \"189060306\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n { \n \"_id\" : \"products/188273874\", \n \"_rev\" : \"188273874\", \n \"_key\" : \"188273874\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/188863698\", \n \"_rev\" : \"188863698\", \n \"_key\" : \"188863698\", \n \"i\" : 1 \n }, \n { \n \"_id\" : \"products/188601554\", \n \"_rev\" : \"188601554\", \n \"_key\" : \"188601554\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 4, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Matching an attribute which is a sub-document: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"a.j\" : 1 } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/190502098\", \n \"_rev\" : \"190502098\", \n \"_key\" : \"190502098\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/190829778\", \n \"_rev\" : \"190829778\", \n \"_key\" : \"190829778\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Matching an attribute within a sub-document: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/193058002\", \n \"_rev\" : \"193058002\", \n \"_key\" : \"193058002\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 1, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesSimpleQueryBy-example"
|
||||
}
|
||||
],
|
||||
|
@ -234,7 +234,7 @@
|
|||
"notes": "<br><br>This will return the first document matching a given example. <br><br>The call expects a JSON hash array as body with the following attributes: <br><br>- <em>collection</em>: The name of the collection to query.<br><br>- <em>example</em>: The example.<br><br>Returns a result containing the document or <em>HTTP 404</em> if no document matched the example. <br><br>",
|
||||
"summary": "executes simple query first-example",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "If a matching document was found: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/first-example\n{ \"collection\": \"products\", \"example\" : { \"i\" : 1 } }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"document\" : { \n \"_id\" : \"products/196972003\", \n \"_rev\" : \"196972003\", \n \"_key\" : \"196972003\", \n \"i\" : 1 \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>If no document was found: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/first-example\n{ \"collection\": \"products\", \"example\" : { \"l\" : 1 } }\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 404, \n \"errorMessage\" : \"no match\" \n}\n\n</code></pre><br>",
|
||||
"examples": "If a matching document was found: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/first-example\n{ \"collection\": \"products\", \"example\" : { \"i\" : 1 } }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"document\" : { \n \"_id\" : \"products/194958546\", \n \"_rev\" : \"194958546\", \n \"_key\" : \"194958546\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>If no document was found: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/first-example\n{ \"collection\": \"products\", \"example\" : { \"l\" : 1 } }\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 404, \n \"errorMessage\" : \"no match\" \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesSimpleQueryFirst-example"
|
||||
}
|
||||
],
|
||||
|
@ -269,7 +269,7 @@
|
|||
"notes": "<br><br>This will return the first documents from the collection, in the order of insertion/update time. When the <em>count</em> argument is supplied, the result will be a list of documents, with the \"oldest\" document being first in the result list. If the <em>count</em> argument is not supplied, the result is the \"oldest\" document of the collection, or <em>null</em> if the collection is empty. <br><br>",
|
||||
"summary": "executes simple query first",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "Retrieving the first n documents: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/first\n{ \"collection\": \"products\", \"count\" : 2 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/200773091\", \n \"_rev\" : \"200773091\", \n \"_key\" : \"200773091\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/201100771\", \n \"_rev\" : \"201100771\", \n \"_key\" : \"201100771\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Retrieving the first document: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/first\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"_id\" : \"products/202935779\", \n \"_rev\" : \"202935779\", \n \"_key\" : \"202935779\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "Retrieving the first n documents: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/first\n{ \"collection\": \"products\", \"count\" : 2 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/199283922\", \n \"_rev\" : \"199283922\", \n \"_key\" : \"199283922\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/199677138\", \n \"_rev\" : \"199677138\", \n \"_key\" : \"199677138\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Retrieving the first document: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/first\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"_id\" : \"products/201446610\", \n \"_rev\" : \"201446610\", \n \"_key\" : \"201446610\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesSimpleQueryFirst"
|
||||
}
|
||||
],
|
||||
|
@ -304,7 +304,7 @@
|
|||
"notes": "<br><br>This will return the last documents from the collection, in the order of insertion/update time. When the <em>count</em> argument is supplied, the result will be a list of documents, with the \"latest\" document being first in the result list. If the <em>count</em> argument is not supplied, the result is the \"latest\" document of the collection, or <em>null</em> if the collection is empty. <br><br>",
|
||||
"summary": "executes simple query last",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "Retrieving the last n documents: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/last\n{ \"collection\": \"products\", \"count\" : 2 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/205884899\", \n \"_rev\" : \"205884899\", \n \"_key\" : \"205884899\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n { \n \"_id\" : \"products/205688291\", \n \"_rev\" : \"205688291\", \n \"_key\" : \"205688291\", \n \"i\" : 1 \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Retrieving the first document: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/last\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"_id\" : \"products/208047587\", \n \"_rev\" : \"208047587\", \n \"_key\" : \"208047587\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"examples": "Retrieving the last n documents: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/last\n{ \"collection\": \"products\", \"count\" : 2 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/204461266\", \n \"_rev\" : \"204461266\", \n \"_key\" : \"204461266\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n { \n \"_id\" : \"products/204264658\", \n \"_rev\" : \"204264658\", \n \"_key\" : \"204264658\", \n \"i\" : 1 \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Retrieving the first document: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/last\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"_id\" : \"products/206623954\", \n \"_rev\" : \"206623954\", \n \"_key\" : \"206623954\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesSimpleQueryLast"
|
||||
}
|
||||
],
|
||||
|
@ -331,7 +331,7 @@
|
|||
"notes": "<br><br>This will find all documents within a given range. You must declare a skip-list index on the attribute in order to be able to use a range query. <br><br>The call expects a JSON hash array as body with the following attributes: <br><br>- <em>collection</em>: The name of the collection to query.<br><br>- <em>attribute</em>: The attribute path to check.<br><br>- <em>left</em>: The lower bound.<br><br>- <em>right</em>: The upper bound.<br><br>- <em>closed</em>: If true, use interval including <em>left</em> and <em>right</em>, otherwise exclude <em>right</em>, but include <em>left</em>. <br><br>- <em>skip</em>: The documents to skip in the query. (optional)<br><br>- <em>limit</em>: The maximal amount of documents to return. (optional)<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
|
||||
"summary": "executes simple range query",
|
||||
"httpMethod": "PUT",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/range\n{ \"collection\": \"products\", \"attribute\" : \"i\", \"left\" : 2, \"right\" : 4 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/209423843\", \n \"_rev\" : \"209423843\", \n \"_key\" : \"209423843\", \n \"i\" : 2 \n }, \n { \n \"_id\" : \"products/209620451\", \n \"_rev\" : \"209620451\", \n \"_key\" : \"209620451\", \n \"i\" : 3 \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/simple/range\n{ \"collection\": \"products\", \"attribute\" : \"i\", \"left\" : 2, \"right\" : 4 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/208000210\", \n \"_rev\" : \"208000210\", \n \"_key\" : \"208000210\", \n \"i\" : 2 \n }, \n { \n \"_id\" : \"products/208196818\", \n \"_rev\" : \"208196818\", \n \"_key\" : \"208196818\", \n \"i\" : 3 \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesSimpleRangeQuery"
|
||||
}
|
||||
],
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -29,10 +29,10 @@
|
|||
"description": "Contains the <em>collections</em> and <em>action</em>. "
|
||||
}
|
||||
],
|
||||
"notes": "<br><br>The transaction description must be passed in the body of the POST request. <br><br>The following attributes must be specified inside the JSON object: <br><br>- <em>collections</em>: contains the list of collections to be used in the transaction (mandatory). <em>collections</em> must be a JSON array that can have the optional sub-attributes <em>read</em> and <em>write</em>. <em>read</em> and <em>write</em> must each be either lists of collections names or strings with a single collection name. <br><br>- <em>action</em>: 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 <em>action</em> properly sets up all the variables it needs. If the code specified in <em>action</em> ends with a return statement, the value returned will also be returned by the REST API in the <em>result</em> attribute if the transaction committed successfully. <br><br>The following optional attributes may also be specified in the request: <br><br>- <em>waitForSync</em>: an optional boolean flag that, if set, will force the transaction to write all data to disk before returning. <br><br>- <em>lockTimeout</em>: 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 <em>lockTimeout</em> to <em>0</em> will make ArangoDB not time out waiting for a lock. <br><br>- <em>params</em>: optional arguments passed to <em>action</em>.<br><br>If the transaction is fully executed and committed on the server, <em>HTTP 200</em> will be returned. Additionally, the return value of the code defined in <em>action</em> will be returned in the <em>result</em> attribute. <br><br>For successfully committed transactions, the returned JSON object has the following properties: <br><br>- <em>error</em>: boolean flag to indicate if an error occurred (<em>false</em> in this case) <br><br>- <em>code</em>: the HTTP status code<br><br>- <em>result</em>: the return value of the transaction<br><br>If the transaction specification is either missing or malformed, the server will respond with <em>HTTP 400</em>. <br><br>The body of the response will then contain a JSON object with additional error details. The object has the following attributes: <br><br>- <em>error</em>: boolean flag to indicate that an error occurred (<em>true</em> in this case)<br><br>- <em>code</em>: the HTTP status code<br><br>- <em>errorNum</em>: the server error number<br><br>- <em>errorMessage</em>: a descriptive error message<br><br>If a transaction fails to commit, either by an exception thrown in the <em>action</em> 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 <em>HTTP 400</em>, <em>HTTP 409</em>, or <em>HTTP 500</em>. <br><br>",
|
||||
"notes": "<br><br>The transaction description must be passed in the body of the POST request. <br><br>The following attributes must be specified inside the JSON object: <br><br>- <em>collections</em>: contains the list of collections to be used in the transaction (mandatory). <em>collections</em> must be a JSON array that can have the optional sub-attributes <em>read</em> and <em>write</em>. <em>read</em> and <em>write</em> must each be either lists of collections names or strings with a single collection name. <br><br>- <em>action</em>: 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 <em>action</em> properly sets up all the variables it needs. If the code specified in <em>action</em> ends with a return statement, the value returned will also be returned by the REST API in the <em>result</em> attribute if the transaction committed successfully. <br><br>The following optional attributes may also be specified in the request: <br><br>- <em>waitForSync</em>: an optional boolean flag that, if set, will force the transaction to write all data to disk before returning. <br><br>- <em>lockTimeout</em>: 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 <em>lockTimeout</em> to <em>0</em> will make ArangoDB not time out waiting for a lock. <br><br>- <em>replicate</em>: whether or not to replicate the operations from this transaction. If not specified, the default value is <em>true</em>. <br><br>- <em>params</em>: optional arguments passed to <em>action</em>.<br><br>If the transaction is fully executed and committed on the server, <em>HTTP 200</em> will be returned. Additionally, the return value of the code defined in <em>action</em> will be returned in the <em>result</em> attribute. <br><br>For successfully committed transactions, the returned JSON object has the following properties: <br><br>- <em>error</em>: boolean flag to indicate if an error occurred (<em>false</em> in this case) <br><br>- <em>code</em>: the HTTP status code<br><br>- <em>result</em>: the return value of the transaction<br><br>If the transaction specification is either missing or malformed, the server will respond with <em>HTTP 400</em>. <br><br>The body of the response will then contain a JSON object with additional error details. The object has the following attributes: <br><br>- <em>error</em>: boolean flag to indicate that an error occurred (<em>true</em> in this case)<br><br>- <em>code</em>: the HTTP status code<br><br>- <em>errorNum</em>: the server error number<br><br>- <em>errorMessage</em>: a descriptive error message<br><br>If a transaction fails to commit, either by an exception thrown in the <em>action</em> 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 <em>HTTP 400</em>, <em>HTTP 409</em>, or <em>HTTP 500</em>. <br><br>",
|
||||
"summary": "executes a transaction",
|
||||
"httpMethod": "POST",
|
||||
"examples": "Executing a transaction on a single collection: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{ \"collections\": { \"write\" : \"products\" }, \"action\" : \"function () { var db = require(\\\"internal\\\").db;db.products.save({});return db.products.count(); }\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Executing a transaction using multiple collections: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{ \"collections\": { \"write\" : [\"products\", \"materials\" ] }, \"action\" : \"function () { var db = require(\\\"internal\\\").db;db.products.save({});db.materials.save({});return \\\"worked!\\\"; }\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : \"worked!\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Aborting a transaction due to an internal error: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{ \"collections\": { \"write\" : \"products\" }, \"action\" : \"function () { var db = require(\\\"internal\\\").db;db.products.save({_key: \\\"abc\\\"});db.products.save({_key: \\\"abc\\\"});\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 400, \n \"errorMessage\" : \"bad parameter\" \n}\n\n</code></pre><br>Aborting a transaction by throwing an exception: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{ \"collections\": { \"read\" : \"products\" }, \"action\" : \"function () { throw \\\"doh!\\\"; }\" }\n\nHTTP/1.1 500 Internal Error\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 500, \n \"errorNum\" : 500, \n \"errorMessage\" : \"doh!\" \n}\n\n</code></pre><br>",
|
||||
"examples": "Executing a transaction on a single collection: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{\"collections\":{\"write\":\"products\"},\"action\":\"function () { var db = require('internal').db; db.products.save({}); return db.products.count(); }\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Executing a transaction using multiple collections: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{\"collections\":{\"write\":[\"products\",\"materials\"]},\"action\":\"function () { var db = require('internal').db; db.products.save({}); db.materials.save({}); return 'worked!'; }\"}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : \"worked!\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Aborting a transaction due to an internal error: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{\"collections\":{\"write\":\"products\"},\"action\":\"function () { var db = require('internal').db; db.products.save({ _key: 'abc'}); db.products.save({ _key: 'abc'}); }\"}\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 400, \n \"errorNum\" : 1210, \n \"errorMessage\" : \"cannot save document: unique constraint violated\" \n}\n\n</code></pre><br>Aborting a transaction by explicitly throwing an exception: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{\"collections\":{\"read\":\"products\"},\"action\":\"function () { throw 'doh!'; }\"}\n\nHTTP/1.1 500 Internal Error\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 500, \n \"errorNum\" : 500, \n \"errorMessage\" : \"doh!\" \n}\n\n</code></pre><br>Referring to a non-existing collection: <br><br><pre><code class=\"json\" >unix> curl -X POST --data @- --dump - http://localhost:8529/_api/transaction\n{\"collections\":{\"read\":\"products\"},\"action\":\"function () { return true; }\"}\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 1203, \n \"errorMessage\" : \"collection not found\" \n}\n\n</code></pre><br>",
|
||||
"nickname": "executesATransaction"
|
||||
}
|
||||
],
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -398,3 +398,13 @@ table.dataTable thead th {
|
|||
margin-left: 10px !important;
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
|
||||
.readOnlyClass a {
|
||||
color: black !important;
|
||||
}
|
||||
|
||||
.readOnlyClass a:hover {
|
||||
color: black !important;
|
||||
opacity: 0.8 !important;
|
||||
}
|
||||
|
||||
|
|
|
@ -584,12 +584,16 @@ function ArangoAdapter(nodes, edges, config) {
|
|||
self.getAttributeExamples = function(callback) {
|
||||
if (callback && callback.length >= 1) {
|
||||
getNRandom(10, function(l) {
|
||||
var ret = _.uniq(
|
||||
_.flatten(
|
||||
_.map(l, function(o) {
|
||||
return _.keys(o);
|
||||
})
|
||||
)
|
||||
var ret = _.sortBy(
|
||||
_.uniq(
|
||||
_.flatten(
|
||||
_.map(l, function(o) {
|
||||
return _.keys(o);
|
||||
})
|
||||
)
|
||||
), function(e) {
|
||||
return e.toLowerCase();
|
||||
}
|
||||
);
|
||||
callback(ret);
|
||||
});
|
||||
|
|
|
@ -77,7 +77,7 @@ function ArangoAdapterControls(list, adapter) {
|
|||
objects: graphs
|
||||
}
|
||||
]
|
||||
},,{
|
||||
},{
|
||||
type: "checkbox",
|
||||
id: "undirected"
|
||||
}], function () {
|
||||
|
@ -86,12 +86,11 @@ function ArangoAdapterControls(list, adapter) {
|
|||
graph = $("#" + idprefix + "graph").attr("value"),
|
||||
undirected = !!$("#" + idprefix + "undirected").attr("checked"),
|
||||
selected = $("input[type='radio'][name='loadtype']:checked").attr("id");
|
||||
if (selected === "collections") {
|
||||
if (selected === idprefix + "collections") {
|
||||
adapter.changeToCollections(nodes, edges, undirected);
|
||||
} else {
|
||||
adapter.changeToGraph(graph, undirected);
|
||||
}
|
||||
|
||||
if (_.isFunction(callback)) {
|
||||
callback();
|
||||
}
|
||||
|
|
|
@ -187,7 +187,10 @@ var modalDialogHelper = modalDialogHelper || {};
|
|||
createListInput = function(id, list) {
|
||||
var input = document.createElement("select");
|
||||
input.id = id;
|
||||
_.each(list, function(entry) {
|
||||
_.each(
|
||||
_.sortBy(list, function(e) {
|
||||
return e.toLowerCase();
|
||||
}), function(entry) {
|
||||
var option = document.createElement("option");
|
||||
option.value = entry;
|
||||
option.appendChild(
|
||||
|
|
|
@ -225,14 +225,37 @@ function NodeShaperControls(list, shaper) {
|
|||
modalDialogHelper.createModalDialog("Switch Label Attribute",
|
||||
idprefix, [{
|
||||
type: "text",
|
||||
id: "attribute"
|
||||
id: "label-attribute"
|
||||
},{
|
||||
type: "decission",
|
||||
id: "samecolour",
|
||||
group: "colour",
|
||||
text: "Use same for colour",
|
||||
isDefault: true
|
||||
},{
|
||||
type: "decission",
|
||||
id: "othercolour",
|
||||
group: "colour",
|
||||
text: "Use other for colour",
|
||||
isDefault: false,
|
||||
interior: [
|
||||
{
|
||||
type: "text",
|
||||
id: "colour-attribute"
|
||||
}
|
||||
]
|
||||
}], function () {
|
||||
var key = $("#" + idprefix + "key").attr("value");
|
||||
var key = $("#" + idprefix + "label-attribute").attr("value"),
|
||||
colourkey = $("#" + idprefix + "colour-attribute").attr("value"),
|
||||
selected = $("input[type='radio'][name='colour']:checked").attr("id");
|
||||
if (selected === idprefix + "samecolour") {
|
||||
colourkey = key
|
||||
}
|
||||
shaper.changeTo({
|
||||
label: key,
|
||||
color: {
|
||||
type: "attribute",
|
||||
key: key
|
||||
key: colourkey
|
||||
}
|
||||
});
|
||||
if (colourDiv === undefined) {
|
||||
|
|
|
@ -234,9 +234,18 @@ Graph.prototype.initialize = function (name, vertices, edges) {
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return all graphs
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Graph.getAll = function () {
|
||||
return GraphAPI.getAllGraphs();
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief drops the graph, the vertices, and the edges
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Graph.prototype.drop = function () {
|
||||
GraphAPI.deleteGraph(this._properties._key);
|
||||
};
|
||||
|
|
|
@ -16,28 +16,52 @@ console.log(ds, es);
|
|||
<form action="javascript:void(0);" autocomplete="on" class="form-horizontal" id="creationDialog">
|
||||
<fieldset>
|
||||
<legend>Configuration</legend>
|
||||
<div class="control-group">
|
||||
<label for="nodeCollection" class="control-label">Node Collection</label>
|
||||
<div class="controls">
|
||||
<select id="nodeCollection" name="nodeCollection">
|
||||
<%_.each(ds, function(d) {%>
|
||||
<option value="<%= d %>"><%= d %></option>
|
||||
<%}); %>
|
||||
</select>
|
||||
|
||||
<label class="radio">
|
||||
<input type="radio" name="loadtype" id="collections" checked>
|
||||
Define specific collections
|
||||
</label>
|
||||
<div id="collection_config">
|
||||
<div class="control-group">
|
||||
<label for="nodeCollection" class="control-label">Node-Collection</label>
|
||||
<div class="controls">
|
||||
<select id="nodeCollection" name="nodeCollection">
|
||||
<%_.each(ds, function(d) {%>
|
||||
<option value="<%= d %>"><%= d %></option>
|
||||
<%}); %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="edgeCollection" class="control-label">Edge-Collection</label>
|
||||
<div class="controls">
|
||||
<select id="edgeCollection" name="edgeCollection">
|
||||
<%_.each(es, function(e) {%>
|
||||
<option value="<%= e %>"><%= e %></option>
|
||||
<%}); %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="edgeCollection" class="control-label">Edge Collection</label>
|
||||
<div class="controls">
|
||||
<select id="edgeCollection" name="edgeCollection">
|
||||
<%_.each(es, function(e) {%>
|
||||
<option value="<%= e %>"><%= e %></option>
|
||||
<%}); %>
|
||||
</select>
|
||||
|
||||
<label class="radio">
|
||||
<input type="radio" name="loadtype" id="graphs">
|
||||
Use a graph
|
||||
</label>
|
||||
<div id="graph_config" style="display:none">
|
||||
<div class="control-group">
|
||||
<label for="graph" class="control-label">Graph-Name</label>
|
||||
<div class="controls">
|
||||
<select id="graph" name="graph">
|
||||
<%_.each(gs, function(g) {%>
|
||||
<option value="<%= g %>"><%= g %></option>
|
||||
<%}); %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="control-group">
|
||||
<label for="undirected" class="control-label">Undirected Graph</label>
|
||||
<div class="controls">
|
||||
|
@ -66,9 +90,9 @@ console.log(ds, es);
|
|||
|
||||
|
||||
<div class="control-group">
|
||||
<label for="nodeLabel" class="control-label">Node Label</label>
|
||||
<label for="nodeLabel" class="control-label">Node-Label-Attribute</label>
|
||||
<div class="controls">
|
||||
<input id="nodeLabel" type="text" name="nodeLabel" placeholder="Node Label" maxlength="75" class="input-xlarge">
|
||||
<input id="nodeLabel" type="text" name="nodeLabel" placeholder="Attribute" maxlength="75" class="input-xlarge">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -8,20 +8,6 @@ var collectionsView = Backbone.View.extend({
|
|||
searchTimeout: null,
|
||||
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
self.system = {};
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
cache: false,
|
||||
url: "/_admin/version",
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
self.system.name = data.server;
|
||||
self.system.version = data.version;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
template: new EJS({url: 'js/templates/collectionsView.ejs'}),
|
||||
|
@ -58,7 +44,6 @@ var collectionsView = Backbone.View.extend({
|
|||
$('#searchInput').val('');
|
||||
$('#searchInput').val(val);
|
||||
|
||||
$('.footer-right p').html(this.system.name+' : '+this.system.version);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
|
|
@ -260,7 +260,7 @@ var documentView = Backbone.View.extend({
|
|||
return ("<a class=\"sh_object\">"+ self.escaped(JSON.stringify(value)) + "</a>");
|
||||
}
|
||||
};
|
||||
return (isReadOnly ? "(read-only) " : "") + typify(value);
|
||||
return (isReadOnly ? '<i class="readOnlyClass">' : '') + typify(value) + '</i>';
|
||||
},
|
||||
|
||||
escaped: function (value) {
|
||||
|
|
|
@ -9,6 +9,8 @@ var documentsView = Backbone.View.extend({
|
|||
filters : { "0" : true },
|
||||
filterId : 0,
|
||||
|
||||
addDocumentSwitch: true,
|
||||
|
||||
allowUpload: false,
|
||||
|
||||
collectionContext : {
|
||||
|
@ -86,6 +88,8 @@ var documentsView = Backbone.View.extend({
|
|||
this.removeAllFilterItems();
|
||||
|
||||
this.clearTable();
|
||||
$('#documentsToolbarF ul').css("visibility", "visible");
|
||||
this.addDocumentSwitch = true;
|
||||
window.arangoDocumentsStore.getDocuments(this.collectionID, 1);
|
||||
},
|
||||
|
||||
|
@ -97,7 +101,7 @@ var documentsView = Backbone.View.extend({
|
|||
type: "POST",
|
||||
async: false,
|
||||
url:
|
||||
'/_api/import?type=documents&collection='+
|
||||
'/_api/import?type=auto&collection='+
|
||||
encodeURIComponent(self.colid)+
|
||||
'&createCollection=false',
|
||||
data: self.file,
|
||||
|
@ -107,7 +111,28 @@ var documentsView = Backbone.View.extend({
|
|||
complete: function(xhr) {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 201) {
|
||||
arangoHelper.arangoNotification("Upload successful");
|
||||
var data;
|
||||
|
||||
try {
|
||||
data = JSON.parse(xhr.responseText);
|
||||
}
|
||||
|
||||
catch (e) {
|
||||
arangoHelper.arangoNotification("Error: "+ e);
|
||||
self.hideSpinner();
|
||||
self.hideImportModal();
|
||||
self.resetView();
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.errors === 0) {
|
||||
arangoHelper.arangoNotification("Upload successful. " +
|
||||
data.created + "document(s) imported.");
|
||||
}
|
||||
else if (data.errors !== 0) {
|
||||
arangoHelper.arangoNotification("Upload failed." +
|
||||
data.errors + "error(s).");
|
||||
}
|
||||
self.hideSpinner();
|
||||
self.hideImportModal();
|
||||
self.resetView();
|
||||
|
@ -202,8 +227,10 @@ var documentsView = Backbone.View.extend({
|
|||
}
|
||||
}
|
||||
|
||||
this.addDocumentSwitch = false;
|
||||
window.documentsView.clearTable();
|
||||
window.arangoDocumentsStore.getFilteredDocuments(this.colid, 1, filters, bindValues);
|
||||
$('#documentsToolbarF ul').css("visibility", "hidden");
|
||||
},
|
||||
|
||||
addFilterItem : function () {
|
||||
|
@ -426,13 +453,15 @@ var documentsView = Backbone.View.extend({
|
|||
drawTable: function() {
|
||||
var self = this;
|
||||
|
||||
$(self.table).dataTable().fnAddData(
|
||||
[
|
||||
'<a id="plusIconDoc" style="padding-left: 30px">Add document</a>',
|
||||
'',
|
||||
'<img src="img/plus_icon.png" id="documentAddBtn"></img>'
|
||||
]
|
||||
);
|
||||
if (this.addDocumentSwitch === true) {
|
||||
$(self.table).dataTable().fnAddData(
|
||||
[
|
||||
'<a id="plusIconDoc" style="padding-left: 30px">Add document</a>',
|
||||
'',
|
||||
'<img src="img/plus_icon.png" id="documentAddBtn"></img>'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$.each(window.arangoDocumentsStore.models, function(key, value) {
|
||||
|
||||
|
|
|
@ -3,13 +3,28 @@
|
|||
|
||||
var footerView = Backbone.View.extend({
|
||||
el: '.footer',
|
||||
init: function () {
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
self.system = {};
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
cache: false,
|
||||
url: "/_admin/version",
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
self.system.name = data.server;
|
||||
self.system.version = data.version;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
template: new EJS({url: 'js/templates/footerView.ejs'}),
|
||||
|
||||
render: function() {
|
||||
$(this.el).html(this.template.text);
|
||||
$('.footer-right p').html(this.system.name+' : '+this.system.version);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, forin: true */
|
||||
/*global Backbone, $, window, EJS, GraphViewerUI */
|
||||
/*global Backbone, $, _, window, EJS, GraphViewerUI */
|
||||
|
||||
window.graphView = Backbone.View.extend({
|
||||
el: '#content',
|
||||
|
@ -8,11 +8,33 @@ window.graphView = Backbone.View.extend({
|
|||
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
|
||||
this.graphs = [];
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type: 'GET',
|
||||
url: "/_api/graph",
|
||||
contentType: "application/json",
|
||||
success: function(data) {
|
||||
self.graphs = _.pluck(data.graphs, "_key");
|
||||
self.render();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
events: {
|
||||
"click #createViewer" : "createViewer"
|
||||
"click input[type='radio'][name='loadtype']": "toggleLoadtypeDisplay",
|
||||
"click #createViewer": "createViewer"
|
||||
},
|
||||
|
||||
toggleLoadtypeDisplay: function() {
|
||||
var selected = $("input[type='radio'][name='loadtype']:checked").attr("id");
|
||||
if (selected === "collections") {
|
||||
$("#collection_config").css("display", "block");
|
||||
$("#graph_config").css("display", "none");
|
||||
} else {
|
||||
$("#collection_config").css("display", "none");
|
||||
$("#graph_config").css("display", "block");
|
||||
}
|
||||
},
|
||||
|
||||
createViewer: function() {
|
||||
|
@ -63,15 +85,11 @@ window.graphView = Backbone.View.extend({
|
|||
} else {
|
||||
ui = new GraphViewerUI($("#content")[0], aaconfig, 940, 680, config);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
render: function() {
|
||||
$(this.el).html(this.template.render({col: this.collection}));
|
||||
$(this.el).html(this.template.render({col: this.collection, gs: this.graphs}));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,6 @@ var queryView = Backbone.View.extend({
|
|||
|
||||
inputEditor.getSession().setMode("ace/mode/aql");
|
||||
outputEditor.getSession().setMode("ace/mode/json");
|
||||
inputEditor.setTheme("ace/theme/merbivore_soft");
|
||||
outputEditor.setValue('');
|
||||
|
||||
$('#queryOutput').resizable({
|
||||
|
@ -142,7 +141,11 @@ var queryView = Backbone.View.extend({
|
|||
inputEditor.resize();
|
||||
outputEditor.resize();
|
||||
|
||||
inputEditor.setTheme("ace/theme/merbivore_soft");
|
||||
|
||||
this.renderSelectboxes();
|
||||
this.deselect(outputEditor);
|
||||
this.deselect(inputEditor);
|
||||
$('#queryDiv').show();
|
||||
|
||||
return this;
|
||||
|
@ -426,7 +429,6 @@ var queryView = Backbone.View.extend({
|
|||
var self = this;
|
||||
var inputEditor = ace.edit("aqlEditor");
|
||||
var data = {query: inputEditor.getValue()};
|
||||
|
||||
var outputEditor = ace.edit("queryOutput");
|
||||
|
||||
$.ajax({
|
||||
|
@ -441,6 +443,7 @@ var queryView = Backbone.View.extend({
|
|||
localStorage.setItem("queryContent", inputEditor.getValue());
|
||||
localStorage.setItem("queryOutput", outputEditor.getValue());
|
||||
}
|
||||
self.deselect(outputEditor);
|
||||
},
|
||||
error: function(data) {
|
||||
try {
|
||||
|
|
|
@ -119,7 +119,7 @@ border-color: #E6E1DC\
|
|||
.ace-merbivore-soft .ace_comment,\
|
||||
.ace-merbivore-soft .ace_meta {\
|
||||
font-style: italic;\
|
||||
color: #AC4BB8\
|
||||
color: #8AA051\
|
||||
}\
|
||||
.ace-merbivore-soft .ace_entity.ace_other.ace_attribute-name {\
|
||||
color: #EAF1A3\
|
||||
|
|
|
@ -130,7 +130,7 @@ function graph_by_request (req) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns true if a "if-match" or "if-none-match" errer happens
|
||||
/// @brief returns true if a "if-match" or "if-none-match" error happens
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function matchError (req, res, doc, errorCode) {
|
||||
|
@ -282,21 +282,27 @@ function post_graph_graph (req, res) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief get graph properties
|
||||
///
|
||||
/// @RESTHEADER{GET /_api/graph/{graph-name},get graph properties}
|
||||
/// @RESTHEADER{GET /_api/graph/{graph-name},get the properties of a specific or all graphs}
|
||||
///
|
||||
/// @RESTURLPARAMETERS
|
||||
///
|
||||
/// @RESTURLPARAM{graph-name,string,required}
|
||||
/// The name of the graph
|
||||
/// @RESTURLPARAM{graph-name,string,optional}
|
||||
/// The name of the graph.
|
||||
///
|
||||
/// @RESTHEADERPARAMETERS
|
||||
///
|
||||
/// @RESTHEADERPARAM{If-None-Match,string,optional}
|
||||
/// If `graph-name` is specified, then this header can be used to check
|
||||
/// whether a specific graph has changed or not.
|
||||
///
|
||||
/// If the "If-None-Match" header is given, then it must contain exactly one
|
||||
/// etag. The document is returned, if it has a different revision than the
|
||||
/// etag. The document is returned if it has a different revision than the
|
||||
/// given etag. Otherwise a `HTTP 304` is returned.
|
||||
///
|
||||
/// @RESTHEADERPARAM{If-Match,string,optional}
|
||||
/// If `graph-name` is specified, then this header can be used to check
|
||||
/// whether a specific graph has changed or not.
|
||||
///
|
||||
/// If the "If-Match" header is given, then it must contain exactly one
|
||||
/// etag. The document is returned, if it has the same revision ad the
|
||||
/// given etag. Otherwise a `HTTP 412` is returned. As an alternative
|
||||
|
@ -304,25 +310,32 @@ function post_graph_graph (req, res) {
|
|||
///
|
||||
/// @RESTDESCRIPTION
|
||||
///
|
||||
/// Returns an object with an attribute `graph` containing a
|
||||
/// list of all graph properties.
|
||||
/// If `graph-name` is specified, returns an object with an attribute `graph`
|
||||
/// containing a JSON hash with all properties of the specified graph.
|
||||
///
|
||||
/// If `graph-name` is not specified, returns a list of graph objects.
|
||||
///
|
||||
/// @RESTRETURNCODES
|
||||
///
|
||||
/// @RESTRETURNCODE{200}
|
||||
/// is returned if the graph was found
|
||||
/// is returned if the graph was found (in case `graph-name` was specified)
|
||||
/// or the list of graphs was assembled successfully (in case `graph-name`
|
||||
/// was not specified).
|
||||
///
|
||||
/// @RESTRETURNCODE{404}
|
||||
/// is returned if the graph was not found.
|
||||
/// is returned if the graph was not found. This response code may only be
|
||||
/// returned if `graph-name` is specified in the request.
|
||||
/// The response body contains an error document in this case.
|
||||
///
|
||||
/// @RESTRETURNCODE{304}
|
||||
/// "If-None-Match" header is given and the current graph has not a different
|
||||
/// version
|
||||
/// version. This response code may only be returned if `graph-name` is
|
||||
/// specified in the request.
|
||||
///
|
||||
/// @RESTRETURNCODE{412}
|
||||
/// "If-Match" header or `rev` is given and the current graph has
|
||||
/// a different version
|
||||
/// a different version. This response code may only be returned if `graph-name`
|
||||
/// is specified in the request.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
|
@ -341,6 +354,26 @@ function post_graph_graph (req, res) {
|
|||
/// db._drop("vertices");
|
||||
/// db._graphs.remove("graph");
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
///
|
||||
/// get all graphs
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_RUN{RestGraphGetGraphs}
|
||||
/// var Graph = require("org/arangodb/graph").Graph;
|
||||
/// new Graph("graph1", "vertices1", "edges1");
|
||||
/// new Graph("graph2", "vertices2", "edges2");
|
||||
/// var url = "/_api/graph";
|
||||
/// var response = logCurlRequest('GET', url);
|
||||
///
|
||||
/// assert(response.code === 200);
|
||||
///
|
||||
/// logJsonResponse(response);
|
||||
/// db._drop("edges1");
|
||||
/// db._drop("vertices2");
|
||||
/// db._drop("edges1");
|
||||
/// db._drop("vertices2");
|
||||
/// db._graphs.remove("graph1");
|
||||
/// db._graphs.remove("graph2");
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function get_graph_graph (req, res) {
|
||||
|
@ -355,7 +388,7 @@ function get_graph_graph (req, res) {
|
|||
"Etag" : g._properties._rev
|
||||
};
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { "graph" : g._properties}, headers );
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { "graph" : g._properties }, headers );
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultNotFound(req, res, arangodb.ERROR_GRAPH_INVALID_GRAPH, err);
|
||||
|
@ -799,7 +832,6 @@ function update_graph_vertex (req, res, g, isPatch) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief updates a vertex
|
||||
///
|
||||
|
@ -2176,8 +2208,9 @@ function post_graph (req, res) {
|
|||
|
||||
function get_graph (req, res) {
|
||||
if (req.suffix.length === 0) {
|
||||
// GET /_api/graph
|
||||
actions.resultUnsupported(req, res);
|
||||
// GET /_api/graph: return all graphs
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { "graphs" : graph.Graph.getAll() });
|
||||
}
|
||||
else if (req.suffix.length === 1) {
|
||||
// GET /_api/graph/<key>
|
||||
|
|
|
@ -78,6 +78,9 @@ var actions = require("org/arangodb/actions");
|
|||
/// value will be used. Setting `lockTimeout` to `0` will make ArangoDB
|
||||
/// not time out waiting for a lock.
|
||||
///
|
||||
/// - `replicate`: whether or not to replicate the operations from this
|
||||
/// transaction. If not specified, the default value is `true`.
|
||||
///
|
||||
/// - `params`: optional arguments passed to `action`.
|
||||
///
|
||||
/// If the transaction is fully executed and committed on the server,
|
||||
|
@ -137,11 +140,15 @@ var actions = require("org/arangodb/actions");
|
|||
/// db._drop(cn);
|
||||
/// var products = db._create(cn);
|
||||
/// var url = "/_api/transaction";
|
||||
/// var body = '{ "collections": { "write" : "products" }, ';
|
||||
/// body += '"action" : "function () { ';
|
||||
/// body += 'var db = require(\\"internal\\").db;';
|
||||
/// body += 'db.products.save({});';
|
||||
/// body += 'return db.products.count(); }" }';
|
||||
/// var body = {
|
||||
/// collections: {
|
||||
/// write : "products"
|
||||
/// },
|
||||
/// action: "function () { " +
|
||||
/// "var db = require('internal').db; " +
|
||||
/// "db.products.save({}); " +
|
||||
/// "return db.products.count(); }"
|
||||
/// };
|
||||
///
|
||||
/// var response = logCurlRequest('POST', url, body);
|
||||
/// assert(response.code === 200);
|
||||
|
@ -160,15 +167,18 @@ var actions = require("org/arangodb/actions");
|
|||
/// db._drop(cn2);
|
||||
/// var products = db._create(cn2);
|
||||
/// products.save({ "a": 1});
|
||||
/// materials.save({"b": 1});
|
||||
/// materials.save({ "b": 1});
|
||||
/// var url = "/_api/transaction";
|
||||
/// var body = '{ "collections": { "write" : ["products", ';
|
||||
/// body += '"materials" ] }, ';
|
||||
/// body += '"action" : "function () { ';
|
||||
/// body += 'var db = require(\\"internal\\").db;';
|
||||
/// body += 'db.products.save({});';
|
||||
/// body += 'db.materials.save({});';
|
||||
/// body += 'return \\"worked!\\"; }" }';
|
||||
/// var body = {
|
||||
/// collections: {
|
||||
/// write : [ "products", "materials" ]
|
||||
/// },
|
||||
/// action: "function () { " +
|
||||
/// "var db = require('internal').db; " +
|
||||
/// "db.products.save({}); " +
|
||||
/// "db.materials.save({}); " +
|
||||
/// "return 'worked!'; }"
|
||||
/// };
|
||||
///
|
||||
/// var response = logCurlRequest('POST', url, body);
|
||||
/// assert(response.code === 200);
|
||||
|
@ -185,11 +195,15 @@ var actions = require("org/arangodb/actions");
|
|||
/// db._drop(cn);
|
||||
/// var products = db._create(cn);
|
||||
/// var url = "/_api/transaction";
|
||||
/// var body = '{ "collections": { "write" : "products" }, ';
|
||||
/// body += '"action" : "function () { ';
|
||||
/// body += 'var db = require(\\"internal\\").db;';
|
||||
/// body += 'db.products.save({_key: \\"abc\\"});';
|
||||
/// body += 'db.products.save({_key: \\"abc\\"});';
|
||||
/// var body = {
|
||||
/// collections: {
|
||||
/// write : "products"
|
||||
/// },
|
||||
/// action : "function () { " +
|
||||
/// "var db = require('internal').db; " +
|
||||
/// "db.products.save({ _key: 'abc'}); " +
|
||||
/// "db.products.save({ _key: 'abc'}); }"
|
||||
/// };
|
||||
///
|
||||
/// var response = logCurlRequest('POST', url, body);
|
||||
/// assert(response.code === 400);
|
||||
|
@ -198,16 +212,20 @@ var actions = require("org/arangodb/actions");
|
|||
/// db._drop(cn);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
///
|
||||
/// Aborting a transaction by throwing an exception:
|
||||
/// Aborting a transaction by explicitly throwing an exception:
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_RUN{RestTransactionAbort}
|
||||
/// var cn = "products";
|
||||
/// db._drop(cn);
|
||||
/// var products = db._create(cn, { waitForSync: true });
|
||||
/// products.save({ "a": 1});
|
||||
/// products.save({ "a": 1 });
|
||||
/// var url = "/_api/transaction";
|
||||
/// var body = '{ "collections": { "read" : "products" }, ';
|
||||
/// body += '"action" : "function () { throw \\"doh!\\"; }" }';
|
||||
/// var body = {
|
||||
/// collections: {
|
||||
/// read : "products"
|
||||
/// },
|
||||
/// action : "function () { throw 'doh!'; }"
|
||||
/// };
|
||||
///
|
||||
/// var response = logCurlRequest('POST', url, body);
|
||||
/// assert(response.code === 500);
|
||||
|
@ -215,6 +233,25 @@ var actions = require("org/arangodb/actions");
|
|||
/// logJsonResponse(response);
|
||||
/// db._drop(cn);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
///
|
||||
/// Referring to a non-existing collection:
|
||||
///
|
||||
/// @EXAMPLE_ARANGOSH_RUN{RestTransactionNonExisting}
|
||||
/// var cn = "products";
|
||||
/// db._drop(cn);
|
||||
/// var url = "/_api/transaction";
|
||||
/// var body = {
|
||||
/// collections: {
|
||||
/// read : "products"
|
||||
/// },
|
||||
/// action : "function () { return true; }"
|
||||
/// };
|
||||
///
|
||||
/// var response = logCurlRequest('POST', url, body);
|
||||
/// assert(response.code === 404);
|
||||
///
|
||||
/// logJsonResponse(response);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function post_api_transaction(req, res) {
|
||||
|
|
|
@ -58,6 +58,12 @@ GraphAPI = {
|
|||
return GraphAPI.sendWithoutData("GET", graphKey, "");
|
||||
},
|
||||
|
||||
getAllGraphs: function () {
|
||||
var results = arangodb.arango.GET("/_api/graph");
|
||||
arangosh.checkRequestResult(results);
|
||||
return results.graphs;
|
||||
},
|
||||
|
||||
postGraph: function (data) {
|
||||
var results = arangodb.arango.POST("/_api/graph", JSON.stringify(data));
|
||||
arangosh.checkRequestResult(results);
|
||||
|
|
|
@ -233,9 +233,18 @@ Graph.prototype.initialize = function (name, vertices, edges) {
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return all graphs
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Graph.getAll = function () {
|
||||
return GraphAPI.getAllGraphs();
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief drops the graph, the vertices, and the edges
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Graph.prototype.drop = function () {
|
||||
GraphAPI.deleteGraph(this._properties._key);
|
||||
};
|
||||
|
|
|
@ -511,6 +511,32 @@ Graph.prototype.initialize = function (name, vertices, edges, waitForSync) {
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_graph_getAll
|
||||
/// @brief returns all available graphs
|
||||
///
|
||||
/// @FUN{@FA{graph}.getAll()}
|
||||
///
|
||||
/// Returns all available graphs.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function getAllGraphs () {
|
||||
var gdb = db._collection("_graphs"),
|
||||
graphs = [ ];
|
||||
|
||||
gdb.toArray().forEach(function(doc) {
|
||||
var g = new Graph(doc._key);
|
||||
|
||||
if (g._properties !== null) {
|
||||
graphs.push(g._properties);
|
||||
}
|
||||
});
|
||||
|
||||
return graphs;
|
||||
}
|
||||
|
||||
Graph.getAll = getAllGraphs;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief drops the graph, the vertices, and the edges
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue