1
0
Fork 0

Merge branch 'devel' of github.com:triagens/arangodb into devel

This commit is contained in:
Lucas Dohmen 2014-06-13 11:01:38 +02:00
commit 08efa7025d
47 changed files with 10332 additions and 1152 deletions

View File

@ -1,5 +1,186 @@
!CHAPTER Collection Methods
`collection.all()`
Selects all documents of a collection and returns a cursor. You can use toArray, next, or hasNext to access the result. The result can be limited using the skip and limit operator.
*Examples*
Use toArray to get all documents at once:
arango> db.five.all().toArray();
[
{ "_id" : "five/1798296", "_key" : "1798296", "_rev" : "1798296", "doc" : 3 },
{ "_id" : "five/1732760", "_key" : "1732760", "_rev" : "1732760", "doc" : 2 },
{ "_id" : "five/1863832", "_key" : "1863832", "_rev" : "1863832", "doc" : 4 },
{ "_id" : "five/1667224", "_key" : "1667224", "_rev" : "1667224", "doc" : 1 },
{ "_id" : "five/1929368", "_key" : "1929368", "_rev" : "1929368", "doc" : 5 }
]
Use next to loop over all documents:
arango> var a = db.five.all();
arango> while (a.hasNext()) print(a.next());
{ "_id" : "five/1798296", "_key" : "1798296", "_rev" : "1798296", "doc" : 3 }
{ "_id" : "five/1732760", "_key" : "1732760", "_rev" : "1732760", "doc" : 2 }
{ "_id" : "five/1863832", "_key" : "1863832", "_rev" : "1863832", "doc" : 4 }
{ "_id" : "five/1667224", "_key" : "1667224", "_rev" : "1667224", "doc" : 1 }
{ "_id" : "five/1929368", "_key" : "1929368", "_rev" : "1929368", "doc" : 5 }
`collection.byExample( example)`
Selects all documents of a collection that match the specified example and returns a cursor.
You can use toArray, next, or hasNext to access the result. The result can be limited using the skip and limit operator.
An attribute name of the form a.b is interpreted as attribute path, not as attribute. If you use
{ a : { c : 1 } }
as example, then you will find all documents, such that the attribute a contains a document of the form {c : 1 }. E.g., the document
{ a : { c : 1 }, b : 1 }
will match, but the document
{ a : { c : 1, b : 1 } }
will not.
However, if you use
{ a.c : 1 },
then you will find all documents, which contain a sub-document in a that has an attribute c of value 1. E.g., both documents
{ a : { c : 1 }, b : 1 } and
{ a : { c : 1, b : 1 } }
will match.
`collection.byExample( path1, value1, ...)`
As alternative you can supply a list of paths and values.
*Examples*
Use toArray to get all documents at once:
arango> db.users.all().toArray();
[ { "_id" : "users/554702285", "_key" : "554702285", "_rev" : "554702285", "id" : 323, "name" : "Peter" },
{ "_id" : "users/554636749", "_key" : "554636749", "_rev" : "554636749", "id" : 535, "name" : "Peter" },
{ "_id" : "users/554833357", "_key" : "554833357", "_rev" : "554833357", "id" : 25, "name" : "Vladimir" } ]
arango> db.users.byExample({ "id" : 323 }).toArray();
[ { "id" : 323, "name" : "Peter", "_id" : "users/554702285", "_key" : "554702285", "_rev" : "554702285" } ]
arango> db.users.byExample({ "name" : "Peter" }).toArray();
[ { "id" : 323, "name" : "Peter", "_id" : "users/554702285", "_key" : "554702285", "_rev" : "554702285" },
{ "id" : 535, "name" : "Peter", "_id" : "users/554636749", "_key" : "554636749", "_rev" : "554636749" } ]
arango> db.users.byExample({ "name" : "Peter", "id" : 535 }).toArray();
[ { "id" : 535, "name" : "Peter", "_id" : "users/554636749", "_key" : "554636749", "_rev" : "554636749" } ]
Use next to loop over all documents:
arango> var a = db.users.byExample( {"name" : "Peter" } );
arango> while (a.hasNext()) print(a.next());
{ "id" : 323, "name" : "Peter", "_id" : "users/554702285", "_key" : "554702285", "_rev" : "554702285" }
{ "id" : 535, "name" : "Peter", "_id" : "users/554636749", "_key" : "554636749", "_rev" : "554636749" }
`collection.firstExample( example)`
Returns the document of a collection that match the specified example or null. The example must be specified as paths and values. See byExample for details.
`collection.firstExample( path1, value1, ...)`
As alternative you can supply a list of paths and values.
*Examples*
arango> db.users.firstExample("name", 1237);
{ "_id" : "users/83049373", "_key" : "83049373", "_rev" : "83049373", "name" : 1237 }
`collection.range( attribute, left, right)`
Selects all documents of a collection such that the attribute is greater or equal than left and strictly less than right.
You can use toArray, next, or hasNext to access the result. The result can be limited using the skip and limit operator.
An attribute name of the form a.b is interpreted as attribute path, not as attribute.
For range queries it is required that a skiplist index is present for the queried attribute. If no skiplist index is present on the attribute, an error will be thrown.
*Examples*
Use toArray to get all documents at once:
arangod> l = db.skip.range("age", 10, 13).toArray();
[
{ "_id" : "skip/4260278", "_key" : "4260278", "_rev" : "4260278", "age" : 10 },
{ "_id" : "skip/4325814", "_key" : "4325814", "_rev" : "4325814", "age" : 11 },
{ "_id" : "skip/4391350", "_key" : "4391350", "_rev" : "4391350", "age" : 12 }
]
`collection.any()`
The any method returns a random document from the collection. It returns null if the collection is empty.
*Examples*
arangod> db.example.any()
{ "_id" : "example/222716379559", "_rev" : "222716379559", "Hello" : "World" }
`collection.count()`
Returns the number of living documents in the collection.
*Examples*
arango> db.users.count();
10001
`collection.toArray()`
Converts the collection into an array of documents. Never use this call in a production environment.
<!--
@anchor SimpleQueryAll
@copydetails JSF_ArangoCollection_prototype_all
@CLEARPAGE
@anchor SimpleQueryByExample
@copydetails JSF_ArangoCollection_prototype_byExample
@CLEARPAGE
@anchor SimpleQueryFirstExample
@copydetails JSF_ArangoCollection_prototype_firstExample
@CLEARPAGE
@anchor SimpleQueryAny
@copydetails JSF_ArangoCollection_prototype_range
@CLEARPAGE
@anchor SimpleQueryRange
@copydetails JS_AnyQuery
@CLEARPAGE
@anchor SimpleQueryCollectionCount
@copydetails JS_CountVocbaseCol
@CLEARPAGE
@anchor SimpleQueryToArray
@copydetails JSF_ArangoCollection_prototype_toArray
@CLEARPAGE
@anchor SimpleQueryFirst
@copydetails JSF_ArangoCollection_prototype_first
@CLEARPAGE
@anchor SimpleQueryLast
@copydetails JSF_ArangoCollection_prototype_last
-->
`collection.document( document)`
The document method finds a document given its identifier. It returns the document. Note that the returned document contains two pseudo-attributes, namely _id and _rev. _id contains the document-handle and _rev the revision of the document.
@ -47,16 +228,6 @@ No error will be thrown if the sought document or collection does not exist. Sti
As before. Instead of document a document-handle can be passed as first argument.
`collection.any()`
The any method returns a random document from the collection. It returns null if the collection is empty.
*Examples*
arangod> db.example.any()
{ "_id" : "example/222716379559", "_rev" : "222716379559", "Hello" : "World" }
`collection.save( data)`
Creates a new document in the collection from the given data. The data must be a hash array. It must not contain attributes starting with _.

View File

@ -1,4 +1,4 @@
!CHAPTER What is ArangoDB?
!CHAPTER First Steps in ArangoDB
For installation instructions, please refer to the
[Installation Manual](../Installing/README.md).

View File

@ -1,4 +1,4 @@
!CHAPTER Iteratively Developing an Application
!CHAPTER Developing an Application
While developing a Foxx application, it is recommended to use the development
@ -10,7 +10,7 @@ recommended to use the development mode in production.
During development it is often necessary to log some debug output. ArangoDB
provides a few mechanisms for this:
- using *console.log*:
* using *console.log*:
ArangoDB provides the *console* module, which you can use from within your
Foxx application like this:
@ -21,14 +21,14 @@ provides a few mechanisms for this:
ArangoDB's logfile using a *tail -f* command or something similar.
Please refer to @ref JSModuleConsole for details.
- using *internal.print*:
* using *internal.print*:
The *print* method of the *internal* module writes data to the standard
output of the ArangoDB server process. If you have start ArangoDB manually
and do not run it as an (unattended) daemon, this is a convenient method:
require("internal").print(value);
- tapping requests / responses:
* tapping requests / responses:
Foxx allows to tap incoming requests and outgoing responses using the *before*
and *after* hooks. To print all incoming requests to the stdout of the ArangoDB
server process, you could use some code like this in your controller:
@ -39,3 +39,27 @@ provides a few mechanisms for this:
Of course you can also use *console.log* or any other means of logging output.
!SUBSECTION Development Mode
If you start ArangoDB with the option *--javascript.dev-app-path* followed by
the path to a directory containing a manifest file and the path to the
database, you are starting ArangoDB in development mode with the application
loaded. This means that on every request:
1. All routes are dropped
2. All module caches are flushed
3. Your manifest file is read
4. All files in your lib folder are loaded
5. An app in DIRNAME is mounted at */dev/DIRNAME*
6. The request will be processed
This means that you do not have to restart ArangoDB if you change anything
in your app. It is of course not meant for production, because the reloading
makes the app relatively slow.
!SUBSECTION Production Mode
To run a Foxx app in production first copy your app code to the directory given in
the config variable *--javascript.app-path*. After that use Foxx manager to mount the app.
You can also use Foxx manager to find out your current app-path.

View File

@ -512,4 +512,163 @@ Set the content type to JSON and the body to the JSON encoded object you provide
@copydetails JSF_foxx_BaseMiddleware_response_json
-->
-->
!SUBSECTION Controlling Access to Foxx Applications
Access to Foxx applications is controlled by the regular authentication mechanisms
present in ArangoDB. The server can be run with or without HTTP authentication.
If authentication is turned on,
then every access to the server is authenticated via HTTP authentication. This
includes Foxx applications. The global authentication can be toggled
via the configuration option @ref CommandLineArangoDisableAuthentication
"server.disable-authentication".
If global HTTP authentication is turned on, requests to Foxx applications will
require HTTP authentication too, and only valid users present in the *_users*
system collection are allowed to use the applications.
Since ArangoDB 1.4, there is an extra option to restrict the authentication to
just system API calls, such as */_api/...* and */_admin/...*. This option can be
turned on using the @ref CommandLineArangoAuthenticateSystemOnly
"server.authenticate-system-only" configuration option. If it is turned on,
then only system API requests need authentication whereas all requests to Foxx
applications and routes will not require authentication.
This is recommended if you want to disable HTTP authentication for Foxx applications
but still want the general database APIs to be protected with HTTP authentication.
If you need more fine grained control over the access to your Foxx application,
we built an authentication system you can use. Currently we only support cookie-based
authentication, but we will add the possibility to use Auth Tokens and external OAuth
providers in the near future. Of course you can roll your own authentication mechanism
if you want to, and you can do it in an application-specific way if required.
To use the per-application authentication, you should first turn off the global
HTTP authentication (or at least restrict it to system API calls as mentioned above).
Otherwise clients will need HTTP authentication and need additional authentication by
your Foxx application.
To have global HTTP authentication turned on for system APIs but turned off for Foxx,
your server startup parameters should look like this:
--server.disable-authentication false --server.authenticate-system-only true
Note: during development, you may even turn off HTTP authentication completely:
--server.disable-authentication true --server.authenticate-system-only true
Please keep in mind that turning HTTP authentication off completely will allow
unauthenticated access by anyone to all API functions, so do not use this is production.
Now it's time to configure the application-specific authentication. We built a small
[demo application](https://github.com/arangodb/foxx-authentication) to demonstrate how
this works.
To use the application-specific authentication in your own app, first activate it in your controller:
*FoxxController::activateAuthentication(opts)*
To activate authentication for this authentication, first call this function. Provide the following arguments:
type: Currently we only support cookie, but this will change in the future.
cookieLifetime: An integer. Lifetime of cookies in seconds.
cookieName: A string used as the name of the cookie.
sessionLifetime: An integer. Lifetime of sessions in seconds.
*Examples*
app.activateAuthentication({
type: "cookie",
cookieLifetime: 360000,
cookieName: "my_cookie",
sessionLifetime: 400,
});
!SUBSUBSECTION Adding a login route
*FoxxController::login(path, opts)*
Add a route for the login. You can provide further customizations via the the options:
usernameField and passwordField can be used to adjust the expected attributes in the post request. They default to username and password. onSuccess is a function that you can define to do something if the login was successful. This includes sending a response to the user. This defaults to a function that returns a JSON with user set to the identifier of the user and key set to the session key. onError is a function that you can define to do something if the login did not work. This includes sending a response to the user. This defaults to a function that sets the response to 401 and returns a JSON with error set to "Username or Password was wrong". Both onSuccess and onError should take request and result as arguments.
*Examples*
app.login('/login', {
onSuccess: function (req, res) {
res.json({"success": true});
}
});
!SUBSUBSECTION Adding a logout route
*FoxxController::logout(path, opts)*
This works pretty similar to the logout function and adds a path to your app for the logout functionality. You can customize it with a custom onSuccess and onError function: onSuccess is a function that you can define to do something if the logout was successful. This includes sending a response to the user. This defaults to a function that returns a JSON with message set to "logged out". onError is a function that you can define to do something if the logout did not work. This includes sending a response to the user. This defaults to a function that sets the response to 401 and returns a JSON with error set to "No session was found". Both onSuccess and onError should take request and result as arguments.
*Examples*
app.logout('/logout', {
onSuccess: function (req, res) {
res.json({"message": "Bye, Bye"});
}
});
!SUBSUBSECTION Adding a register route
*FoxxController::register(path, opts)*
This works pretty similar to the logout function and adds a path to your app for the register functionality. You can customize it with a custom onSuccess and onError function: onSuccess is a function that you can define to do something if the registration was successful. This includes sending a response to the user. This defaults to a function that returns a JSON with user set to the created user document. onError is a function that you can define to do something if the registration did not work. This includes sending a response to the user. This defaults to a function that sets the response to 401 and returns a JSON with error set to "Registration failed". Both onSuccess and onError should take request and result as arguments. You can also set the fields containing the username and password via usernameField (defaults to username) and passwordField (defaults to password). If you want to accept additional attributes for the user document, use the option acceptedAttributes and set it to an array containing strings with the names of the additional attributes you want to accept. All other attributes in the request will be ignored. If you want default attributes for the accepted attributes or set additional fields (for example admin) use the option defaultAttributes which should be a hash mapping attribute names to default values.
*Examples*
app.register('/logout', {
acceptedAttributes: ['name'],
defaultAttributes: {
admin: false
}
});
!SUBSUBSECTION Adding a change password route
*FoxxController::changePassword(route, opts)*
Add a route for the logged in user to change the password. You can provide further customizations via the the options:
passwordField can be used to adjust the expected attribute in the post request. It defaults to password. onSuccess is a function that you can define to do something if the change was successful. This includes sending a response to the user. This defaults to a function that returns a JSON with notice set to "Changed password!". onError is a function that you can define to do something if the login did not work. This includes sending a response to the user. This defaults to a function that sets the response to 401 and returns a JSON with error set to "No session was found". Both onSuccess and onError should take request and result as arguments.
*Examples*
app.changePassword('/changePassword', {
onSuccess: function (req, res) {
res.json({"success": true});
}
});
<!--
@copydetails JSF_foxx_controller_activateAuthentication
### Adding a login route
@copydetails JSF_foxx_controller_login
### Adding a logout route
@copydetails JSF_foxx_controller_logout
### Adding a register route
@copydetails JSF_foxx_controller_register
### Adding a change password route
@copydetails JSF_foxx_controller_changePassword
-->
!SUBSUBSECTION Restricting routes
To restrict routes, see the documentation for Documenting and Restraining the routes.

View File

@ -0,0 +1,136 @@
!CHAPTER The Manifest File
In the *manifest.json* you define the components of your application.
The content is a JSON object with the following attributes (not all
attributes are required though):
* *assets*: Deliver pre-processed files
* *author*: The author name
* *contributors*: An array containing objects, each represents a contributor (with *name* and optional *email*)
* *controllers*: Map routes to FoxxControllers
* *defaultDocument*: The default document when the applicated root (*/*) is called (defaults to *index.html*)
* *description*: A short description of the application (Meta information)
* *engines*: Should be an object with *arangodb* set to the ArangoDB version your Foxx app is compatible with.
* *files*: Deliver files
* *isSystem*: Mark an application as a system application
* *keywords*: An array of keywords to help people find your Foxx app
* *lib*: Base path for all required modules
* *license*: Short form of the license (MIT, GPL...)
* *name*: Name of the application (Meta information)
* *repository*: An object with information about where you can find the repository: *type* and *url*
* *setup*: Path to a setup script
* *teardown*: Path to a teardown script
* *thumbnail*: Path to a thumbnail that represents the application (Meta information)
* *version*: Current version of the application (Meta information)
If you install an application using the Foxx manager or are using the
development mode, your manifest will be checked for completeness and common errors.
You should have a look at the server log files after changing a manifest file to
get informed about potential errors in the manifest.
A more complete example for a Manifest file:
{
"name": "my_website",
"version": "1.2.1",
"description": "My Website with a blog and a shop",
"thumnail": "images/website-logo.png",
"controllers": {
"/blog": "apps/blog.js",
"/shop": "apps/shop.js"
},
"lib": "lib",
"files": {
"/images": "images"
},
"assets": {
"application.js": {
"files": [
"vendor/jquery.js",
"assets/javascripts/*"
]
}
},
"setup": "scripts/setup.js",
"teardown": "scripts/teardown.js"
}
!SUBSECTION The setup and teardown scripts
You can provide a path to a JavaScript file that prepares ArangoDB for your
application (or respectively removes it entirely). These scripts have access to
*appCollection* and *appCollectionName*. Use the *setup* script to create all
collections your application needs and fill them with initial data if you want
to. Use the *teardown* script to remove all collections you have created.
Note: the setup script is called on each request in the development mode.
If your application needs to set up specific collections, you should always
check in the setup script whether they are already there.
The teardown script is called when an application is uninstalled. It is good
practice to drop any collections in the teardown script that the application used
exclusively, but this is not enforced. Maybe there are reasons to keep application
data even after removing an application. It's up to you to decide what to do.
!SUBSECTION controllers is an object that matches routes to files
* The *key* is the route you want to mount at
* The *value* is the path to the JavaScript file containing the
*FoxxController* you want to mount
You can add multiple controllers in one manifest this way.
!SUBSECTIONThe files
Deliver all files in a certain folder without modifying them. You can deliver
text files as well as binaries:
"files": {
"/images": "images"
}
!SUBSECTION The assets
The value for the asset key is an object consisting of paths that are matched
to the files they are composed of. Let's take the following example:
"assets": {
"application.js": {
"files": [
"vendor/jquery.js",
"assets/javascripts/*"
]
}
}
If a request is made to */application.js* (in development mode), the file
array provided will be processed one element at a time. The elements are
paths to files (with the option to use wildcards). The files will be
concatenated and delivered as a single file.
The content-type (or mime type) of the HTTP response when requesting
*application.js* is automatically determined by looking at the filename
extension in the asset name (*application.js* in the above example).
If the asset does not have a filename extension, the content-type is
determined by looking at the filename extension of the first file in the
*files* list. If no file extension can be determined, the asset will be
deliverd with a content-type of *text/plain*.
It is possible to explicitly override the content-type for an asset by
setting the optional *contentType* attribute of an asset as follows:
"assets": {
"myincludes": {
"files": [
"vendor/jquery.js",
"assets/javascripts/*"
],
"contentType": "text/javascript"
}
}

View File

@ -0,0 +1,85 @@
!CHAPTER Optional Functionality
!SUBSECTION FormatMiddleware
To use this plugin, please require it first:
FormatMiddleware = require("org/arangodb/foxx/template_middleware").FormatMiddleware;
This Middleware gives you Rails-like format handling via the *extension* of
the URL or the accept header. Say you request an URL like */people.json*:
The *FormatMiddleware* will set the format of the request to JSON and then
delete the *.json* from the request. You can therefore write handlers that
do not take an *extension* into consideration and instead handle the
format via a simple string. To determine the format of the request it
checks the URL and then the *accept* header. If one of them gives a format
or both give the same, the format is set. If the formats are not the same,
an error is raised.
Use it by calling:
FormatMiddleware = require('foxx').FormatMiddleware;
app.before(FormatMiddleware.new(['json']));
In both forms you can give a default format as a second parameter, if no
format could be determined. If you give no *defaultFormat* this case will be
handled as an error.
!SUBSECTION TemplateMiddleware
To use this plugin, please require it first:
TemplateMiddleware = require("org/arangodb/foxx/template_middleware").TemplateMiddleware;
The *TemplateMiddleware* can be used to give a Foxx.Controller the capability
of using templates. Currently you can only use Underscore Templates. It
expects documents in the following form in this collection:
{
path: "high/way",
content: "hello <%= username %>",
contentType: "text/plain",
templateLanguage: "underscore"
}
The *content* is the string that will be rendered by the template processor.
The *contentType* is the type of content that results from this call. And with
the *templateLanguage* you can choose your template processor. There is only
one choice now: *underscore*. Which would set the body of the response to
*hello Controller* with the template defined above. It will also set the
*contentType* to *text/plain* in this case. In addition to the attributes
you provided, you also have access to all your view helpers.
!SUBSUBSECTION Initialize
Initialize with the name of a collection or a collection and optionally a set of helper functions. Then use before to attach the initialized middleware to your Foxx.Controller
*Examples*
templateMiddleware = new TemplateMiddleware("templates", {
uppercase: function (x) { return x.toUpperCase(); }
});
// or without helpers:
//templateMiddleware = new TemplateMiddleware("templates");
app.before(templateMiddleware);
!SUBSUBSECTION Render
`response.render(templatePath, data)`
When the TemplateMiddleware is included, you will have access to the render function on the response object. If you call render, Controller will look into the this collection and search by the path attribute. It will then render the template with the given data.
*Examples*
response.render("high/way", {username: 'Application'})
<!--
### Initialize
@copydetails JSF_foxx_TemplateMiddleware_initializer
### Render
@copydetails JSF_foxx_TemplateMiddleware_response_render
-->

View File

@ -0,0 +1,69 @@
!CHAPTER BitArray Indexes
!SUBSECTION Introduction to Bit-Array Indexes
It is possible to define a bit-array index on one or more attributes (or paths)
of a documents.
!SUBSECTION Accessing BitArray Indexes from the Shell
`collection.ensureBitarray( field1, value1, ..., fieldn, valuen)`
Creates a bitarray index on documents using attributes as paths to the fields ( field1,..., fieldn). A value ( value1,..., valuen) consists of an array of possible values that the field can take. At least one field and one set of possible values must be given.
All documents, which do not have all of the attribute paths are ignored (that is, are not part of the bitarray index, they are however stored within the collection). A document which contains all of the attribute paths yet has one or more values which are not part of the defined range of values will be rejected and the document will not inserted within the collection. Note that, if a bitarray index is created subsequent to any documents inserted in the given collection, then the creation of the index will fail if one or more documents are rejected (due to attribute values being outside the designated range).
In case that the index was successfully created, the index identifier is returned.
In the example below we create a bitarray index with one field and that field can have the values of either 0 or 1. Any document which has the attribute x defined and does not have a value of 0 or 1 will be rejected and therefore not inserted within the collection. Documents without the attribute x defined will not take part in the index.
arango> arangod> db.example.ensureBitarray("x", [0,1]);
{
"id" : "2755894/3607862",
"unique" : false,
"type" : "bitarray",
"fields" : [["x", [0, 1]]],
"undefined" : false,
"isNewlyCreated" : true
}
In the example below we create a bitarray index with one field and that field can have the values of either 0, 1 or other (indicated by []). Any document which has the attribute x defined will take part in the index. Documents without the attribute x defined will not take part in the index.
arangod> db.example.ensureBitarray("x", [0,1,[]]);
{
"id" : "2755894/4263222",
"unique" : false,
"type" : "bitarray",
"fields" : [["x", [0, 1, [ ]]]],
"undefined" : false,
"isNewlyCreated" : true
}
In the example below we create a bitarray index with two fields. Field x can have the values of either 0 or 1; while field y can have the values of 2 or "a". A document which does not have both attributes x and y will not take part within the index. A document which does have both attributes x and y defined must have the values 0 or 1 for attribute x and 2 or a for attribute y, otherwise the document will not be inserted within the collection.
arangod> db.example.ensureBitarray("x", [0,1], "y", [2,"a"]);
{
"id" : "2755894/5246262",
"unique" : false,
"type" : "bitarray",
"fields" : [["x", [0, 1]], ["y", [0, 1]]],
"undefined" : false,
"isNewlyCreated" : false
}
In the example below we create a bitarray index with two fields. Field x can have the values of either 0 or 1; while field y can have the values of 2, "a" or other . A document which does not have both attributes x and y will not take part within the index. A document which does have both attributes x and y defined must have the values 0 or 1 for attribute x and any value for attribute y will be acceptable, otherwise the document will not be inserted within the collection.
arangod> db.example.ensureBitarray("x", [0,1], "y", [2,"a",[]]);
{
"id" : "2755894/5770550",
"unique" : false,
"type" : "bitarray",
"fields" : [["x", [0, 1]], ["y", [2, "a", [ ]]]],
"undefined" : false,
"isNewlyCreated" : true
}
<!--
@anchor IndexBitArrayShellEnsureBitarray
@copydetails JSF_ArangoCollection_prototype_ensureBitarray
-->

View File

@ -1,7 +1,9 @@
!CHAPTER Installing
This chapter describes how to install ArangoDB under various operation
systems.
This chapter describes how to install ArangoDB under various operation systems.
First of all download and install the corresponding RPM or Debian package or use homebrew on the MacOS X.
You can find packages for various operation systems at our [download](http://www.arangodb.org/download) section.
If you don't want to install ArangoDB at the beginning and just want to experiment with the features, you can use our [online demo](https://www.arangodb.org/tryitout).

View File

@ -1,182 +0,0 @@
!CHAPTER QUERIES
`all()`
Selects all documents of a collection and returns a cursor. You can use toArray, next, or hasNext to access the result. The result can be limited using the skip and limit operator.
*Examples*
Use toArray to get all documents at once:
arango> db.five.all().toArray();
[
{ "_id" : "five/1798296", "_key" : "1798296", "_rev" : "1798296", "doc" : 3 },
{ "_id" : "five/1732760", "_key" : "1732760", "_rev" : "1732760", "doc" : 2 },
{ "_id" : "five/1863832", "_key" : "1863832", "_rev" : "1863832", "doc" : 4 },
{ "_id" : "five/1667224", "_key" : "1667224", "_rev" : "1667224", "doc" : 1 },
{ "_id" : "five/1929368", "_key" : "1929368", "_rev" : "1929368", "doc" : 5 }
]
Use next to loop over all documents:
arango> var a = db.five.all();
arango> while (a.hasNext()) print(a.next());
{ "_id" : "five/1798296", "_key" : "1798296", "_rev" : "1798296", "doc" : 3 }
{ "_id" : "five/1732760", "_key" : "1732760", "_rev" : "1732760", "doc" : 2 }
{ "_id" : "five/1863832", "_key" : "1863832", "_rev" : "1863832", "doc" : 4 }
{ "_id" : "five/1667224", "_key" : "1667224", "_rev" : "1667224", "doc" : 1 }
{ "_id" : "five/1929368", "_key" : "1929368", "_rev" : "1929368", "doc" : 5 }
`collection.byExample( example)`
Selects all documents of a collection that match the specified example and returns a cursor.
You can use toArray, next, or hasNext to access the result. The result can be limited using the skip and limit operator.
An attribute name of the form a.b is interpreted as attribute path, not as attribute. If you use
{ a : { c : 1 } }
as example, then you will find all documents, such that the attribute a contains a document of the form {c : 1 }. E.g., the document
{ a : { c : 1 }, b : 1 }
will match, but the document
{ a : { c : 1, b : 1 } }
will not.
However, if you use
{ a.c : 1 },
then you will find all documents, which contain a sub-document in a that has an attribute c of value 1. E.g., both documents
{ a : { c : 1 }, b : 1 } and
{ a : { c : 1, b : 1 } }
will match.
`collection.byExample( path1, value1, ...)`
As alternative you can supply a list of paths and values.
*Examples*
Use toArray to get all documents at once:
arango> db.users.all().toArray();
[ { "_id" : "users/554702285", "_key" : "554702285", "_rev" : "554702285", "id" : 323, "name" : "Peter" },
{ "_id" : "users/554636749", "_key" : "554636749", "_rev" : "554636749", "id" : 535, "name" : "Peter" },
{ "_id" : "users/554833357", "_key" : "554833357", "_rev" : "554833357", "id" : 25, "name" : "Vladimir" } ]
arango> db.users.byExample({ "id" : 323 }).toArray();
[ { "id" : 323, "name" : "Peter", "_id" : "users/554702285", "_key" : "554702285", "_rev" : "554702285" } ]
arango> db.users.byExample({ "name" : "Peter" }).toArray();
[ { "id" : 323, "name" : "Peter", "_id" : "users/554702285", "_key" : "554702285", "_rev" : "554702285" },
{ "id" : 535, "name" : "Peter", "_id" : "users/554636749", "_key" : "554636749", "_rev" : "554636749" } ]
arango> db.users.byExample({ "name" : "Peter", "id" : 535 }).toArray();
[ { "id" : 535, "name" : "Peter", "_id" : "users/554636749", "_key" : "554636749", "_rev" : "554636749" } ]
Use next to loop over all documents:
arango> var a = db.users.byExample( {"name" : "Peter" } );
arango> while (a.hasNext()) print(a.next());
{ "id" : 323, "name" : "Peter", "_id" : "users/554702285", "_key" : "554702285", "_rev" : "554702285" }
{ "id" : 535, "name" : "Peter", "_id" : "users/554636749", "_key" : "554636749", "_rev" : "554636749" }
`collection.firstExample( example)`
Returns the a document of a collection that match the specified example or null. The example must be specified as paths and values. See byExample for details.
`collection.firstExample( path1, value1, ...)`
As alternative you can supply a list of paths and values.
*Examples*
arango> db.users.firstExample("name", 1237);
{ "_id" : "users/83049373", "_key" : "83049373", "_rev" : "83049373", "name" : 1237 }
`collection.range( attribute, left, right)`
Selects all documents of a collection such that the attribute is greater or equal than left and strictly less than right.
You can use toArray, next, or hasNext to access the result. The result can be limited using the skip and limit operator.
An attribute name of the form a.b is interpreted as attribute path, not as attribute.
For range queries it is required that a skiplist index is present for the queried attribute. If no skiplist index is present on the attribute, an error will be thrown.
*Examples*
Use toArray to get all documents at once:
arangod> l = db.skip.range("age", 10, 13).toArray();
[
{ "_id" : "skip/4260278", "_key" : "4260278", "_rev" : "4260278", "age" : 10 },
{ "_id" : "skip/4325814", "_key" : "4325814", "_rev" : "4325814", "age" : 11 },
{ "_id" : "skip/4391350", "_key" : "4391350", "_rev" : "4391350", "age" : 12 }
]
`collection.any()`
The any method returns a random document from the collection. It returns null if the collection is empty.
*Examples*
arangod> db.example.any()
{ "_id" : "example/222716379559", "_rev" : "222716379559", "Hello" : "World" }
`collection.count()`
Returns the number of living documents in the collection.
*Examples*
arango> db.users.count();
10001
`collection.toArray()`
Converts the collection into an array of documents. Never use this call in a production environment.
<!--
@anchor SimpleQueryAll
@copydetails JSF_ArangoCollection_prototype_all
@CLEARPAGE
@anchor SimpleQueryByExample
@copydetails JSF_ArangoCollection_prototype_byExample
@CLEARPAGE
@anchor SimpleQueryFirstExample
@copydetails JSF_ArangoCollection_prototype_firstExample
@CLEARPAGE
@anchor SimpleQueryAny
@copydetails JSF_ArangoCollection_prototype_range
@CLEARPAGE
@anchor SimpleQueryRange
@copydetails JS_AnyQuery
@CLEARPAGE
@anchor SimpleQueryCollectionCount
@copydetails JS_CountVocbaseCol
@CLEARPAGE
@anchor SimpleQueryToArray
@copydetails JSF_ArangoCollection_prototype_toArray
@CLEARPAGE
@anchor SimpleQueryFirst
@copydetails JSF_ArangoCollection_prototype_first
@CLEARPAGE
@anchor SimpleQueryLast
@copydetails JSF_ArangoCollection_prototype_last
-->

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,3 @@
@import "vendors/bootstrap/bootstrap.less";
@import "mixins.less";
@import "ebook/variables.less";
@ -12,16 +11,11 @@ article {
page-break-after: always;
}
h1 { font-size: floor(@font-size-base * 2.15); }
h2 { font-size: floor(@font-size-base * 1.70); }
h3 { font-size: ceil(@font-size-base * 1.25); }
h4 { font-size: ceil(@font-size-base * 1); }
h5 { font-size: ceil(@font-size-base * 0.85); }
h6 { font-size: ceil(@font-size-base * 0.65); }
pre, blockquote {
border: 1px solid #999;
page-break-inside: avoid;
background: #f1f1f1;
padding: 8px;
}
img {
@ -30,7 +24,7 @@ img {
margin: 0px auto;
}
.exercise {
.exercise, .quiz {
margin: 1cm 0cm;
padding: 0.4cm;
page-break-inside: avoid;
@ -42,4 +36,8 @@ img {
padding-bottom: 0.2cm;
border-bottom: 1px solid #ddd;
}
.question {
margin-top: 0.4cm;
}
}

View File

@ -37,7 +37,8 @@
background: @page-background;
border-radius: 2px;
line-height: 1.5em;
line-height: @content-line-height;
font-size: @default-font-size;
}
.btn-group {

View File

@ -301,7 +301,7 @@
font-size: inherit;
line-height: 1.5em;
overflow: auto;
padding: 20px;
padding: 10px;
border-radius: 3px;
}

View File

@ -13,7 +13,7 @@
flex-direction: column;
font-size: 40px;
color: rgba(0,0,0,0.4);
color: rgba(0, 0, 0, 0.2);
text-align: center;
@ -21,7 +21,7 @@
&:hover {
text-decoration: none;
color: rgba(0,0,0,0.6);
color: rgba(0, 0, 0, 0.6);
}
&.navigation-next {

View File

@ -43,6 +43,9 @@
@page-color: black;
@page-background: @body-background;
// Content
@content-line-height: 1.6em;
// Progress Bar
@chapter-display: none;
@chapter-size: 16px;
@ -86,11 +89,12 @@
@FontPath: '@{staticPath}/fonts';
@fa-font-path: "@{FontPath}/fontawesome";
@s-font-size: 1.2rem;
@m-font-size: 1.4rem;
@l-font-size: 1.6rem;
@s-font-size: 1.2rem;
@m-font-size: 1.4rem;
@l-font-size: 1.6rem;
@xl-font-size: 2.2rem;
@xxl-font-size: 4.0rem;
@default-font-size: @l-font-size;
/*
,--------.,--.

View File

@ -15,7 +15,6 @@
{% if options.links.sharing.twitter !== false %}
<a href="#" target="_blank" class="btn pull-right twitter-sharing-link sharing-link" data-sharing="twitter" aria-label="Share on Twitter"><i class="fa fa-twitter"></i></a>
{% endif %}
{% if githubId %}
<a href="{{ githubHost }}{{ githubId }}/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
<a href="{{ githubHost }}{{ githubId }}/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
@ -23,8 +22,7 @@
<!-- Title -->
<h1>
<i class="fa fa-spinner fa-spin"></i>
<a href="https://www.arangodb.org" > <img src="../Arangodb_Logo.png" alt="ArangoDB" border="0" style="position:relative"></a>
<div style="position:relative; bottom:45px; left:90px; font-size:12pt">2.1.0</div>
<a href="https://www.arangodb.org" > <img src="../Arangodb_Logo.png" alt="ArangoDB" style="position:relative; border:0px; top:-4px"></a>
<div style="position:relative; bottom:50px; left:79px; font-size:12pt">2.1.0</div>
</h1>
</div>

View File

@ -22,6 +22,7 @@
<input type="text" placeholder="Search" class="form-control" />
</div>
<ul class="summary">
{% set _divider = false %}
{% if options.links.issues !== false && (options.links.issues || githubId) %}
{% set _divider = true %}
<li>
@ -36,15 +37,9 @@
<a href="{{ basePath }}/"><i class="fa fa-check"></i> Introduction</a>
</li>
{{ articles(summary.chapters) }}
{% if options.links.gitbook !== false %}
<li class="divider"></li>
<li>
<a href="http://www.gitbook.io/" target="blank" class="gitbook-link">Generated using GitBook</a>
</li>
{% endif %}
</ul>
</div>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
jQuery(".summary>li").each(function(){
var flag = true;

View File

@ -2,6 +2,10 @@
{% block title %}{{ title }}{% endblock %}
{% block style %}
<link rel="stylesheet" href="{{ staticBase }}/style.css">
{% endblock %}
{% block content %}
<div class="book-langs-index">
<div class="inner">

View File

@ -1,54 +1,26 @@
<!DOCTYPE HTML>
<html lang="en-US" {% block htmlTag %}{% endblock %}>
{{ htmlSnippet("html:start")|default("") }}
<head prefix="og: http://ogp.me/ns# book: http://ogp.me/ns/book#">
<head>
{{ htmlSnippet("head:start")|default("") }}
{% block head %}
<meta charset="UTF-8">
<title>{% block title %} | {{ title }}{% endblock %}</title>
<title>{% block title %}{% endblock %}</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="robots" content="index, follow">
<meta name="author" content="{{ githubAuthor }}">
<meta name="description" content="{{ description }}">
<meta name="keywords" content="gitbook,github" >
<meta name="generator" content="www.gitbook.io">
{% if progress.current.next and progress.current.next.path %}
<link rel="next" href="{{ basePath }}/{{ progress.current.next.path|mdLink }}" />
{% endif %}
{% if progress.current.prev and progress.current.prev.path %}
<link rel="prev" href="{{ basePath }}/{{ progress.current.prev.path|mdLink }}" />
{% endif %}
<meta property="og:title" content="{% block title %} | {{ title }}{% endblock %}">
<meta property="og:site_name" content="{{ title }}">
<meta property="og:type" content="book">
<meta property="og:locale" content="en_US">
<meta property="book:author" content="{{ githubHost }}{{ githubAuthor }}">
<meta property="book:tag" content="GitBook">
<meta name="description" content="{% block description %}{% endblock %}">
<meta name="generator" content="GitBook {{ gitbook.version }}">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="shortcut icon" href="{{ staticBase }}/images/favicon.ico" type="image/x-icon">
{% endblock %}
{% block head %}{% endblock %}
{{ htmlSnippet("head:end")|default("") }}
</head>
<body>
{{ htmlSnippet("body:start")|default("") }}
{% block style %}
<link rel="stylesheet" href="{{ staticBase }}/style.css">
{% endblock %}
{% block style %}{% endblock %}
{% block content %}{% endblock %}
{% block javascript %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.3/ace.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.3/mode-javascript.js"></script>
<script src="{{ staticBase }}/jsrepl/jsrepl.js" id="jsrepl-script"></script>
<script src="{{ staticBase }}/app.js"></script>
{% endblock %}
{% block javascript %}{% endblock %}
{{ htmlSnippet("body:end")|default("") }}
</body>
{{ htmlSnippet("html:end")|default("") }}

View File

@ -20,9 +20,14 @@
</div>
{% elif section.type == "quiz" %}
<div class="quiz">
<div class="exercise-header">Exercise #{{ exercise }}</div>
<div class="exercise-header">Quiz #{{ exercise }}</div>
{% autoescape false %}{{ section.content }}{% endautoescape %}
{% autoescape false %}{{ section.quiz.base }}{% endautoescape %}
{% for quiz in section.quiz %}
<div class="question">
<div class="question-header">Question {{ loop.index }} of {{ section.quiz.length }}</div>
{% autoescape false %}{{ quiz.base }}{% endautoescape %}
</div>
{% endfor %}
{% set exercise = exercise + 1 %}
</div>
{% endif %}
@ -60,9 +65,14 @@
</div>
{% elif section.type == "quiz" %}
<div class="quiz">
<div class="exercise-header">Exercise #{{ exercise }}</div>
<div class="exercise-header">Quiz #{{ exercise }}</div>
{% autoescape false %}{{ section.content }}{% endautoescape %}
{% autoescape false %}{{ section.quiz.solution }}{% endautoescape %}
{% for quiz in section.quiz %}
<div class="question">
<div class="question-header">Question {{ loop.index }} of {{ section.quiz.length }}</div>
{% autoescape false %}{{ quiz.solution }}{% endautoescape %}
</div>
{% endfor %}
{% set exercise = exercise + 1 %}
</div>
{% endif %}

View File

@ -1,7 +1,23 @@
{% extends "layout.html" %}
{% block htmlTag %}{% if options.cache !== false %}manifest="{{ basePath }}/manifest.appcache"{% endif %}{% endblock %}
{% block title %}{{ progress.current.title }}{% parent %}{% endblock %}
{% block head %}
{% parent %}
{% if githubAuthor %}
<meta name="author" content="{{ githubAuthor }}">
{% endif %}
{% if progress.current.next and progress.current.next.path %}
<link rel="next" href="{{ basePath }}/{{ progress.current.next.path|mdLink }}" />
{% endif %}
{% if progress.current.prev and progress.current.prev.path %}
<link rel="prev" href="{{ basePath }}/{{ progress.current.prev.path|mdLink }}" />
{% endif %}
{% endblock %}
{% block title %}{{ progress.current.title }} | {{ title }}{% endblock %}
{% block description %}{% if progress.current.level == "0" %}{{ description }}{% endif %}{% endblock %}
{% block content %}
<div class="book" {% if githubId %}data-github="{{ githubId }}"{% endif %} data-level="{{ progress.current.level }}" data-basepath="{{ basePath }}" data-revision="{{ revision }}">
{% include "includes/book/header.html" %}
@ -38,7 +54,8 @@
{% endblock %}
{% block javascript %}
{% parent %}
<script src="{{ staticBase }}/jsrepl/jsrepl.js" id="jsrepl-script"></script>
<script src="{{ staticBase }}/app.js"></script>
{% for resource in plugins.resources.js %}
{% if resource.url %}
<script src="{{ resource.url }}"></script>
@ -55,7 +72,7 @@ require(["gitbook"], function(gitbook) {
{% endblock %}
{% block style %}
{% parent %}
<link rel="stylesheet" href="{{ staticBase }}/style.css">
{% for resource in plugins.resources.css %}
{% if resource.url %}
<link rel="stylesheet" href="{{ resource.url }}">

View File

@ -0,0 +1,446 @@
# coding: utf-8
require 'rspec'
require 'json'
require 'arangodb.rb'
PREFIX = "api-general-graph"
URLPREFIX = "/system/gharial"
def drop_graph(graph_name)
cmd = URLPREFIX + "/" + graph_name
doc = ArangoDB.delete(cmd)
return doc
end
def create_graph (name, edge_definitions)
cmd = URLPREFIX
body = JSON.dump({:name => name, :edgeDefinitions => edge_definitions})
doc = ArangoDB.post(cmd, :body => body)
return doc
end
def vertex_endpoint(graph_name, collection)
return URLPREFIX + "/" + graph_name + "/vertex/" + collection
end
def edge_endpoint(graph_name, collection)
return URLPREFIX + "/" + graph_name + "/edge/" + collection
end
def additional_edge_definition (graph_name, edge_definitions)
cmd = URLPREFIX + "/" + graph_name + "/edge"
doc = ArangoDB.post(cmd, :body => JSON.dump(edge_definitions))
return doc
end
def change_edge_definition (graph_name, definition_name, edge_definitions)
cmd = edge_endpoint(graph_name, definition_name)
doc = ArangoDB.put(cmd, :body => JSON.dump(edge_definitions))
return doc
end
def delete_edge_definition (graph_name, definition_name)
cmd = edge_endpoint(graph_name, definition_name)
doc = ArangoDB.delete(cmd)
return doc
end
def create_vertex (graph_name, collection, body)
cmd = vertex_endpoint(graph_name, collection)
doc = ArangoDB.post(cmd, :body => JSON.dump(body))
return doc
end
def get_vertex (graph_name, collection, key)
cmd = vertex_endpoint(graph_name, collection) + "/" + key
doc = ArangoDB.get(cmd)
return doc
end
def update_vertex (graph_name, collection, key, body, keepNull)
cmd = vertex_endpoint(graph_name, collection)
cmd = cmd + "/" + key
if keepNull != '' then
cmd = cmd + "?keepNull=#{keepNull}"
end
doc = ArangoDB.patch(cmd, :body => JSON.dump(body))
return doc
end
def replace_vertex (graph_name, collection, key, body)
cmd = vertex_endpoint(graph_name, collection)
cmd = cmd + "/" + key
doc = ArangoDB.put(cmd, :body => JSON.dump(body))
return doc
end
def delete_vertex (graph_name, collection, key)
cmd = vertex_endpoint(graph_name, collection)
cmd = cmd + "/" + key
doc = ArangoDB.delete(cmd)
return doc
end
def create_edge (graph_name, collection, from, to, body)
cmd = edge_endpoint(graph_name, collection)
body["_from"] = from
body["_to"] = to
doc = ArangoDB.post(cmd, :body => JSON.dump(body))
return doc
end
def get_edge (graph_name, collection, key)
cmd = edge_endpoint(graph_name, collection) + "/" + key
doc = ArangoDB.get(cmd)
return doc
end
def update_edge (graph_name, collection, key, body, keepNull)
cmd = edge_endpoint(graph_name, collection) + "/" + key
if keepNull != '' then
cmd = cmd + "?keepNull=" + keepNull
end
doc = ArangoDB.patch(cmd, :body => JSON.dump(body))
return doc
end
def replace_edge (graph_name, collection, key, body)
cmd = edge_endpoint(graph_name, collection)
cmd = cmd + "/" + key
doc = ArangoDB.put(cmd, :body => JSON.dump(body))
return doc
end
def delete_edge (graph_name, collection, key)
cmd = edge_endpoint(graph_name, collection)
cmd = cmd + "/" + key
doc = ArangoDB.delete(cmd)
return doc
end
describe ArangoDB do
user_collection = "UnitTestUsers"
product_collection = "UnitTestProducts"
friend_collection = "UnitTestFriends"
bought_collection = "UnitTestBoughts"
graph_name = "UnitTestGraph"
context "testing general graph methods:" do
################################################################################
## checking graph creation process
################################################################################
context "check creation of graphs" do
before do
drop_graph(graph_name)
end
after do
drop_graph(graph_name)
end
it "can create an emtpy graph" do
edge_definition = []
doc = create_graph( graph_name, edge_definition )
doc.code.should eq(201)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(201)
doc.parsed_response['graph']['name'].should eq(graph_name)
# doc.parsed_response['graph']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['graph']['edgeDefinitions'].should eq(edge_definition)
end
it "can create a graph with definitions" do
first_def = { "collection" => friend_collection, "from" => [user_collection], "to" => [user_collection] }
edge_definition = [first_def]
doc = create_graph( graph_name, edge_definition )
doc.code.should eq(201)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(201)
doc.parsed_response['graph']['name'].should eq(graph_name)
# doc.parsed_response['graph']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['graph']['edgeDefinitions'].should eq(edge_definition)
end
it "can add additional edge definitions" do
first_def = { "collection" => friend_collection, "from" => [user_collection], "to" => [user_collection] }
edge_definition = [first_def]
create_graph( graph_name, edge_definition )
second_def = { "collection" => bought_collection, "from" => [user_collection], "to" => [product_collection] }
doc = additional_edge_definition( graph_name, second_def )
edge_definition.push(second_def)
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['graph']['name'].should eq("#{graph_name}")
doc.parsed_response['graph']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['graph']['edgeDefinitions'].should eq(edge_definition)
end
it "can modify existing edge definitions" do
first_def = { "collection" => friend_collection, "from" => [user_collection], "to" => [user_collection] }
create_graph( graph_name, [first_def] )
second_def = { "collection" => friend_collection, "from" => [product_collection], "to" => [user_collection] }
edge_definition = [second_def]
doc = change_edge_definition( graph_name, friend_collection, second_def )
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['graph']['name'].should eq("#{graph_name}")
doc.parsed_response['graph']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['graph']['edgeDefinitions'].should eq(edge_definition)
end
it "can delete a graph again" do
definition = { "collection" => friend_collection, "from" => [user_collection], "to" => [user_collection] }
create_graph(graph_name, [definition])
doc = drop_graph(graph_name)
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
end
it "can not delete a graph twice" do
definition = { "collection" => friend_collection, "from" => [user_collection], "to" => [user_collection] }
create_graph(graph_name, [definition])
drop_graph(graph_name)
doc = drop_graph(graph_name)
doc.code.should eq(404)
doc.parsed_response['error'].should eq("graph not found")
doc.parsed_response['code'].should eq(404)
end
it "can not create a graph twice" do
definition = { "collection" => friend_collection, "from" => [user_collection], "to" => [user_collection] }
create_graph(graph_name, [definition])
doc = create_graph(graph_name, [definition])
doc.code.should eq(409)
doc.parsed_response['error'].should eq("graph already exists")
doc.parsed_response['code'].should eq(409)
end
end
context "check vertex operations" do
before do
drop_graph(graph_name)
definition = { "collection" => friend_collection, "from" => [user_collection], "to" => [user_collection] }
create_graph(graph_name, [definition])
end
after do
drop_graph(graph_name)
end
it "can create a vertex" do
name = "Alice"
doc = create_vertex(graph_name, user_collection, {"name" => name})
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['vertex']['_rev'].should eq(doc.headers['etag'])
end
it "can get a vertex" do
name = "Alice"
doc = create_vertex(graph_name, user_collection, {"name" => name})
key = doc.parsed_response['vertex']['_key']
doc = get_vertex(graph_name, user_collection, key)
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['vertex']['name'].should eq(name)
doc.parsed_response['vertex']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['vertex']['_key'].should eq(key)
end
it "can replace a vertex" do
name = "Alice"
doc = create_vertex(graph_name, user_collection, {"name" => name})
key = doc.parsed_response['vertex']['_key']
oldTag = doc.parsed_response['vertex']['_rev']
oldTag.should eq(doc.headers['etag'])
name = "Bob"
doc = replace_vertex(graph_name, user_collection, key, {"name2" => name})
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['vertex']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['vertex']['_key'].should eq(key)
doc = get_vertex(graph_name, user_collection, key)
doc.parsed_response['vertex']['name'].should eq(nil)
doc.parsed_response['vertex']['name2'].should eq(name)
doc.parsed_response['vertex']['_rev'].should eq(doc.headers['etag'])
oldTag.should_not eq(doc.headers['etag'])
doc.parsed_response['vertex']['_key'].should eq(key)
end
it "can update a vertex" do
name = "Alice"
doc = create_vertex(graph_name, user_collection, {"name" => name})
key = doc.parsed_response['vertex']['_key']
name2 = "Bob"
doc = update_vertex(graph_name, user_collection, key, {"name2" => name2}, "")
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['vertex']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['vertex']['_key'].should eq(key)
doc = get_vertex(graph_name, user_collection, key)
doc.parsed_response['vertex']['name'].should eq(name)
doc.parsed_response['vertex']['name2'].should eq(name2)
doc.parsed_response['vertex']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['vertex']['_key'].should eq(key)
end
it "can delete a vertex" do
name = "Alice"
doc = create_vertex(graph_name, user_collection, {"name" => name})
key = doc.parsed_response['vertex']['_key']
doc = delete_vertex(graph_name, user_collection, key)
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc = get_vertex(graph_name, user_collection, key)
doc.code.should eq(404)
doc.parsed_response['error'].should eq("document not found")
doc.parsed_response['code'].should eq(404)
end
end
context "check edge operations" do
before do
drop_graph(graph_name)
definition = { "collection" => friend_collection, "from" => [user_collection], "to" => [user_collection] }
create_graph(graph_name, [definition])
end
after do
drop_graph(graph_name)
end
it "can create an edge" do
v1 = create_vertex(graph_name, user_collection, {})
v1 = v1.parsed_response['vertex']['_id']
v2 = create_vertex(graph_name, user_collection, {})
v2 = v2.parsed_response['vertex']['_id']
doc = create_edge(graph_name, friend_collection, v1, v2, {})
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['edge']['_rev'].should eq(doc.headers['etag'])
end
it "can get an edge" do
v1 = create_vertex(graph_name, user_collection, {})
v1 = v1.parsed_response['vertex']['_id']
v2 = create_vertex(graph_name, user_collection, {})
v2 = v2.parsed_response['vertex']['_id']
type = "married"
doc = create_edge(graph_name, friend_collection, v1, v2, {"type" => type})
key = doc.parsed_response['edge']['_key']
doc = get_edge(graph_name, friend_collection, key)
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['edge']['type'].should eq(type)
doc.parsed_response['edge']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['edge']['_key'].should eq(key)
end
it "can replace an edge" do
v1 = create_vertex(graph_name, user_collection, {})
v1 = v1.parsed_response['vertex']['_id']
v2 = create_vertex(graph_name, user_collection, {})
v2 = v2.parsed_response['vertex']['_id']
type = "married"
doc = create_edge(graph_name, friend_collection, v1, v2, {"type" => type})
key = doc.parsed_response['edge']['_key']
oldTag = doc.parsed_response['edge']['_rev']
oldTag.should eq(doc.headers['etag'])
type = "divorced"
doc = replace_edge(graph_name, friend_collection, key, {"type2" => type})
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['edge']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['edge']['_key'].should eq(key)
doc = get_edge(graph_name, friend_collection, key)
doc.parsed_response['edge']['type'].should eq(nil)
doc.parsed_response['edge']['type2'].should eq(type)
doc.parsed_response['edge']['_rev'].should eq(doc.headers['etag'])
oldTag.should_not eq(doc.headers['etag'])
doc.parsed_response['edge']['_key'].should eq(key)
end
it "can update an edge" do
v1 = create_vertex(graph_name, user_collection, {})
v1 = v1.parsed_response['vertex']['_id']
v2 = create_vertex(graph_name, user_collection, {})
v2 = v2.parsed_response['vertex']['_id']
type = "married"
doc = create_edge(graph_name, friend_collection, v1, v2, {"type" => type})
key = doc.parsed_response['edge']['_key']
type2 = "divorced"
doc = update_edge(graph_name, friend_collection, key, {"type2" => type2}, "")
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['edge']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['edge']['_key'].should eq(key)
doc = get_edge(graph_name, friend_collection, key)
doc.parsed_response['edge']['type'].should eq(type)
doc.parsed_response['edge']['type2'].should eq(type2)
doc.parsed_response['edge']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['edge']['_key'].should eq(key)
end
it "can delete an edge" do
v1 = create_vertex(graph_name, user_collection, {})
v1 = v1.parsed_response['vertex']['_id']
v2 = create_vertex(graph_name, user_collection, {})
v2 = v2.parsed_response['vertex']['_id']
type = "married"
doc = create_edge(graph_name, friend_collection, v1, v2, {"type" => type})
key = doc.parsed_response['edge']['_key']
doc = delete_edge(graph_name, friend_collection, key)
doc.code.should eq(200)
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc = get_edge(graph_name, friend_collection, key)
doc.code.should eq(404)
doc.parsed_response['error'].should eq("document not found")
doc.parsed_response['code'].should eq(404)
end
end
end
end

View File

@ -18,6 +18,7 @@ JAVASCRIPT_BROWSER = \
js/apps/system/aardvark/frontend/js/modules/org/arangodb/general-graph.js \
js/apps/system/aardvark/frontend/js/modules/org/arangodb/graph.js \
js/apps/system/aardvark/frontend/js/modules/org/arangodb/graph-blueprint.js \
js/apps/system/aardvark/frontend/js/modules/org/arangodb/is.js \
js/apps/system/aardvark/frontend/js/modules/org/arangodb/simple-query.js \
\
js/apps/system/aardvark/frontend/js/modules/org/arangodb-common.js \

View File

@ -509,16 +509,13 @@ function delete_graph_graph (req, res) {
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a graph vertex
///
/// @RESTHEADER{POST /_api/graph/`graph-name`/`vertex-name`,create vertex}
/// @RESTHEADER{POST /_api/graph/`graph-name`/vertex,create vertex}
///
/// @RESTURLPARAMETERS
///
/// @RESTURLPARAM{graph-name,string,required}
/// The name of the graph
///
/// @RESTURLPARAM{vertex-name,string,required}
/// The name of the vertex
///
/// @RESTQUERYPARAMETERS
///
/// @RESTQUERYPARAM{waitForSync,boolean,optional}
@ -598,7 +595,7 @@ function post_graph_vertex (req, res, g) {
////////////////////////////////////////////////////////////////////////////////
/// @brief gets the vertex properties
///
/// @RESTHEADER{GET /_api/graph/`graph-name`/`vertex-name`,get vertex}
/// @RESTHEADER{GET /_api/graph/`graph-name`/vertex/`vertex-name`,get vertex}
///
/// @RESTURLPARAMETERS
///
@ -692,7 +689,7 @@ function get_graph_vertex (req, res, g) {
////////////////////////////////////////////////////////////////////////////////
/// @brief delete vertex
///
/// @RESTHEADER{DELETE /_api/graph/`graph-name`/`vertex-name`,delete vertex}
/// @RESTHEADER{DELETE /_api/graph/`graph-name`/vertex/`vertex-name`,delete vertex}
///
/// @RESTURLPARAMETERS
///
@ -855,7 +852,7 @@ function update_graph_vertex (req, res, g, isPatch) {
////////////////////////////////////////////////////////////////////////////////
/// @brief updates a vertex
///
/// @RESTHEADER{PUT /_api/graph/`graph-name`/`vertex-name`,update vertex}
/// @RESTHEADER{PUT /_api/graph/`graph-name`/vertex/`vertex-name`,update vertex}
///
/// @RESTURLPARAMETERS
///
@ -933,7 +930,7 @@ function put_graph_vertex (req, res, g) {
////////////////////////////////////////////////////////////////////////////////
/// @brief updates a vertex
///
/// @RESTHEADER{PATCH /_api/graph/`graph-name`/`vertex-name`,update vertex}
/// @RESTHEADER{PATCH /_api/graph/`graph-name`/vertex/`vertex-name`,update vertex}
///
/// @RESTURLPARAMETERS
///
@ -1392,16 +1389,13 @@ function post_graph_vertex_vertices (req, res, g) {
////////////////////////////////////////////////////////////////////////////////
/// @brief creates an edge
///
/// @RESTHEADER{POST /_api/graph/`graph-name`/`edge-name`,create edge}
/// @RESTHEADER{POST /_api/graph/`graph-name`/edge,create edge}
///
/// @RESTURLPARAMETERS
///
/// @RESTURLPARAM{graph-name,string,required}
/// The name of the graph
///
/// @RESTURLPARAM{edge-name,string,required}
/// The name of the edge
///
/// @RESTQUERYPARAMETERS
///
/// @RESTQUERYPARAM{waitForSync,boolean,optional}
@ -1498,7 +1492,7 @@ function post_graph_edge (req, res, g) {
////////////////////////////////////////////////////////////////////////////////
/// @brief get edge properties
///
/// @RESTHEADER{GET /_api/graph/`graph-name`/edge,get edge}
/// @RESTHEADER{GET /_api/graph/`graph-name`/edge/`edge-name`,get edge}
///
/// @RESTURLPARAMETERS
///
@ -1591,7 +1585,7 @@ function get_graph_edge (req, res, g) {
////////////////////////////////////////////////////////////////////////////////
/// @brief deletes an edge
///
/// @RESTHEADER{DELETE /_api/graph/`graph-name`/`edge-name`,delete edge}
/// @RESTHEADER{DELETE /_api/graph/`graph-name`/edge/`edge-name`,delete edge}
///
/// @RESTURLPARAMETERS
///
@ -1757,7 +1751,7 @@ function update_graph_edge (req, res, g, isPatch) {
////////////////////////////////////////////////////////////////////////////////
/// @brief updates an edge
///
/// @RESTHEADER{PUT /_api/graph/`graph-name`/`edge-name`,update edge}
/// @RESTHEADER{PUT /_api/graph/`graph-name`/edge/`edge-name`,update edge}
///
/// @RESTURLPARAMETERS
///
@ -1839,7 +1833,7 @@ function put_graph_edge (req, res, g) {
////////////////////////////////////////////////////////////////////////////////
/// @brief updates an edge
///
/// @RESTHEADER{PATCH /_api/graph/`graph-name`/`edge-name`,update edge}
/// @RESTHEADER{PATCH /_api/graph/`graph-name`/edge/`edge-name`,update edge}
///
/// @RESTURLPARAMETERS
///

View File

@ -8,15 +8,15 @@
{
"errorResponses": [
{
"reason": "is returned if the batch was received successfully. HTTP 200 is returned even if one or multiple batch part actions failed. ",
"reason": "is returned if the batch was received successfully. HTTP 200 is returned even if one or multiple batch part actions failed. <br><br>",
"code": "200"
},
{
"reason": "is returned if the batch envelope is malformed or incorrectly formatted. This code will also be returned if the content-type of the overall batch request or the individual MIME parts is not as expected. ",
"reason": "is returned if the batch envelope is malformed or incorrectly formatted. This code will also be returned if the content-type of the overall batch request or the individual MIME parts is not as expected. <br><br>",
"code": "400"
},
{
"reason": "is returned when an invalid HTTP method is used. ",
"reason": "is returned when an invalid HTTP method is used. <br><br>",
"code": "405"
}
],
@ -26,13 +26,13 @@
"paramType": "body",
"required": "true",
"name": "body",
"description": "The multipart batch request, consisting of the envelope and the individual batch parts. "
"description": "The multipart batch request, consisting of the envelope and the individual batch parts. <br><br>"
}
],
"notes": "Executes a batch request. A batch request can contain any number of other requests that can be sent to ArangoDB in isolation. The benefit of using batch requests is that batching requests requires less client/server roundtrips than when sending isolated requests. <br><br>All parts of a batch request are executed serially on the server. The server will return the results of all parts in a single response when all parts are finished. <br><br>Technically, a batch request is a multipart HTTP request, with content-type <em>multipart/form-data</em>. A batch request consists of an envelope and the individual batch part actions. Batch part actions are \"regular\" HTTP requests, including full header and an optional body. Multiple batch parts are separated by a boundary identifier. The boundary identifier is declared in the batch envelope. The MIME content-type for each individual batch part must be <em>application/x-arango-batchpart</em>. <br><br>Please note that when constructing the individual batch parts, you must use CRLF (<em>\\r\\n</em>) as the line terminator as in regular HTTP messages. <br><br>The response sent by the server will be an <em>HTTP 200</em> response, with an optional error summary header <em>x-arango-errors</em>. This header contains the number of batch part operations that failed with an HTTP error code of at least 400. This header is only present in the response if the number of errors is greater than zero. <br><br>The response sent by the server is a multipart response, too. It contains the individual HTTP responses for all batch parts, including the full HTTP result header (with status code and other potential headers) and an optional result body. The individual batch parts in the result are seperated using the same boundary value as specified in the request. <br><br>The order of batch parts in the response will be the same as in the original client request. Client can additionally use the <em>Content-Id</em> MIME header in a batch part to define an individual id for each batch part. The server will return this id is the batch part responses, too. <br><br>",
"notes": "Executes a batch request. A batch request can contain any number of other requests that can be sent to ArangoDB in isolation. The benefit of using batch requests is that batching requests requires less client/server roundtrips than when sending isolated requests. <br><br> All parts of a batch request are executed serially on the server. The server will return the results of all parts in a single response when all parts are finished. <br><br> Technically, a batch request is a multipart HTTP request, with content-type <em>multipart/form-data</em>. A batch request consists of an envelope and the individual batch part actions. Batch part actions are \"regular\" HTTP requests, including full header and an optional body. Multiple batch parts are separated by a boundary identifier. The boundary identifier is declared in the batch envelope. The MIME content-type for each individual batch part must be <em>application/x-arango-batchpart</em>. <br><br> Please note that when constructing the individual batch parts, you must use CRLF (<em>\\r\\n</em>) as the line terminator as in regular HTTP messages. <br><br> The response sent by the server will be an <em>HTTP 200</em> response, with an optional error summary header <em>x-arango-errors</em>. This header contains the number of batch part operations that failed with an HTTP error code of at least 400. This header is only present in the response if the number of errors is greater than zero. <br><br> The response sent by the server is a multipart response, too. It contains the individual HTTP responses for all batch parts, including the full HTTP result header (with status code and other potential headers) and an optional result body. The individual batch parts in the result are seperated using the same boundary value as specified in the request. <br><br> The order of batch parts in the response will be the same as in the original client request. Client can additionally use the <em>Content-Id</em> MIME header in a batch part to define an individual id for each batch part. The server will return this id is the batch part responses, too. <br><br>",
"summary": "executes a batch request",
"httpMethod": "POST",
"examples": "Sending a batch request with five batch parts: - GET /_api/version - DELETE /_api/collection/products - POST /_api/collection/products - GET /_api/collection/products/figures - DELETE /_api/collection/products The boundary (<em>SomeBoundaryValue</em>) is passed to the server in the HTTP <em>Content-Type</em> HTTP header. <br><br><pre><code class=\"json\" >unix> curl -X POST --header 'Content-Type: multipart/form-data; boundary=SomeBoundaryValue' --data-binary @- --dump - http://localhost:8529/_api/batch\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId1\r\n\r\nGET /_api/version HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId2\r\n\r\nDELETE /_api/collection/products HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: someId\r\n\r\nPOST /_api/collection/products HTTP/1.1\r\n\r\n{ \"name\": \"products\" }\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: nextId\r\n\r\nGET /_api/collection/products/figures HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: otherId\r\n\r\nDELETE /_api/collection/products HTTP/1.1\r\n--SomeBoundaryValue--\r\n\n\nHTTP/1.1 200 OK\ncontent-type: multipart/form-data; boundary=SomeBoundaryValue\nx-arango-errors: 1\n\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId1\r\n\r\nHTTP/1.1 200 OK\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 41\r\n\r\n{\"server\":\"arango\",\"version\":\"2.0.0-rc1\"}\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId2\r\n\r\nHTTP/1.1 404 Not Found\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 88\r\n\r\n{\"error\":true,\"code\":404,\"errorNum\":1203,\"errorMessage\":\"unknown collection 'products'\"}\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: someId\r\n\r\nHTTP/1.1 200 OK\r\nlocation: /_db/_system/_api/collection/products\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 137\r\n\r\n{\"id\":\"294085710\",\"name\":\"products\",\"waitForSync\":false,\"isVolatile\":false,\"isSystem\":false,\"status\":3,\"type\":2,\"error\":false,\"code\":200}\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: nextId\r\n\r\nHTTP/1.1 200 OK\r\nlocation: /_db/_system/_api/collection/products/figures\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 538\r\n\r\n{\"id\":\"294085710\",\"name\":\"products\",\"doCompact\":true,\"isVolatile\":false,\"isSystem\":false,\"journalSize\":1048576,\"keyOptions\":{\"type\":\"traditional\",\"allowUserKeys\":true},\"waitForSync\":false,\"count\":0,\"figures\":{\"alive\":{\"count\":0,\"size\":0},\"dead\":{\"count\":0,\"size\":0,\"deletion\":0},\"datafiles\":{\"count\":0,\"fileSize\":0},\"journals\":{\"count\":0,\"fileSize\":0},\"compactors\":{\"count\":0,\"fileSize\":0},\"shapefiles\":{\"count\":0,\"fileSize\":0},\"shapes\":{\"count\":0,\"size\":0},\"attributes\":{\"count\":0,\"size\":0}},\"status\":3,\"type\":2,\"error\":false,\"code\":200}\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: otherId\r\n\r\nHTTP/1.1 200 OK\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 43\r\n\r\n{\"id\":\"294085710\",\"error\":false,\"code\":200}\r\n--SomeBoundaryValue--\n\n</code></pre><br>Sending a batch request, setting the boundary implicitly (the server will in this case try to find the boundary at the beginning of the request body). <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/batch\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nDELETE /_api/collection/notexisting1 HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nDELETE /_api/collection/notexisting2 HTTP/1.1\r\n--SomeBoundaryValue--\r\n\n\nHTTP/1.1 200 OK\nx-arango-errors: 2\n\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nHTTP/1.1 404 Not Found\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 92\r\n\r\n{\"error\":true,\"code\":404,\"errorNum\":1203,\"errorMessage\":\"unknown collection 'notexisting1'\"}\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nHTTP/1.1 404 Not Found\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 92\r\n\r\n{\"error\":true,\"code\":404,\"errorNum\":1203,\"errorMessage\":\"unknown collection 'notexisting2'\"}\r\n--SomeBoundaryValue--\n\n</code></pre><br>",
"examples": "<br><br> Sending a batch request with five batch parts: <br><br> <ul class=\"swagger-list\"><li>GET /_api/version <li>DELETE /_api/collection/products <li>POST /_api/collection/products <li>GET /_api/collection/products/figures <li>DELETE /_api/collection/products </ul> The boundary (<em>SomeBoundaryValue</em>) is passed to the server in the HTTP <em>Content-Type</em> HTTP header. <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --header 'Content-Type: multipart/form-data; boundary=SomeBoundaryValue' --data-binary @- --dump - http://localhost:8529/_api/batch\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId1\r\n\r\nGET /_api/version HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId2\r\n\r\nDELETE /_api/collection/products HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: someId\r\n\r\nPOST /_api/collection/products HTTP/1.1\r\n\r\n{ \"name\": \"products\" }\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: nextId\r\n\r\nGET /_api/collection/products/figures HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: otherId\r\n\r\nDELETE /_api/collection/products HTTP/1.1\r\n--SomeBoundaryValue--\r\n\n\nHTTP/1.1 200 OK\ncontent-type: multipart/form-data; boundary=SomeBoundaryValue\nx-arango-errors: 1\n\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId1\r\n\r\nHTTP/1.1 200 OK\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 43\r\n\r\n{\"server\":\"arango\",\"version\":\"2.1.0-devel\"}\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: myId2\r\n\r\nHTTP/1.1 404 Not Found\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 88\r\n\r\n{\"error\":true,\"code\":404,\"errorNum\":1203,\"errorMessage\":\"unknown collection 'products'\"}\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: someId\r\n\r\nHTTP/1.1 200 OK\r\nlocation: /_db/_system/_api/collection/products\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 137\r\n\r\n{\"id\":\"293945767\",\"name\":\"products\",\"waitForSync\":false,\"isVolatile\":false,\"isSystem\":false,\"status\":3,\"type\":2,\"error\":false,\"code\":200}\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: nextId\r\n\r\nHTTP/1.1 200 OK\r\nlocation: /_db/_system/_api/collection/products/figures\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 570\r\n\r\n{\"id\":\"293945767\",\"name\":\"products\",\"isSystem\":false,\"doCompact\":true,\"isVolatile\":false,\"journalSize\":1048576,\"keyOptions\":{\"type\":\"traditional\",\"allowUserKeys\":true},\"waitForSync\":false,\"count\":0,\"figures\":{\"alive\":{\"count\":0,\"size\":0},\"dead\":{\"count\":0,\"size\":0,\"deletion\":0},\"datafiles\":{\"count\":0,\"fileSize\":0},\"journals\":{\"count\":0,\"fileSize\":0},\"compactors\":{\"count\":0,\"fileSize\":0},\"shapefiles\":{\"count\":0,\"fileSize\":0},\"shapes\":{\"count\":0,\"size\":0},\"attributes\":{\"count\":0,\"size\":0},\"indexes\":{\"count\":1,\"size\":88}},\"status\":3,\"type\":2,\"error\":false,\"code\":200}\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\nContent-Id: otherId\r\n\r\nHTTP/1.1 200 OK\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 43\r\n\r\n{\"id\":\"293945767\",\"error\":false,\"code\":200}\r\n--SomeBoundaryValue--\n\n</code></pre><br><br><br> Sending a batch request, setting the boundary implicitly (the server will in this case try to find the boundary at the beginning of the request body). <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/batch\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nDELETE /_api/collection/notexisting1 HTTP/1.1\r\n\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nDELETE /_api/collection/notexisting2 HTTP/1.1\r\n--SomeBoundaryValue--\r\n\n\nHTTP/1.1 200 OK\nx-arango-errors: 2\n\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nHTTP/1.1 404 Not Found\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 92\r\n\r\n{\"error\":true,\"code\":404,\"errorNum\":1203,\"errorMessage\":\"unknown collection 'notexisting1'\"}\r\n--SomeBoundaryValue\r\nContent-Type: application/x-arango-batchpart\r\n\r\nHTTP/1.1 404 Not Found\r\ncontent-type: application/json; charset=utf-8\r\ncontent-length: 92\r\n\r\n{\"error\":true,\"code\":404,\"errorNum\":1203,\"errorMessage\":\"unknown collection 'notexisting2'\"}\r\n--SomeBoundaryValue--\n\n</code></pre><br>",
"nickname": "executesABatchRequest"
}
],

File diff suppressed because one or more lines are too long

View File

@ -8,19 +8,19 @@
{
"errorResponses": [
{
"reason": "is returned if the result set can be created by the server. ",
"reason": "is returned if the result set can be created by the server. <br><br>",
"code": "201"
},
{
"reason": "is returned if the JSON representation is malformed or the query specification is missing from the request. ",
"reason": "is returned if the JSON representation is malformed or the query specification is missing from the request. <br><br>",
"code": "400"
},
{
"reason": "The server will respond with <em>HTTP 404</em> in case a non-existing collection is accessed in the query. ",
"reason": "The server will respond with <em>HTTP 404</em> in case a non-existing collection is accessed in the query. <br><br>",
"code": "404"
},
{
"reason": "The server will respond with <em>HTTP 405</em> if an unsupported HTTP method is used. ",
"reason": "The server will respond with <em>HTTP 405</em> if an unsupported HTTP method is used. <br><br>",
"code": "405"
}
],
@ -30,13 +30,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "A JSON object describing the query and query parameters. "
"description": "A JSON object describing the query and query parameters. <br><br>"
}
],
"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>- <em>options</em>: key/value list of extra options for the query (optional).<br><br>The following options are supported at the moment: <br><br>- <em>fullCount</em>: if set to <em>true</em> and the query contains a <em>LIMIT</em> clause, then the result will contain an extra attribute <em>extra</em> with a sub-attribute <em>fullCount</em>. This sub-attribute will contain the number of documents in the result before the last LIMIT in the query was applied. It can be used to count the number of documents that match certain filter criteria, but only return a subset of them, in one go. It is thus similar to MySQL's <em>SQL_CALC_FOUND_ROWS</em> hint. Note that setting the option will disable a few LIMIT optimisations and may lead to more documents being processed, and thus make queries run longer. Note that the <em>fullCount</em> sub-attribute will only be present in the result if the query has a LIMIT clause and the LIMIT clause is actually used in the query. <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 returned 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 for the cursor 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>- <em>extra</em>: an optional JSON object with extra information about the query result<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>",
"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> <ul class=\"swagger-list\"><li><em>query</em>: contains the query string to be executed (mandatory) <li><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. <li><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. <li><em>bindVars</em>: key/value list of bind parameters (optional). <li><em>options</em>: key/value list of extra options for the query (optional). </ul> The following options are supported at the moment: <br><br> <ul class=\"swagger-list\"><li><em>fullCount</em>: if set to <em>true</em> and the query contains a <em>LIMIT</em> clause, then the result will contain an extra attribute <em>extra</em> with a sub-attribute <em>fullCount</em>. This sub-attribute will contain the number of documents in the result before the last LIMIT in the query was applied. It can be used to count the number of documents that match certain filter criteria, but only return a subset of them, in one go. It is thus similar to MySQL's <em>SQL_CALC_FOUND_ROWS</em> hint. Note that setting the option will disable a few LIMIT optimisations and may lead to more documents being processed, and thus make queries run longer. Note that the <em>fullCount</em> sub-attribute will only be present in the result if the query has a LIMIT clause and the LIMIT clause is actually used in the query. </ul> 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 returned JSON object has the following properties: <br><br> <ul class=\"swagger-list\"><li><em>error</em>: boolean flag to indicate that an error occurred (<em>false</em> in this case) <li><em>code</em>: the HTTP status code <li><em>result</em>: an array of result documents (might be empty if query has no results) <li><em>hasMore</em>: a boolean indicator whether there are more results available for the cursor on the server <li><em>count</em>: the total number of result documents available (only available if the query was executed with the <em>count</em> attribute set) <li><em>id</em>: id of temporary cursor created on the server (optional, see above) <li><em>extra</em>: an optional JSON object with extra information about the query result </ul> 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> <ul class=\"swagger-list\"><li><em>error</em>: boolean flag to indicate that an error occurred (<em>true</em> in this case) <li><em>code</em>: the HTTP status code <li><em>errorNum</em>: the server error number <li><em>errorMessage</em>: a descriptive error message </ul> 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-binary @- --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/44328014\", \n \"_rev\" : \"44328014\", \n \"_key\" : \"44328014\", \n \"hello1\" : \"world1\" \n }, \n { \n \"_id\" : \"products/44655694\", \n \"_rev\" : \"44655694\", \n \"_key\" : \"44655694\", \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 extracts part of the result: <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --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/46163022\", \n \"_rev\" : \"46163022\", \n \"_key\" : \"46163022\", \n \"hello4\" : \"world1\" \n }, \n { \n \"_id\" : \"products/46490702\", \n \"_rev\" : \"46490702\", \n \"_key\" : \"46490702\", \n \"hello5\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"46687310\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Using a query option: <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR i IN 1..1000 FILTER i > 500 LIMIT 10 RETURN i\",\"count\":true,\"options\":{\"fullCount\":true}}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n 501, \n 502, \n 503, \n 504, \n 505, \n 506, \n 507, \n 508, \n 509, \n 510 \n ], \n \"hasMore\" : false, \n \"count\" : 10, \n \"extra\" : { \n \"fullCount\" : 500 \n }, \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-binary @- --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": "<br><br> Executes a query and extract the result in a single go: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/65749415\", \n \"_rev\" : \"65749415\", \n \"_key\" : \"65749415\", \n \"hello1\" : \"world1\" \n }, \n { \n \"_id\" : \"products/66077095\", \n \"_rev\" : \"66077095\", \n \"_key\" : \"66077095\", \n \"hello2\" : \"world1\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br><br><br> Executes a query and extracts part of the result: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/66929063\", \n \"_rev\" : \"66929063\", \n \"_key\" : \"66929063\", \n \"hello2\" : \"world1\" \n }, \n { \n \"_id\" : \"products/67584423\", \n \"_rev\" : \"67584423\", \n \"_key\" : \"67584423\", \n \"hello4\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"68108711\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br><br><br> Using a query option: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/cursor\n{\"query\":\"FOR i IN 1..1000 FILTER i > 500 LIMIT 10 RETURN i\",\"count\":true,\"options\":{\"fullCount\":true}}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n 501, \n 502, \n 503, \n 504, \n 505, \n 506, \n 507, \n 508, \n 509, \n 510 \n ], \n \"hasMore\" : false, \n \"count\" : 10, \n \"extra\" : { \n \"fullCount\" : 500 \n }, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br><br><br> Bad queries: <br><br> Missing body: <br><br><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><br><br> Unknown collection: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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"
}
],
@ -47,15 +47,15 @@
{
"errorResponses": [
{
"reason": "The server will respond with <em>HTTP 200</em> in case of success. ",
"reason": "The server will respond with <em>HTTP 200</em> in case of success. <br><br>",
"code": "200"
},
{
"reason": "If the cursor identifier is ommitted, the server will respond with <em>HTTP 404</em>. ",
"reason": "If the cursor identifier is ommitted, the server will respond with <em>HTTP 404</em>. <br><br>",
"code": "400"
},
{
"reason": "If no cursor with the specified identifier can be found, the server will respond with <em>HTTP 404</em>. ",
"reason": "If no cursor with the specified identifier can be found, the server will respond with <em>HTTP 404</em>. <br><br>",
"code": "404"
}
],
@ -65,13 +65,13 @@
"paramType": "path",
"required": "true",
"name": "cursor-identifier",
"description": "The name of the cursor "
"description": "The name of the cursor <br><br>"
}
],
"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>",
"notes": "<br><br> If the cursor is still alive, returns an object with the following attributes. <br><br> <ul class=\"swagger-list\"><li><em>id</em>: the <em>cursor-identifier</em> <li><em>result</em>: a list of documents for the current batch <li><em>hasMore</em>: <em>false</em> if this was the last batch <li><em>count</em>: if present the total number of elements </ul> 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-binary @- --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/48653390\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/47801422\", \n \"_rev\" : \"47801422\", \n \"_key\" : \"47801422\", \n \"hello3\" : \"world1\" \n }, \n { \n \"_id\" : \"products/48456782\", \n \"_rev\" : \"48456782\", \n \"_key\" : \"48456782\", \n \"hello5\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"48653390\", \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 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 1600, \n \"errorMessage\" : \"cursor not found\" \n}\n\n</code></pre><br>",
"examples": "<br><br> Valid request for next batch: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/70074791\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/69222823\", \n \"_rev\" : \"69222823\", \n \"_key\" : \"69222823\", \n \"hello3\" : \"world1\" \n }, \n { \n \"_id\" : \"products/68567463\", \n \"_rev\" : \"68567463\", \n \"_key\" : \"68567463\", \n \"hello1\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"70074791\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br><br><br> Missing identifier <br><br><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><br><br> Unknown identifier <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --dump - http://localhost:8529/_api/cursor/123123\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 1600, \n \"errorMessage\" : \"cursor not found\" \n}\n\n</code></pre><br>",
"nickname": "readsNextBatchFromACursor"
}
],
@ -82,11 +82,11 @@
{
"errorResponses": [
{
"reason": "is returned if the server is aware of the cursor. ",
"reason": "is returned if the server is aware of the cursor. <br><br>",
"code": "202"
},
{
"reason": "is returned if the server is not aware of the cursor. It is also returned if a cursor is used after it has been destroyed. ",
"reason": "is returned if the server is not aware of the cursor. It is also returned if a cursor is used after it has been destroyed. <br><br>",
"code": "404"
}
],
@ -96,13 +96,13 @@
"paramType": "path",
"required": "true",
"name": "cursor-identifier",
"description": "The name of the cursor "
"description": "The name of the cursor <br><br>"
}
],
"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>",
"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-binary @- --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/49701966\", \n \"_rev\" : \"49701966\", \n \"_key\" : \"49701966\", \n \"hello3\" : \"world1\" \n }, \n { \n \"_id\" : \"products/49374286\", \n \"_rev\" : \"49374286\", \n \"_key\" : \"49374286\", \n \"hello2\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"50553934\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\nunix> curl -X DELETE --dump - http://localhost:8529/_api/cursor/50553934\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/70795687\", \n \"_rev\" : \"70795687\", \n \"_key\" : \"70795687\", \n \"hello2\" : \"world1\" \n }, \n { \n \"_id\" : \"products/71123367\", \n \"_rev\" : \"71123367\", \n \"_key\" : \"71123367\", \n \"hello3\" : \"world1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"71975335\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\nunix> curl -X DELETE --dump - http://localhost:8529/_api/cursor/71975335\n\n</code></pre><br>",
"nickname": "deletesACursor"
}
],

View File

@ -8,23 +8,23 @@
{
"errorResponses": [
{
"reason": "is returned if the list of database was compiled successfully. ",
"reason": "is returned if the list of database was compiled successfully. <br><br>",
"code": "200"
},
{
"reason": "is returned if the request is invalid. ",
"reason": "is returned if the request is invalid. <br><br>",
"code": "400"
},
{
"reason": "is returned if the request was not executed in the <em>_system</em> database. ",
"reason": "is returned if the request was not executed in the <em>_system</em> database. <br><br>",
"code": "403"
}
],
"parameters": [],
"notes": "Retrieves the list of all existing databases <br><br>Note: retrieving the list of databases is only possible from within the <em>_system</em> database. <br><br>",
"notes": "Retrieves the list of all existing databases <br><br> Note: retrieving the list of databases is only possible from within the <em>_system</em> database. <br><br>",
"summary": "retrieves a list of all existing databases",
"httpMethod": "GET",
"examples": "<br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/database\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n \"_system\" \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl --dump - http://localhost:8529/_api/database\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n \"_system\" \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "retrievesAListOfAllExistingDatabases"
}
],
@ -35,11 +35,11 @@
{
"errorResponses": [
{
"reason": "is returned if the list of database was compiled successfully. ",
"reason": "is returned if the list of database was compiled successfully. <br><br>",
"code": "200"
},
{
"reason": "is returned if the request is invalid. ",
"reason": "is returned if the request is invalid. <br><br>",
"code": "400"
}
],
@ -47,7 +47,7 @@
"notes": "Retrieves the list of all databases the current user can access without specifying a different username or password. <br><br>",
"summary": "retrieves a list of all databases the current user can access",
"httpMethod": "GET",
"examples": "<br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/database/user\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n \"_system\" \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl --dump - http://localhost:8529/_api/database/user\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n \"_system\" \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "retrievesAListOfAllDatabasesTheCurrentUserCanAccess"
}
],
@ -58,23 +58,23 @@
{
"errorResponses": [
{
"reason": "is returned if the information was retrieved successfully. ",
"reason": "is returned if the information was retrieved successfully. <br><br>",
"code": "200"
},
{
"reason": "is returned if the request is invalid. ",
"reason": "is returned if the request is invalid. <br><br>",
"code": "400"
},
{
"reason": "is returned if the database could not be found. ",
"reason": "is returned if the database could not be found. <br><br>",
"code": "404"
}
],
"parameters": [],
"notes": "Retrieves information about the current database <br><br>The response is a JSON object with the following attributes: <br><br>- <em>name</em>: the name of the current database<br><br>- <em>id</em>: the id of the current database<br><br>- <em>path</em>: the filesystem path of the current database<br><br>- <em>isSystem</em>: whether or not the current database is the <em>_system</em> database<br><br>",
"notes": "Retrieves information about the current database <br><br> The response is a JSON object with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>name</em>: the name of the current database <li><em>id</em>: the id of the current database <li><em>path</em>: the filesystem path of the current database <li><em>isSystem</em>: whether or not the current database is the <em>_system</em> database",
"summary": "retrieves information about the current database",
"httpMethod": "GET",
"examples": "<br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/database/current\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"name\" : \"_system\", \n \"id\" : \"91214\", \n \"path\" : \"/tmp/vocdir.27152/databases/database-91214\", \n \"isSystem\" : true \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl --dump - http://localhost:8529/_api/database/current\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"name\" : \"_system\", \n \"id\" : \"82343\", \n \"path\" : \"/tmp/vocdir.75134/databases/database-82343\", \n \"isSystem\" : true \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "retrievesInformationAboutTheCurrentDatabase"
}
],
@ -85,19 +85,19 @@
{
"errorResponses": [
{
"reason": "is returned if the database was created successfully. ",
"reason": "is returned if the database was created successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the request parameters are invalid or if a database with the specified name already exists. ",
"reason": "is returned if the request parameters are invalid or if a database with the specified name already exists. <br><br>",
"code": "400"
},
{
"reason": "is returned if the request was not executed in the <em>_system</em> database. ",
"reason": "is returned if the request was not executed in the <em>_system</em> database. <br><br>",
"code": "403"
},
{
"reason": "is returned if a database with the specified name already exists. ",
"reason": "is returned if a database with the specified name already exists. <br><br>",
"code": "409"
}
],
@ -107,13 +107,13 @@
"paramType": "body",
"required": "true",
"name": "body",
"description": "the body with the name of the database. "
"description": "the body with the name of the database. <br><br>"
}
],
"notes": "Creates a new database <br><br>The request body must be a JSON object with the attribute <em>name</em>. <em>name</em> must contain a valid the manual \"database name\". <br><br>The request body can optionally contain an attribute <em>users</em>, which then must be a list of user objects to initially create for the new database. Each user object can contain the following attributes: <br><br>- <em>username</em>: the user name as a string. This attribute is mandatory.<br><br>- <em>passwd</em>: the user password as a string. If not specified, then it defaults to the empty string. <br><br>- <em>active</em>: a boolean flag indicating whether the user accout should be actived or not. The default value is <em>true</em>. <br><br>- <em>extra</em>: an optional JSON object with extra user information. The data contained in <em>extra</em> will be stored for the user but not be interpreted further by ArangoDB. <br><br>If <em>users</em> is not specified or does not contain any users, a default user <em>root</em> will be created with an empty string password. This ensures that the new database will be accessible after it is created. <br><br>The response is a JSON object with the attribute <em>result</em> set to <em>true</em>. <br><br>Note: creating a new database is only possible from within the <em>_system</em> database. <br><br>",
"notes": "Creates a new database <br><br> The request body must be a JSON object with the attribute <em>name</em>. <em>name</em> must contain a valid the manual \"database name\". <br><br> The request body can optionally contain an attribute <em>users</em>, which then must be a list of user objects to initially create for the new database. Each user object can contain the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>username</em>: the user name as a string. This attribute is mandatory. <li><em>passwd</em>: the user password as a string. If not specified, then it defaults to the empty string. <li><em>active</em>: a boolean flag indicating whether the user accout should be actived or not. The default value is <em>true</em>. <li><em>extra</em>: an optional JSON object with extra user information. The data contained in <em>extra</em> will be stored for the user but not be interpreted further by ArangoDB. </ul> If <em>users</em> is not specified or does not contain any users, a default user <em>root</em> will be created with an empty string password. This ensures that the new database will be accessible after it is created. <br><br> The response is a JSON object with the attribute <em>result</em> set to <em>true</em>. <br><br> Note: creating a new database is only possible from within the <em>_system</em> database. <br><br>",
"summary": "creates a new database",
"httpMethod": "POST",
"examples": "Creating a database named <em>example</em>. <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/database\n{\"name\":\"example\"}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Creating a database named <em>mydb</em> with two users. <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/database\n{\"name\":\"mydb\",\"users\":[{\"username\":\"admin\",\"passwd\":\"secret\",\"active\":true},{\"username\":\"tester\",\"passwd\":\"test001\",\"active\":false}]}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
"examples": "<br><br> Creating a database named <em>example</em>. <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/database\n{\"name\":\"example\"}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br><br><br> Creating a database named <em>mydb</em> with two users. <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/database\n{\"name\":\"mydb\",\"users\":[{\"username\":\"admin\",\"passwd\":\"secret\",\"active\":true},{\"username\":\"tester\",\"passwd\":\"test001\",\"active\":false}]}\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
"nickname": "createsANewDatabase"
}
],
@ -124,19 +124,19 @@
{
"errorResponses": [
{
"reason": "is returned if the database was dropped successfully. ",
"reason": "is returned if the database was dropped successfully. <br><br>",
"code": "200"
},
{
"reason": "is returned if the request is malformed. ",
"reason": "is returned if the request is malformed. <br><br>",
"code": "400"
},
{
"reason": "is returned if the request was not executed in the <em>_system</em> database. ",
"reason": "is returned if the request was not executed in the <em>_system</em> database. <br><br>",
"code": "403"
},
{
"reason": "is returned if the database could not be found. ",
"reason": "is returned if the database could not be found. <br><br>",
"code": "404"
}
],
@ -146,13 +146,13 @@
"paramType": "path",
"required": "true",
"name": "database-name",
"description": "The name of the database "
"description": "The name of the database <br><br>"
}
],
"notes": "Deletes the database along with all data stored in it. <br><br>Note: dropping a database is only possible from within the <em>_system</em> database. The <em>_system</em> database itself cannot be dropped. <br><br>",
"notes": "Deletes the database along with all data stored in it. <br><br> Note: dropping a database is only possible from within the <em>_system</em> database. The <em>_system</em> database itself cannot be dropped. <br><br>",
"summary": "drops an existing database",
"httpMethod": "DELETE",
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/database/example\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl -X DELETE --dump - http://localhost:8529/_api/database/example\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "dropsAnExistingDatabase"
}
],

View File

@ -8,19 +8,19 @@
{
"errorResponses": [
{
"reason": "is returned if the document was created successfully and <em>waitForSync</em> was <em>true</em>. ",
"reason": "is returned if the document was created successfully and <em>waitForSync</em> was <em>true</em>. <br><br>",
"code": "201"
},
{
"reason": "is returned if the document was created successfully and <em>waitForSync</em> was <em>false</em>. ",
"reason": "is returned if the document was created successfully and <em>waitForSync</em> was <em>false</em>. <br><br>",
"code": "202"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a document. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a document. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -30,32 +30,34 @@
"paramType": "body",
"required": "true",
"name": "document",
"description": "A JSON representation of the document. "
"description": "A JSON representation of the document. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection",
"description": "The collection name. "
"description": "The collection name. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "createCollection",
"description": "If this parameter has a value of <em>true</em> or <em>yes</em>, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed. "
"description": "If this parameter has a value of <em>true</em> or <em>yes</em>, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed. <br><br> Note: this flag is not supported in a cluster. Using it will result in an error. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "waitForSync",
"description": "Wait until document has been synced to disk. "
"description": "Wait until document has been synced to disk. <br><br>"
}
],
"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>",
"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> <ul class=\"swagger-list\"><li><em>_id</em> contains the document handle of the newly created document <li><em>_key</em> contains the document key <li><em>_rev</em> contains the document revision </ul> 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-binary @- --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: \"294609998\"\nlocation: /_db/_system/_api/document/products/294609998\n\n{ \n \"error\" : false, \n \"_id\" : \"products/294609998\", \n \"_rev\" : \"294609998\", \n \"_key\" : \"294609998\" \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-binary @- --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: \"295068750\"\nlocation: /_db/_system/_api/document/products/295068750\n\n{ \n \"error\" : false, \n \"_id\" : \"products/295068750\", \n \"_rev\" : \"295068750\", \n \"_key\" : \"295068750\" \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-binary @- --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: \"295527502\"\nlocation: /_db/_system/_api/document/products/295527502\n\n{ \n \"error\" : false, \n \"_id\" : \"products/295527502\", \n \"_rev\" : \"295527502\", \n \"_key\" : \"295527502\" \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-binary @- --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: \"295986254\"\nlocation: /_db/_system/_api/document/products/295986254\n\n{ \n \"error\" : false, \n \"_id\" : \"products/295986254\", \n \"_rev\" : \"295986254\", \n \"_key\" : \"295986254\" \n}\n\n</code></pre><br>Unknown collection name: <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --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 '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-binary @- --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": "<br><br> 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><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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: \"294470055\"\nlocation: /_db/_system/_api/document/products/294470055\n\n{ \n \"error\" : false, \n \"_id\" : \"products/294470055\", \n \"_rev\" : \"294470055\", \n \"_key\" : \"294470055\" \n}\n\n</code></pre><br><br><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><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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: \"294928807\"\nlocation: /_db/_system/_api/document/products/294928807\n\n{ \n \"error\" : false, \n \"_id\" : \"products/294928807\", \n \"_rev\" : \"294928807\", \n \"_key\" : \"294928807\" \n}\n\n</code></pre><br><br><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><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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: \"295387559\"\nlocation: /_db/_system/_api/document/products/295387559\n\n{ \n \"error\" : false, \n \"_id\" : \"products/295387559\", \n \"_rev\" : \"295387559\", \n \"_key\" : \"295387559\" \n}\n\n</code></pre><br><br><br> Create a document in a new, named collection <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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: \"295846311\"\nlocation: /_db/_system/_api/document/products/295846311\n\n{ \n \"error\" : false, \n \"_id\" : \"products/295846311\", \n \"_rev\" : \"295846311\", \n \"_key\" : \"295846311\" \n}\n\n</code></pre><br><br><br> Unknown collection name: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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 'products' not found\", \n \"code\" : 404, \n \"errorNum\" : 1203 \n}\n\n</code></pre><br><br><br> Illegal document: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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"
}
],
@ -66,19 +68,19 @@
{
"errorResponses": [
{
"reason": "is returned if the document was found ",
"reason": "is returned if the document was found <br><br>",
"code": "200"
},
{
"reason": "is returned if the \"If-None-Match\" header is given and the document has the same version ",
"reason": "is returned if the \"If-None-Match\" header is given and the document has the same version <br><br>",
"code": "304"
},
{
"reason": "is returned if the document or collection was not found ",
"reason": "is returned if the document or collection was not found <br><br>",
"code": "404"
},
{
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned. ",
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned. <br><br>",
"code": "412"
}
],
@ -88,25 +90,25 @@
"paramType": "path",
"required": "true",
"name": "document-handle",
"description": "The handle of the document. "
"description": "The handle of the document. <br><br>"
},
{
"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 an <em>HTTP 304</em> is returned. "
"description": "If the \"If-None-Match\" header is given, then it must contain exactly one etag. The document is returned, if it has a different revision than the given etag. Otherwise an <em>HTTP 304</em> is returned. <br><br>"
},
{
"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 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. <br><br>"
}
],
"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/296445006\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"296445006\"\n\n{ \n \"hello\" : \"world\", \n \"_id\" : \"products/296445006\", \n \"_rev\" : \"296445006\", \n \"_key\" : \"296445006\" \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: \"296969294\"' --dump - http://localhost:8529/_api/document/products/296969294\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": "<br><br> Use a document handle: <br><br><br><br><pre><code class=\"json\">unix> curl --dump - http://localhost:8529/_api/document/products/296305063\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"296305063\"\n\n{ \n \"hello\" : \"world\", \n \"_id\" : \"products/296305063\", \n \"_rev\" : \"296305063\", \n \"_key\" : \"296305063\" \n}\n\n</code></pre><br><br><br> Use a document handle and an etag: <br><br><br><br><pre><code class=\"json\">unix> curl --header 'If-None-Match: \"296829351\"' --dump - http://localhost:8529/_api/document/products/296829351\n\n</code></pre><br><br><br> Unknown document handle: <br><br><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"
}
],
@ -117,11 +119,11 @@
{
"errorResponses": [
{
"reason": "All went good. ",
"reason": "All went good. <br><br>",
"code": "200"
},
{
"reason": "The collection does not exist. ",
"reason": "The collection does not exist. <br><br>",
"code": "404"
}
],
@ -129,15 +131,15 @@
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection",
"description": "The name of the collection. "
"description": "The name of the collection. <br><br>"
}
],
"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 all ids. <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/297559118\", \n \"/_api/document/products/297886798\", \n \"/_api/document/products/298214478\" \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 'doesnotexist' not found\", \n \"code\" : 404, \n \"errorNum\" : 1203 \n}\n\n</code></pre><br>",
"examples": "<br><br> Returns a all ids. <br><br><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/298074535\", \n \"/_api/document/products/297419175\", \n \"/_api/document/products/297746855\" \n ] \n}\n\n</code></pre><br><br><br> Collection does not exist. <br><br><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 'doesnotexist' not found\", \n \"code\" : 404, \n \"errorNum\" : 1203 \n}\n\n</code></pre><br><br><br>",
"nickname": "readsAllDocumentsFromCollection"
}
],
@ -148,19 +150,19 @@
{
"errorResponses": [
{
"reason": "is returned if the document was found ",
"reason": "is returned if the document was found <br><br>",
"code": "200"
},
{
"reason": "is returned if the \"If-None-Match\" header is given and the document has same version ",
"reason": "is returned if the \"If-None-Match\" header is given and the document has same version <br><br>",
"code": "304"
},
{
"reason": "is returned if the document or collection was not found ",
"reason": "is returned if the document or collection was not found <br><br>",
"code": "404"
},
{
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>etag</em> header. ",
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>etag</em> header. <br><br>",
"code": "412"
}
],
@ -170,31 +172,32 @@
"paramType": "path",
"required": "true",
"name": "document-handle",
"description": "The handle of the document. "
"description": "The handle of the document. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "rev",
"description": "You can conditionally fetch a document based on a target revision id by using the <em>rev</em> URL parameter. "
"description": "You can conditionally fetch a document based on a target revision id by using the <em>rev</em> URL parameter. <br><br>"
},
{
"dataType": "String",
"paramType": "header",
"name": "If-None-Match",
"description": "If the \"If-None-Match\" header is given, then it must contain exactly one etag. If the current document revision is different to the specified etag, an <em>HTTP 200</em> response is returned. If the current document revision is identical to the specified etag, then an <em>HTTP 304</em> is returned. "
"description": "If the \"If-None-Match\" header is given, then it must contain exactly one etag. If the current document revision is different to the specified etag, an <em>HTTP 200</em> response is returned. If the current document revision is identical to the specified etag, then an <em>HTTP 304</em> is returned. <br><br>"
},
{
"dataType": "String",
"paramType": "header",
"name": "If-Match",
"description": "You can conditionally fetch a document based on a target revision id by using the <em>if-match</em> HTTP header. "
"description": "You can conditionally fetch a document based on a target revision id by using the <em>if-match</em> HTTP header. <br><br>"
}
],
"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/298738766\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl -X HEAD --dump - http://localhost:8529/_api/document/products/298598823\n\n</code></pre><br>",
"nickname": "readsADocumentHeader"
}
],
@ -205,23 +208,23 @@
{
"errorResponses": [
{
"reason": "is returned if the document was replaced successfully and <em>waitForSync</em> was <em>true</em>. ",
"reason": "is returned if the document was replaced successfully and <em>waitForSync</em> was <em>true</em>. <br><br>",
"code": "201"
},
{
"reason": "is returned if the document was replaced successfully and <em>waitForSync</em> was <em>false</em>. ",
"reason": "is returned if the document was replaced successfully and <em>waitForSync</em> was <em>false</em>. <br><br>",
"code": "202"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a document. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a document. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection or the document was not found ",
"reason": "is returned if the collection or the document was not found <br><br>",
"code": "404"
},
{
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned. ",
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned. <br><br>",
"code": "412"
}
],
@ -231,44 +234,47 @@
"paramType": "body",
"required": "true",
"name": "document",
"description": "A JSON representation of the new document. "
"description": "A JSON representation of the new document. <br><br>"
},
{
"dataType": "String",
"paramType": "path",
"required": "true",
"name": "document-handle",
"description": "The handle of the document. "
"description": "The handle of the document. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "waitForSync",
"description": "Wait until document has been synced to disk. "
"description": "Wait until document has been synced to disk. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "rev",
"description": "You can conditionally replace a document based on a target revision id by using the <em>rev</em> URL parameter. "
"description": "You can conditionally replace a document based on a target revision id by using the <em>rev</em> URL parameter. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "policy",
"description": "To control the update behavior in case there is a revision mismatch, you can use the <em>policy</em> parameter (see below). "
"description": "To control the update behavior in case there is a revision mismatch, you can use the <em>policy</em> parameter (see below). <br><br>"
},
{
"dataType": "String",
"paramType": "header",
"name": "If-Match",
"description": "You can conditionally replace a document based on a target revision id by using the <em>if-match</em> HTTP header. "
"description": "You can conditionally replace a document based on a target revision id by using the <em>if-match</em> HTTP header. <br><br>"
}
],
"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 can use 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>",
"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): <ul class=\"swagger-list\"><li>specifying the target revision in the <em>rev</em> URL query parameter <li>specifying the target revision in the <em>if-match</em> HTTP header </ul> 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 can use the following request: <br><br> <ul class=\"swagger-list\"><li>PUT /_api/document/<em>document-handle</em>?rev=<em>etag</em> </ul> 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> <ul class=\"swagger-list\"><li>PUT /_api/document/<em>document-handle</em>?policy=<em>policy</em> </ul> 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-binary @- --dump - http://localhost:8529/_api/document/products/299263054\n{\"Hello\": \"you\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"299590734\"\nlocation: /_db/_system/_api/document/products/299263054\n\n{ \n \"error\" : false, \n \"_id\" : \"products/299263054\", \n \"_rev\" : \"299590734\", \n \"_key\" : \"299263054\" \n}\n\n</code></pre><br>Unknown document handle: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/document/products/300049486\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/300049486 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: \"301163598\"' --data-binary @- --dump - http://localhost:8529/_api/document/products/300835918\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\netag: \"300835918\"\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/300835918\", \n \"_rev\" : \"300835918\", \n \"_key\" : \"300835918\" \n}\n\n</code></pre><br>Last write wins: <br><br><pre><code class=\"json\" >unix> curl -X PUT --header 'If-Match: \"302146638\"' --data-binary @- --dump - http://localhost:8529/_api/document/products/301818958?policy=last\n{}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"302408782\"\nlocation: /_db/_system/_api/document/products/301818958\n\n{ \n \"error\" : false, \n \"_id\" : \"products/301818958\", \n \"_rev\" : \"302408782\", \n \"_key\" : \"301818958\" \n}\n\n</code></pre><br>Alternative to header field: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/document/products/302867534?rev=303195214\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\netag: \"302867534\"\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/302867534\", \n \"_rev\" : \"302867534\", \n \"_key\" : \"302867534\" \n}\n\n</code></pre><br>",
"examples": "<br><br> Using document handle: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/document/products/299123111\n{\"Hello\": \"you\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"299450791\"\nlocation: /_db/_system/_api/document/products/299123111\n\n{ \n \"error\" : false, \n \"_id\" : \"products/299123111\", \n \"_rev\" : \"299450791\", \n \"_key\" : \"299123111\" \n}\n\n</code></pre><br><br><br> Unknown document handle: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/document/products/299909543\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/299909543 not found\", \n \"code\" : 404, \n \"errorNum\" : 1202 \n}\n\n</code></pre><br><br><br> Produce a revision conflict: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --header 'If-Match: \"301023655\"' --data-binary @- --dump - http://localhost:8529/_api/document/products/300695975\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\netag: \"300695975\"\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/300695975\", \n \"_rev\" : \"300695975\", \n \"_key\" : \"300695975\" \n}\n\n</code></pre><br><br><br> Last write wins: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --header 'If-Match: \"302006695\"' --data-binary @- --dump - http://localhost:8529/_api/document/products/301679015?policy=last\n{}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"302268839\"\nlocation: /_db/_system/_api/document/products/301679015\n\n{ \n \"error\" : false, \n \"_id\" : \"products/301679015\", \n \"_rev\" : \"302268839\", \n \"_key\" : \"301679015\" \n}\n\n</code></pre><br><br><br> Alternative to header field: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/document/products/302727591?rev=303055271\n{\"other\":\"content\"}\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\netag: \"302727591\"\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/302727591\", \n \"_rev\" : \"302727591\", \n \"_key\" : \"302727591\" \n}\n\n</code></pre><br>",
"nickname": "replacesADocument"
}
],
@ -279,23 +285,23 @@
{
"errorResponses": [
{
"reason": "is returned if the document was created successfully and <em>waitForSync</em> was <em>true</em>. ",
"reason": "is returned if the document was created successfully and <em>waitForSync</em> was <em>true</em>. <br><br>",
"code": "201"
},
{
"reason": "is returned if the document was created successfully and <em>waitForSync</em> was <em>false</em>. ",
"reason": "is returned if the document was created successfully and <em>waitForSync</em> was <em>false</em>. <br><br>",
"code": "202"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a document. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a document. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection or the document was not found ",
"reason": "is returned if the collection or the document was not found <br><br>",
"code": "404"
},
{
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned. ",
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned. <br><br>",
"code": "412"
}
],
@ -305,50 +311,54 @@
"paramType": "body",
"required": "true",
"name": "document",
"description": "A JSON representation of the document update. "
"description": "A JSON representation of the document update. <br><br>"
},
{
"dataType": "String",
"paramType": "path",
"required": "true",
"name": "document-handle",
"description": "The handle of the document. "
"description": "The handle of the document. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "keepNull",
"description": "If the intention is to delete existing attributes with the patch command, the URL query 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>. "
"description": "If the intention is to delete existing attributes with the patch command, the URL query 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>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "waitForSync",
"description": "Wait until document has been synced to disk. "
"description": "Wait until document has been synced to disk. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "rev",
"description": "You can conditionally patch a document based on a target revision id by using the <em>rev</em> URL parameter. "
"description": "You can conditionally patch a document based on a target revision id by using the <em>rev</em> URL parameter. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "policy",
"description": "To control the update behavior in case there is a revision mismatch, you can use the <em>policy</em> parameter. "
"description": "To control the update behavior in case there is a revision mismatch, you can use the <em>policy</em> parameter. <br><br>"
},
{
"dataType": "String",
"paramType": "header",
"name": "If-Match",
"description": "You can conditionally patch a document based on a target revision id by using the <em>if-match</em> HTTP header. "
"description": "You can conditionally patch a document based on a target revision id by using the <em>if-match</em> HTTP header. <br><br>"
}
],
"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>",
"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-binary @- --dump - http://localhost:8529/_api/document/products/303850574\n{\"hello\":\"world\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"304178254\"\nlocation: /_db/_system/_api/document/products/303850574\n\n{ \n \"error\" : false, \n \"_id\" : \"products/303850574\", \n \"_rev\" : \"304178254\", \n \"_key\" : \"303850574\" \n}\n\nunix> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/document/products/303850574\n{\"numbers\":{\"one\":1,\"two\":2,\"three\":3,\"empty\":null}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"304768078\"\nlocation: /_db/_system/_api/document/products/303850574\n\n{ \n \"error\" : false, \n \"_id\" : \"products/303850574\", \n \"_rev\" : \"304768078\", \n \"_key\" : \"303850574\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/303850574\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"304768078\"\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/303850574\", \n \"_rev\" : \"304768078\", \n \"_key\" : \"303850574\" \n}\n\nunix> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/document/products/303850574?keepNull=false\n{\"hello\":null,\"numbers\":{\"four\":4}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"305226830\"\nlocation: /_db/_system/_api/document/products/303850574\n\n{ \n \"error\" : false, \n \"_id\" : \"products/303850574\", \n \"_rev\" : \"305226830\", \n \"_key\" : \"303850574\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/303850574\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"305226830\"\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/303850574\", \n \"_rev\" : \"305226830\", \n \"_key\" : \"303850574\" \n}\n\n</code></pre><br>",
"examples": "<br><br> patches an existing document with new content. <br><br><br><br><pre><code class=\"json\">unix> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/document/products/303710631\n{\"hello\":\"world\"}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"304038311\"\nlocation: /_db/_system/_api/document/products/303710631\n\n{ \n \"error\" : false, \n \"_id\" : \"products/303710631\", \n \"_rev\" : \"304038311\", \n \"_key\" : \"303710631\" \n}\n\nunix> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/document/products/303710631\n{\"numbers\":{\"one\":1,\"two\":2,\"three\":3,\"empty\":null}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"304628135\"\nlocation: /_db/_system/_api/document/products/303710631\n\n{ \n \"error\" : false, \n \"_id\" : \"products/303710631\", \n \"_rev\" : \"304628135\", \n \"_key\" : \"303710631\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/303710631\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"304628135\"\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/303710631\", \n \"_rev\" : \"304628135\", \n \"_key\" : \"303710631\" \n}\n\nunix> curl -X PATCH --data-binary @- --dump - http://localhost:8529/_api/document/products/303710631?keepNull=false\n{\"hello\":null,\"numbers\":{\"four\":4}}\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"305086887\"\nlocation: /_db/_system/_api/document/products/303710631\n\n{ \n \"error\" : false, \n \"_id\" : \"products/303710631\", \n \"_rev\" : \"305086887\", \n \"_key\" : \"303710631\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/document/products/303710631\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"305086887\"\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/303710631\", \n \"_rev\" : \"305086887\", \n \"_key\" : \"303710631\" \n}\n\n</code></pre><br>",
"nickname": "patchesADocument"
}
],
@ -359,19 +369,19 @@
{
"errorResponses": [
{
"reason": "is returned if the document was deleted successfully and <em>waitForSync</em> was <em>true</em>. ",
"reason": "is returned if the document was deleted successfully and <em>waitForSync</em> was <em>true</em>. <br><br>",
"code": "200"
},
{
"reason": "is returned if the document was deleted successfully and <em>waitForSync</em> was <em>false</em>. ",
"reason": "is returned if the document was deleted successfully and <em>waitForSync</em> was <em>false</em>. <br><br>",
"code": "202"
},
{
"reason": "is returned if the collection or the document was not found. The response body contains an error document in this case. ",
"reason": "is returned if the collection or the document was not found. The response body contains an error document in this case. <br><br>",
"code": "404"
},
{
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned. ",
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned. <br><br>",
"code": "412"
}
],
@ -381,37 +391,40 @@
"paramType": "path",
"required": "true",
"name": "document-handle",
"description": "Deletes the document identified by <em>document-handle</em>. "
"description": "Deletes the document identified by <em>document-handle</em>. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "rev",
"description": "You can conditionally delete a document based on a target revision id by using the <em>rev</em> URL parameter. "
"description": "You can conditionally delete a document based on a target revision id by using the <em>rev</em> URL parameter. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "policy",
"description": "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 more details). "
"description": "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 more details). <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "waitForSync",
"description": "Wait until document has been synced to disk. "
"description": "Wait until document has been synced to disk. <br><br>"
},
{
"dataType": "String",
"paramType": "header",
"name": "If-Match",
"description": "You can conditionally delete a document based on a target revision id by using the <em>if-match</em> HTTP header. "
"description": "You can conditionally delete a document based on a target revision id by using the <em>if-match</em> HTTP header. <br><br>"
}
],
"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 deleted document, the attribute <em>_rev</em> contains the 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>",
"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 deleted document, the attribute <em>_rev</em> contains the 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/305751118\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"_id\" : \"products/305751118\", \n \"_rev\" : \"305751118\", \n \"_key\" : \"305751118\" \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/306406478\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/306406478 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: \"307520590\"' --dump - http://localhost:8529/_api/document/products/307192910\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\netag: \"307192910\"\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/307192910\", \n \"_rev\" : \"307192910\", \n \"_key\" : \"307192910\" \n}\n\n</code></pre><br>",
"examples": "<br><br> Using document handle: <br><br><br><br><pre><code class=\"json\">unix> curl -X DELETE --dump - http://localhost:8529/_api/document/products/305611175\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : false, \n \"_id\" : \"products/305611175\", \n \"_rev\" : \"305611175\", \n \"_key\" : \"305611175\" \n}\n\n</code></pre><br><br><br> Unknown document handle: <br><br><br><br><pre><code class=\"json\">unix> curl -X DELETE --dump - http://localhost:8529/_api/document/products/306266535\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/306266535 not found\", \n \"code\" : 404, \n \"errorNum\" : 1202 \n}\n\n</code></pre><br><br><br> Revision conflict: <br><br><br><br><pre><code class=\"json\">unix> curl -X DELETE --header 'If-Match: \"307380647\"' --dump - http://localhost:8529/_api/document/products/307052967\n\nHTTP/1.1 412 Precondition Failed\ncontent-type: application/json; charset=utf-8\netag: \"307052967\"\n\n{ \n \"error\" : true, \n \"code\" : 412, \n \"errorNum\" : 1200, \n \"errorMessage\" : \"precondition failed\", \n \"_id\" : \"products/307052967\", \n \"_rev\" : \"307052967\", \n \"_key\" : \"307052967\" \n}\n\n</code></pre><br>",
"nickname": "deletesADocument"
}
],

View File

@ -8,19 +8,19 @@
{
"errorResponses": [
{
"reason": "is returned if the edge was created successfully and <em>waitForSync</em> was <em>true</em>. ",
"reason": "is returned if the edge was created successfully and <em>waitForSync</em> was <em>true</em>. <br><br>",
"code": "201"
},
{
"reason": "is returned if the edge was created successfully. ",
"reason": "is returned if the edge was created successfully. <br><br>",
"code": "202"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of an edge, or if the collection specified is not an edge collection. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of an edge, or if the collection specified is not an edge collection. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -30,46 +30,48 @@
"paramType": "body",
"required": "true",
"name": "edge-document",
"description": "A JSON representation of the edge document must be passed as the body of the POST request. This JSON object may contain the edge's document key in the <em>_key</em> attribute if needed. "
"description": "A JSON representation of the edge document must be passed as the body of the POST request. This JSON object may contain the edge's document key in the <em>_key</em> attribute if needed. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection",
"description": "Creates a new edge in the collection identified by <em>collection</em> name. "
"description": "Creates a new edge in the collection identified by <em>collection</em> name. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "createCollection",
"description": "If this parameter has a value of <em>true</em> or <em>yes</em>, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed. "
"description": "If this parameter has a value of <em>true</em> or <em>yes</em>, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed. <br><br> Note: this flag is not supported in a cluster. Using it will result in an error. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "waitForSync",
"description": "Wait until the edge document has been synced to disk. "
"description": "Wait until the edge document has been synced to disk. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "from",
"description": "The document handle of the start point must be passed in <em>from</em> handle. "
"description": "The document handle of the start point must be passed in <em>from</em> handle. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "to",
"description": "The document handle of the end point must be passed in <em>to</em> handle. "
"description": "The document handle of the end point must be passed in <em>to</em> handle. <br><br>"
}
],
"notes": "Creates a new edge 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>The <em>from</em> and <em>to</em> handles 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>",
"notes": "Creates a new edge 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> The <em>from</em> and <em>to</em> handles 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 read it back: <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --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: \"310076494\"\nlocation: /_db/_system/_api/document/edges/310076494\n\n{ \n \"error\" : false, \n \"_id\" : \"edges/310076494\", \n \"_rev\" : \"310076494\", \n \"_key\" : \"310076494\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/edge/edges/310076494\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"310076494\"\n\n{ \n \"name\" : \"Emil\", \n \"_id\" : \"edges/310076494\", \n \"_rev\" : \"310076494\", \n \"_key\" : \"310076494\", \n \"_from\" : \"vertices/1\", \n \"_to\" : \"vertices/2\" \n}\n\n</code></pre><br>",
"examples": "<br><br> Create an edge and read it back: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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: \"309739943\"\nlocation: /_db/_system/_api/document/edges/309739943\n\n{ \n \"error\" : false, \n \"_id\" : \"edges/309739943\", \n \"_rev\" : \"309739943\", \n \"_key\" : \"309739943\" \n}\n\nunix> curl --dump - http://localhost:8529/_api/edge/edges/309739943\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"309739943\"\n\n{ \n \"name\" : \"Emil\", \n \"_id\" : \"edges/309739943\", \n \"_rev\" : \"309739943\", \n \"_key\" : \"309739943\", \n \"_from\" : \"vertices/1\", \n \"_to\" : \"vertices/2\" \n}\n\n</code></pre><br>",
"nickname": "createsAnEdge"
}
],
@ -80,16 +82,20 @@
{
"errorResponses": [
{
"reason": "is returned if the edge was found ",
"reason": "is returned if the edge was found <br><br>",
"code": "200"
},
{
"reason": "is returned if the \"If-None-Match\" header is given and the edge has the same version ",
"reason": "is returned if the \"If-None-Match\" header is given and the edge has the same version <br><br>",
"code": "304"
},
{
"reason": "is returned if the edge or collection was not found ",
"reason": "is returned if the edge or collection was not found <br><br>",
"code": "404"
},
{
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned.",
"code": "412"
}
],
"parameters": [
@ -98,22 +104,22 @@
"paramType": "path",
"required": "true",
"name": "document-handle",
"description": "The handle of the edge document. "
"description": "The handle of the edge document. <br><br>"
},
{
"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 edge is returned if it has a different revision than the given etag. Otherwise an <em>HTTP 304</em> is returned. "
"description": "If the \"If-None-Match\" header is given, then it must contain exactly one etag. The edge is returned if it has a different revision than the given etag. Otherwise an <em>HTTP 304</em> is returned. <br><br>"
},
{
"dataType": "String",
"paramType": "header",
"name": "If-Match",
"description": "If the \"If-Match\" header is given, then it must contain exactly one etag. The edge is returned if it has the same revision ad the given etag. Otherwise a <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 the \"If-Match\" header is given, then it must contain exactly one etag. The edge is returned if it has the same revision ad the given etag. Otherwise a <em>HTTP 412</em> is returned. As an alternative you can supply the etag in an attribute <em>rev</em> in the URL. <br><br>"
}
],
"notes": "Returns the edge identified by <em>document-handle</em>. The returned edge contains a few special attributes: <br><br>- <em>_id</em> contains the document handle<br><br>- <em>_rev</em> contains the revision<br><br>- <em>_from</em> and <em>to</em> contain the document handles of the connected vertex documents <br><br>",
"notes": "Returns the edge identified by <em>document-handle</em>. The returned edge contains a few special attributes: <br><br> <ul class=\"swagger-list\"><li><em>_id</em> contains the document handle <li><em>_rev</em> contains the revision <li><em>_from</em> and <em>to</em> contain the document handles of the connected vertex documents",
"summary": "reads an edge",
"httpMethod": "GET",
"examples": "",
@ -127,17 +133,21 @@
{
"errorResponses": [
{
"reason": "All went good. ",
"reason": "All went good. <br><br>",
"code": "200"
},
{
"reason": "The collection does not exist.",
"code": "404"
}
],
"parameters": [
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection",
"description": "The name of the collection. "
"description": "The name of the collection. <br><br>"
}
],
"notes": "Returns a list of all URI for all edges from the collection identified by <em>collection</em>. <br><br>",
@ -154,16 +164,20 @@
{
"errorResponses": [
{
"reason": "is returned if the edge document was found ",
"reason": "is returned if the edge document was found <br><br>",
"code": "200"
},
{
"reason": "is returned if the \"If-None-Match\" header is given and the edge document has same version ",
"reason": "is returned if the \"If-None-Match\" header is given and the edge document has same version <br><br>",
"code": "304"
},
{
"reason": "is returned if the edge document or collection was not found ",
"reason": "is returned if the edge document or collection was not found <br><br>",
"code": "404"
},
{
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>etag</em> header.",
"code": "412"
}
],
"parameters": [
@ -172,19 +186,20 @@
"paramType": "path",
"required": "true",
"name": "document-handle",
"description": "The handle of the edge document. "
"description": "The handle of the edge document. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "rev",
"description": "You can conditionally fetch an edge document based on a target revision id by using the <em>rev</em> URL parameter. "
"description": "You can conditionally fetch an edge document based on a target revision id by using the <em>rev</em> URL parameter. <br><br>"
},
{
"dataType": "String",
"paramType": "header",
"name": "If-Match",
"description": "You can conditionally fetch an edge document based on a target revision id by using the <em>if-match</em> HTTP header. "
"description": "You can conditionally fetch an edge document based on a target revision id by using the <em>if-match</em> HTTP header. <br><br>"
}
],
"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 an edge document or check if it was deleted. <br><br>",
@ -201,20 +216,24 @@
{
"errorResponses": [
{
"reason": "is returned if the edge document was replaced successfully and <em>waitForSync</em> was <em>true</em>. ",
"reason": "is returned if the edge document was replaced successfully and <em>waitForSync</em> was <em>true</em>. <br><br>",
"code": "201"
},
{
"reason": "is returned if the edge document was replaced successfully and <em>waitForSync</em> was <em>false</em>. ",
"reason": "is returned if the edge document was replaced successfully and <em>waitForSync</em> was <em>false</em>. <br><br>",
"code": "202"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of an edge document or if applied to a non-edge collection. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of an edge document or if applied to a non-edge collection. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection or the edge document was not found ",
"reason": "is returned if the collection or the edge document was not found <br><br>",
"code": "404"
},
{
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned.",
"code": "412"
}
],
"parameters": [
@ -223,41 +242,44 @@
"paramType": "body",
"required": "true",
"name": "edge",
"description": "A JSON representation of the new edge data. "
"description": "A JSON representation of the new edge data. <br><br>"
},
{
"dataType": "String",
"paramType": "path",
"required": "true",
"name": "document-handle",
"description": "The handle of the edge document. "
"description": "The handle of the edge document. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "waitForSync",
"description": "Wait until edge document has been synced to disk. "
"description": "Wait until edge document has been synced to disk. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "rev",
"description": "You can conditionally replace an edge document based on a target revision id by using the <em>rev</em> URL parameter. "
"description": "You can conditionally replace an edge document based on a target revision id by using the <em>rev</em> URL parameter. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "policy",
"description": "To control the update behavior in case there is a revision mismatch, you can use the <em>policy</em> parameter (see below). "
"description": "To control the update behavior in case there is a revision mismatch, you can use the <em>policy</em> parameter (see below). <br><br>"
},
{
"dataType": "String",
"paramType": "header",
"name": "If-Match",
"description": "You can conditionally replace an edge document based on a target revision id by using the <em>if-match</em> HTTP header. "
"description": "You can conditionally replace an edge document based on a target revision id by using the <em>if-match</em> HTTP header. <br><br>"
}
],
"notes": "Completely updates (i.e. replaces) the edge document identified by <em>document-handle</em>. If the edge 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 edge document. <br><br>If the new edge 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. Note that the attributes <em>_from</em> and <em>_to</em> of an edge are immutable and cannot be updated either. <br><br>Optionally, the URL parameter <em>waitForSync</em> can be used to force synchronisation of the edge 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 edge document, the attribute <em>_rev</em> contains the new revision of the edge document. <br><br>If the edge 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 revision id for conditional replacements (i.e. replacements that will only be executed if the revision id found in the database matches the revision id specified in the request): - specifying the target revision in the <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 revision id as returned in the <em>_rev</em> attribute of an edge document or by an HTTP <em>etag</em> header. <br><br>For example, to conditionally replace an edge document based on a specific revision id, you can use 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 edge document found in the database is equal to the target revision id provided in the request. If there is a mismatch between the revision id, then by default a <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>",
"notes": "Completely updates (i.e. replaces) the edge document identified by <em>document-handle</em>. If the edge 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 edge document. <br><br> If the new edge 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. Note that the attributes <em>_from</em> and <em>_to</em> of an edge are immutable and cannot be updated either. <br><br> Optionally, the URL parameter <em>waitForSync</em> can be used to force synchronisation of the edge 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 edge document, the attribute <em>_rev</em> contains the new revision of the edge document. <br><br> If the edge 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 revision id for conditional replacements (i.e. replacements that will only be executed if the revision id found in the database matches the revision id specified in the request): <ul class=\"swagger-list\"><li>specifying the target revision in the <em>rev</em> URL query parameter <li>specifying the target revision in the <em>if-match</em> HTTP header </ul> 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 revision id as returned in the <em>_rev</em> attribute of an edge document or by an HTTP <em>etag</em> header. <br><br> For example, to conditionally replace an edge document based on a specific revision id, you can use the following request: <br><br> <ul class=\"swagger-list\"><li>PUT /_api/document/<em>document-handle</em>?rev=<em>etag</em> </ul> 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 edge document found in the database is equal to the target revision id provided in the request. If there is a mismatch between the revision id, then by default a <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> <ul class=\"swagger-list\"><li>PUT /_api/document/<em>document-handle</em>?policy=<em>policy</em> </ul> 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 an edge",
"httpMethod": "PUT",
"examples": "",
@ -271,20 +293,24 @@
{
"errorResponses": [
{
"reason": "is returned if the document was patched successfully and <em>waitForSync</em> was <em>true</em>. ",
"reason": "is returned if the document was patched successfully and <em>waitForSync</em> was <em>true</em>. <br><br>",
"code": "201"
},
{
"reason": "is returned if the document was patched successfully and <em>waitForSync</em> was <em>false</em>. ",
"reason": "is returned if the document was patched successfully and <em>waitForSync</em> was <em>false</em>. <br><br>",
"code": "202"
},
{
"reason": "is returned if the body does not contain a valid JSON representation or when applied on an non-edge collection. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation or when applied on an non-edge collection. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection or the edge document was not found ",
"reason": "is returned if the collection or the edge document was not found <br><br>",
"code": "404"
},
{
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned.",
"code": "412"
}
],
"parameters": [
@ -293,47 +319,51 @@
"paramType": "body",
"required": "true",
"name": "document",
"description": "A JSON representation of the edge update. "
"description": "A JSON representation of the edge update. <br><br>"
},
{
"dataType": "String",
"paramType": "path",
"required": "true",
"name": "document-handle",
"description": "The handle of the edge document. "
"description": "The handle of the edge document. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "keepNull",
"description": "If the intention is to delete existing attributes with the patch command, the URL query 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 edge document that are contained in the patch document with an attribute value of <em>null</em>. "
"description": "If the intention is to delete existing attributes with the patch command, the URL query 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 edge document that are contained in the patch document with an attribute value of <em>null</em>. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "waitForSync",
"description": "Wait until edge document has been synced to disk. "
"description": "Wait until edge document has been synced to disk. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "rev",
"description": "You can conditionally patch an edge document based on a target revision id by using the <em>rev</em> URL parameter. "
"description": "You can conditionally patch an edge document based on a target revision id by using the <em>rev</em> URL parameter. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "policy",
"description": "To control the update behavior in case there is a revision mismatch, you can use the <em>policy</em> parameter. "
"description": "To control the update behavior in case there is a revision mismatch, you can use the <em>policy</em> parameter. <br><br>"
},
{
"dataType": "String",
"paramType": "header",
"name": "If-Match",
"description": "You can conditionally patch an edge document based on a target revision id by using the <em>if-match</em> HTTP header. "
"description": "You can conditionally patch an edge document based on a target revision id by using the <em>if-match</em> HTTP header. <br><br>"
}
],
"notes": "Partially updates the edge 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 edge document if they do not yet exist, and overwritten in the existing edge 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>Note that internal attributes such as <em>_key</em>, <em>_from</em> and <em>_to</em> are immutable once set and cannot be updated. <br><br>Optionally, the URL parameter <em>waitForSync</em> can be used to force synchronisation of the edge 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 edge document, the attribute <em>_rev</em> contains the new edge document revision. <br><br>If the edge 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 an edge 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 edge documents (see replacing documents for details). <br><br>",
"notes": "Partially updates the edge 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 edge document if they do not yet exist, and overwritten in the existing edge 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> Note that internal attributes such as <em>_key</em>, <em>_from</em> and <em>_to</em> are immutable once set and cannot be updated. <br><br> Optionally, the URL parameter <em>waitForSync</em> can be used to force synchronisation of the edge 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 edge document, the attribute <em>_rev</em> contains the new edge document revision. <br><br> If the edge 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 an edge 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 edge documents (see replacing documents for details). <br><br>",
"summary": "patches an edge",
"httpMethod": "PATCH",
"examples": "",
@ -347,16 +377,20 @@
{
"errorResponses": [
{
"reason": "is returned if the edge document was deleted successfully and <em>waitForSync</em> was <em>true</em>. ",
"reason": "is returned if the edge document was deleted successfully and <em>waitForSync</em> was <em>true</em>. <br><br>",
"code": "200"
},
{
"reason": "is returned if the edge document was deleted successfully and <em>waitForSync</em> was <em>false</em>. ",
"reason": "is returned if the edge document was deleted successfully and <em>waitForSync</em> was <em>false</em>. <br><br>",
"code": "202"
},
{
"reason": "is returned if the collection or the edge document was not found. The response body contains an error document in this case. ",
"reason": "is returned if the collection or the edge document was not found. The response body contains an error document in this case. <br><br>",
"code": "404"
},
{
"reason": "is returned if a \"If-Match\" header or <em>rev</em> is given and the found document has a different version. The response will also contain the found document's current revision in the <em>_rev</em> attribute. Additionally, the attributes <em>_id</em> and <em>_key</em> will be returned.",
"code": "412"
}
],
"parameters": [
@ -365,34 +399,37 @@
"paramType": "path",
"required": "true",
"name": "document-handle",
"description": "Deletes the edge document identified by <em>document-handle</em>. "
"description": "Deletes the edge document identified by <em>document-handle</em>. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "rev",
"description": "You can conditionally delete an edge document based on a target revision id by using the <em>rev</em> URL parameter. "
"description": "You can conditionally delete an edge document based on a target revision id by using the <em>rev</em> URL parameter. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "policy",
"description": "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 edge documents (see replacing edge documents for more details). "
"description": "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 edge documents (see replacing edge documents for more details). <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "waitForSync",
"description": "Wait until edge document has been synced to disk. "
"description": "Wait until edge document has been synced to disk. <br><br>"
},
{
"dataType": "String",
"paramType": "header",
"name": "If-Match",
"description": "You can conditionally delete an edge document based on a target revision id by using the <em>if-match</em> HTTP header. "
"description": "You can conditionally delete an edge document based on a target revision id by using the <em>if-match</em> HTTP header. <br><br>"
}
],
"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 deleted edge document, the attribute <em>_rev</em> contains the edge 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>",
"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 deleted edge document, the attribute <em>_rev</em> contains the edge 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 an edge",
"httpMethod": "DELETE",
"examples": "",

View File

@ -13,26 +13,27 @@
"paramType": "path",
"required": "true",
"name": "collection-id",
"description": "The id of the collection. "
"description": "The id of the collection. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "vertex",
"description": "The id of the start vertex. "
"description": "The id of the start vertex. <br><br>"
},
{
"dataType": "String",
"paramType": "query",
"required": "false",
"name": "direction",
"description": "Selects <em>in</em> or <em>out</em> direction for edges. If not set, any edges are returned. "
"description": "Selects <em>in</em> or <em>out</em> direction for edges. If not set, any edges are returned. <br><br>"
}
],
"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\" : \"125592654\", \n \"_key\" : \"6\", \n \"_from\" : \"vertices/2\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v2 -> v1\" \n }, \n { \n \"_id\" : \"edges/7\", \n \"_rev\" : \"126051406\", \n \"_key\" : \"7\", \n \"_from\" : \"vertices/4\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v4 -> v1\" \n }, \n { \n \"_id\" : \"edges/5\", \n \"_rev\" : \"125133902\", \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\" : \"130114638\", \n \"_key\" : \"6\", \n \"_from\" : \"vertices/2\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v2 -> v1\" \n }, \n { \n \"_id\" : \"edges/7\", \n \"_rev\" : \"130573390\", \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\" : \"134177870\", \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": "<br><br> Any direction <br><br><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\" : \"113525159\", \n \"_key\" : \"6\", \n \"_from\" : \"vertices/2\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v2 -> v1\" \n }, \n { \n \"_id\" : \"edges/7\", \n \"_rev\" : \"114049447\", \n \"_key\" : \"7\", \n \"_from\" : \"vertices/4\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v4 -> v1\" \n }, \n { \n \"_id\" : \"edges/5\", \n \"_rev\" : \"113000871\", \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><br><br> In edges <br><br><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\" : \"118178215\", \n \"_key\" : \"6\", \n \"_from\" : \"vertices/2\", \n \"_to\" : \"vertices/1\", \n \"$label\" : \"v2 -> v1\" \n }, \n { \n \"_id\" : \"edges/7\", \n \"_rev\" : \"118702503\", \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><br><br> Out edges <br><br><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\" : \"122306983\", \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"
}
],

View File

@ -8,23 +8,23 @@
{
"errorResponses": [
{
"reason": "is returned when the list of endpoints can be determined successfully. ",
"reason": "is returned when the list of endpoints can be determined successfully. <br><br>",
"code": "200"
},
{
"reason": "is returned if the action is not carried out in the system database. ",
"reason": "is returned if the action is not carried out in the system database. <br><br>",
"code": "400"
},
{
"reason": "The server will respond with <em>HTTP 405</em> if an unsupported HTTP method is used. ",
"reason": "The server will respond with <em>HTTP 405</em> if an unsupported HTTP method is used. <br><br>",
"code": "405"
}
],
"parameters": [],
"notes": "Returns a list of all configured endpoints the server is listening on. For each endpoint, the list of allowed databases is returned too if set. <br><br>The result is a JSON hash which has the endpoints as keys, and the list of mapped database names as values for each endpoint. <br><br>If a list of mapped databases is empty, it means that all databases can be accessed via the endpoint. If a list of mapped databases contains more than one database name, this means that any of the databases might be accessed via the endpoint, and the first database in the list will be treated as the default database for the endpoint. The default database will be used when an incoming request does not specify a database name in the request explicitly. <br><br>Note: retrieving the list of all endpoints is allowed in the system database only. Calling this action in any other database will make the server return an error. <br><br>",
"notes": "Returns a list of all configured endpoints the server is listening on. For each endpoint, the list of allowed databases is returned too if set. <br><br> The result is a JSON hash which has the endpoints as keys, and the list of mapped database names as values for each endpoint. <br><br> If a list of mapped databases is empty, it means that all databases can be accessed via the endpoint. If a list of mapped databases contains more than one database name, this means that any of the databases might be accessed via the endpoint, and the first database in the list will be treated as the default database for the endpoint. The default database will be used when an incoming request does not specify a database name in the request explicitly. <br><br> Note: retrieving the list of all endpoints is allowed in the system database only. Calling this action in any other database will make the server return an error. <br><br>",
"summary": "returns a list of all endpoints",
"httpMethod": "GET",
"examples": "<br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/endpoint\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n { \n \"endpoint\" : \"tcp://127.0.0.1:37152\", \n \"databases\" : [ ] \n }, \n { \n \"endpoint\" : \"tcp://127.0.0.1:8532\", \n \"databases\" : [ \n \"mydb1\", \n \"mydb2\" \n ] \n } \n]\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl --dump - http://localhost:8529/_api/endpoint\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n { \n \"endpoint\" : \"tcp://127.0.0.1:35134\", \n \"databases\" : [ ] \n }, \n { \n \"endpoint\" : \"tcp://127.0.0.1:8532\", \n \"databases\" : [ \n \"mydb1\", \n \"mydb2\" \n ] \n } \n]\n\n</code></pre><br>",
"nickname": "returnsAListOfAllEndpoints"
}
],
@ -35,15 +35,15 @@
{
"errorResponses": [
{
"reason": "is returned when the endpoint was added or changed successfully. ",
"reason": "is returned when the endpoint was added or changed successfully. <br><br>",
"code": "200"
},
{
"reason": "is returned if the request is malformed or if the action is not carried out in the system database. ",
"reason": "is returned if the request is malformed or if the action is not carried out in the system database. <br><br>",
"code": "400"
},
{
"reason": "The server will respond with <em>HTTP 405</em> if an unsupported HTTP method is used. ",
"reason": "The server will respond with <em>HTTP 405</em> if an unsupported HTTP method is used. <br><br>",
"code": "405"
}
],
@ -53,13 +53,13 @@
"paramType": "body",
"required": "true",
"name": "description",
"description": "A JSON object describing the endpoint. "
"description": "A JSON object describing the endpoint. <br><br>"
}
],
"notes": "The request body must be JSON hash with the following attributes: <br><br>- <em>endpoint</em>: the endpoint specification, e.g. <em>tcp://127.0.0.1:8530</em><br><br>- <em>databases</em>: a list of database names the endpoint is responsible for.<br><br>If <em>databases</em> is an empty list, all databases present in the server will become accessible via the endpoint, with the <em>_system</em> database being the default database. <br><br>If <em>databases</em> is non-empty, only the specified databases will become available via the endpoint. The first database name in the <em>databases</em> list will also become the default database for the endpoint. The default database will always be used if a request coming in on the endpoint does not specify the database name explicitly. <br><br>Note: adding or reconfiguring endpoints is allowed in the system database only. Calling this action in any other database will make the server return an error. <br><br>Adding SSL endpoints at runtime is only supported if the server was started with SSL properly configured (e.g. <em>--server.keyfile</em> must have been set). <br><br>",
"notes": "The request body must be JSON hash with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>endpoint</em>: the endpoint specification, e.g. <em>tcp://127.0.0.1:8530</em> <li><em>databases</em>: a list of database names the endpoint is responsible for. </ul> If <em>databases</em> is an empty list, all databases present in the server will become accessible via the endpoint, with the <em>_system</em> database being the default database. <br><br> If <em>databases</em> is non-empty, only the specified databases will become available via the endpoint. The first database name in the <em>databases</em> list will also become the default database for the endpoint. The default database will always be used if a request coming in on the endpoint does not specify the database name explicitly. <br><br> Note: adding or reconfiguring endpoints is allowed in the system database only. Calling this action in any other database will make the server return an error. <br><br> Adding SSL endpoints at runtime is only supported if the server was started with SSL properly configured (e.g. <em>--server.keyfile</em> must have been set). <br><br>",
"summary": "adds a new endpoint or reconfigures an existing endpoint",
"httpMethod": "POST",
"examples": "Adding an endpoint <em>tcp://127.0.0.1:8532</em> with two mapped databases (<em>mydb1</em> and <em>mydb2</em>). <em>mydb1</em> will become the default database for the endpoint. <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/endpoint\n{\"endpoint\":\"tcp://127.0.0.1:8532\",\"databases\":[\"mydb1\",\"mydb2\"]}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Adding an endpoint <em>tcp://127.0.0.1:8533</em> with no database names specified. This will allow access to all databases on this endpoint. The <em>_system</em> database will become the default database for requests that come in on this endpoint and do not specify the database name explicitly. <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/endpoint\n{\"endpoint\":\"tcp://127.0.0.1:8533\",\"databases\":[]}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Adding an endpoint <em>tcp://127.0.0.1:8533</em> without any databases first, and then updating the databases for the endpoint to <em>testdb1</em>, <em>testdb2</em>, and <em>testdb3</em>. <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/endpoint\n{\"endpoint\":\"tcp://127.0.0.1:8533\",\"databases\":[]}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\nunix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/endpoint\n{\"endpoint\":\"tcp://127.0.0.1:8533\",\"databases\":[],\"database\":[\"testdb1\",\"testdb2\",\"testdb3\"]}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "Adding an endpoint <em>tcp://127.0.0.1:8532</em> with two mapped databases (<em>mydb1</em> and <em>mydb2</em>). <em>mydb1</em> will become the default database for the endpoint. <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/endpoint\n{\"endpoint\":\"tcp://127.0.0.1:8532\",\"databases\":[\"mydb1\",\"mydb2\"]}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br><br><br> Adding an endpoint <em>tcp://127.0.0.1:8533</em> with no database names specified. This will allow access to all databases on this endpoint. The <em>_system</em> database will become the default database for requests that come in on this endpoint and do not specify the database name explicitly. <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/endpoint\n{\"endpoint\":\"tcp://127.0.0.1:8533\",\"databases\":[]}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br><br><br> Adding an endpoint <em>tcp://127.0.0.1:8533</em> without any databases first, and then updating the databases for the endpoint to <em>testdb1</em>, <em>testdb2</em>, and <em>testdb3</em>. <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/endpoint\n{\"endpoint\":\"tcp://127.0.0.1:8533\",\"databases\":[]}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\nunix> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/endpoint\n{\"endpoint\":\"tcp://127.0.0.1:8533\",\"databases\":[],\"database\":[\"testdb1\",\"testdb2\",\"testdb3\"]}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "addsANewEndpointOrReconfiguresAnExistingEndpoint"
}
],
@ -70,19 +70,19 @@
{
"errorResponses": [
{
"reason": "is returned when the endpoint was deleted and disconnected successfully. ",
"reason": "is returned when the endpoint was deleted and disconnected successfully. <br><br>",
"code": "200"
},
{
"reason": "is returned if the request is malformed or if the action is not carried out in the system database. ",
"reason": "is returned if the request is malformed or if the action is not carried out in the system database. <br><br>",
"code": "400"
},
{
"reason": "is returned if the endpoint is not found. ",
"reason": "is returned if the endpoint is not found. <br><br>",
"code": "404"
},
{
"reason": "The server will respond with <em>HTTP 405</em> if an unsupported HTTP method is used. ",
"reason": "The server will respond with <em>HTTP 405</em> if an unsupported HTTP method is used. <br><br>",
"code": "405"
}
],
@ -92,13 +92,13 @@
"paramType": "path",
"required": "true",
"name": "endpoint",
"description": "The endpoint to delete, e.g. <em>tcp://127.0.0.1:8529</em>. "
"description": "The endpoint to delete, e.g. <em>tcp://127.0.0.1:8529</em>. <br><br>"
}
],
"notes": "This operation deletes an existing endpoint from the list of all endpoints, and makes the server stop listening on the endpoint. <br><br>Note: deleting and disconnecting an endpoint is allowed in the system database only. Calling this action in any other database will make the server return an error. <br><br>Futhermore, the last remaining endpoint cannot be deleted as this would make the server kaputt. <br><br>",
"notes": "This operation deletes an existing endpoint from the list of all endpoints, and makes the server stop listening on the endpoint. <br><br> Note: deleting and disconnecting an endpoint is allowed in the system database only. Calling this action in any other database will make the server return an error. <br><br> Futhermore, the last remaining endpoint cannot be deleted as this would make the server kaputt. <br><br>",
"summary": "deletes and disconnects an existing endpoint",
"httpMethod": "DELETE",
"examples": "Deleting an existing endpoint <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/endpoint/tcp%3A%2F%2F127.0.0.1%3A8532\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Deleting a non-existing endpoint <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/endpoint/tcp%3A%2F%2F127.0.0.1%3A8532\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 1231, \n \"errorMessage\" : \"endpoint not found\" \n}\n\n</code></pre><br>",
"examples": "<br><br> Deleting an existing endpoint <br><br><br><br><pre><code class=\"json\">unix> curl -X DELETE --dump - http://localhost:8529/_api/endpoint/tcp%3A%2F%2F127.0.0.1%3A8532\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br><br><br> Deleting a non-existing endpoint <br><br><br><br><pre><code class=\"json\">unix> curl -X DELETE --dump - http://localhost:8529/_api/endpoint/tcp%3A%2F%2F127.0.0.1%3A8532\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 1231, \n \"errorMessage\" : \"endpoint not found\" \n}\n\n</code></pre><br>",
"nickname": "deletesAndDisconnectsAnExistingEndpoint"
}
],

File diff suppressed because it is too large Load Diff

View File

@ -57,6 +57,13 @@
"name": "createCollection",
"description": "If this parameter has a value of <em>true</em> or <em>yes</em>, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "overwrite",
"description": "If this parameter has a value of <em>true</em> or <em>yes</em>, then all data in the collection will be removed prior to the import. Note that any existing index definitions will be preseved. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
@ -135,6 +142,13 @@
"name": "createCollection",
"description": "If this parameter has a value of <em>true</em> or <em>yes</em>, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "overwrite",
"description": "If this parameter has a value of <em>true</em> or <em>yes</em>, then all data in the collection will be removed prior to the import. Note that any existing index definitions will be preseved. <br><br>"
},
{
"dataType": "Boolean",
"paramType": "query",

View File

@ -11,15 +11,15 @@
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection",
"description": "The collection name. "
"description": "The collection name. <br><br>"
}
],
"notes": "<br><br>Returns an object with an attribute <em>indexes</em> containing a list of all index descriptions for the given collection. The same information is also available in the <em>identifiers</em> as hash map with the index handle as keys. <br><br>",
"notes": "<br><br> Returns an object with an attribute <em>indexes</em> containing a list of all index descriptions for the given collection. The same information is also available in the <em>identifiers</em> as hash map with the index handle as keys. <br><br>",
"summary": "reads all indexes of a collection",
"httpMethod": "GET",
"examples": "Return information about all indexes: <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/index?collection=products\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"indexes\" : [ \n { \n \"id\" : \"products/0\", \n \"type\" : \"primary\", \n \"unique\" : true, \n \"fields\" : [ \n \"_id\" \n ] \n } \n ], \n \"identifiers\" : { \n \"products/0\" : { \n \"id\" : \"products/0\", \n \"type\" : \"primary\", \n \"unique\" : true, \n \"fields\" : [ \n \"_id\" \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "<br><br> Return information about all indexes: <br><br><br><br><pre><code class=\"json\">unix> curl --dump - http://localhost:8529/_api/index?collection=products\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"indexes\" : [ \n { \n \"id\" : \"products/0\", \n \"type\" : \"primary\", \n \"unique\" : true, \n \"fields\" : [ \n \"_id\" \n ] \n } \n ], \n \"identifiers\" : { \n \"products/0\" : { \n \"id\" : \"products/0\", \n \"type\" : \"primary\", \n \"unique\" : true, \n \"fields\" : [ \n \"_id\" \n ] \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "readsAllIndexesOfACollection"
}
],
@ -30,11 +30,11 @@
{
"errorResponses": [
{
"reason": "If the index exists, then a <em>HTTP 200</em> is returned. ",
"reason": "If the index exists, then a <em>HTTP 200</em> is returned. <br><br>",
"code": "200"
},
{
"reason": "If the index does not exist, then a <em>HTTP 404</em> is returned. ",
"reason": "If the index does not exist, then a <em>HTTP 404</em> is returned. <br><br>",
"code": "404"
}
],
@ -44,13 +44,13 @@
"paramType": "path",
"required": "true",
"name": "index-handle",
"description": "The index-handle. "
"description": "The index-handle. <br><br>"
}
],
"notes": "<br><br>The result is an objects describing the index. It has at least the following attributes: <br><br>- <em>id</em>: The identifier of the index.<br><br>All other attributes are type-dependent. <br><br>",
"notes": "<br><br> The result is an objects describing the index. It has at least the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>id</em>: The identifier of the index. </ul> All other attributes are type-dependent. <br><br>",
"summary": "reads an index",
"httpMethod": "GET",
"examples": "<br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/index/products/0\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/0\", \n \"type\" : \"primary\", \n \"unique\" : true, \n \"fields\" : [ \n \"_id\" \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl --dump - http://localhost:8529/_api/index/products/0\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/0\", \n \"type\" : \"primary\", \n \"unique\" : true, \n \"fields\" : [ \n \"_id\" \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "readsAnIndex"
}
],
@ -61,15 +61,19 @@
{
"errorResponses": [
{
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. ",
"reason": "If the index already exists, then an <em>HTTP 200</em> is returned. <br><br>",
"code": "200"
},
{
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. ",
"reason": "If the index does not already exist and could be created, then an <em>HTTP 201</em> is returned. <br><br>",
"code": "201"
},
{
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. ",
"reason": "If either <em>size</em> or <em>byteSize</em> contain invalid values, then an <em>HTTP 400</em> is returned. <br><br>",
"code": "400"
},
{
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. <br><br>",
"code": "404"
}
],
@ -77,22 +81,22 @@
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection",
"description": "The collection name. "
"description": "The collection name. <br><br>"
},
{
"dataType": "Json",
"paramType": "body",
"required": "true",
"name": "cap-constraint",
"description": ""
"description": "<br><br>"
}
],
"notes": "<br><br>Creates a cap constraint 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>",
"notes": "<br><br> Creates a cap constraint for the collection <em>collection-name</em>, if it does not already exist. Expects an object containing the index details. <br><br> <ul class=\"swagger-list\"><li><em>type</em>: must be equal to <em>\"cap\"</em>. <li><em>size</em>: The maximal number of documents for the collection. If specified, the value must be greater than zero. <li><em>byteSize</em>: The maximal size of the active document data in the collection (in bytes). If specified, the value must be at least 16384. </ul> 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-binary @- --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/198206542\", \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": "<br><br> Creating a cap constraint <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/184893863\", \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"
}
],
@ -103,15 +107,15 @@
{
"errorResponses": [
{
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. ",
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. <br><br>",
"code": "200"
},
{
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. ",
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. <br><br>",
"code": "201"
},
{
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. ",
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. <br><br>",
"code": "404"
}
],
@ -119,22 +123,22 @@
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection",
"description": "The collection name. "
"description": "The collection name. <br><br>"
},
{
"dataType": "Json",
"paramType": "body",
"required": "true",
"name": "index-details",
"description": ""
"description": "<br><br>"
}
],
"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>Note: unique indexes on non-shard keys are not supported in a cluster. <br><br>",
"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> <ul class=\"swagger-list\"><li><em>type</em>: must be equal to <em>\"geo\"</em>. <li><em>fields</em>: A list with one or two attribute paths. 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. 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. <li><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 <li><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. <li><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. </ul> Note: unique indexes on non-shard keys are not supported in a cluster. <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-binary @- --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/198534222\", \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-binary @- --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/198927438\", \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": "<br><br> Creating a geo index with a location attribute: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/185221543\", \n \"type\" : \"geo1\", \n \"unique\" : false, \n \"geoJson\" : false, \n \"constraint\" : false, \n \"ignoreNull\" : false, \n \"fields\" : [ \n \"b\" \n ], \n \"isNewlyCreated\" : true, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br><br><br> Creating a geo index with latitude and longitude attributes: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/185614759\", \n \"type\" : \"geo2\", \n \"unique\" : false, \n \"constraint\" : false, \n \"ignoreNull\" : 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"
}
],
@ -145,19 +149,19 @@
{
"errorResponses": [
{
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. ",
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. <br><br>",
"code": "200"
},
{
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. ",
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. <br><br>",
"code": "201"
},
{
"reason": "If the collection already contains documents and you try to create a unique hash index in such a way that there are documents violating the uniqueness, then a <em>HTTP 400</em> is returned. ",
"reason": "If the collection already contains documents and you try to create a unique hash index in such a way that there are documents violating the uniqueness, then a <em>HTTP 400</em> is returned. <br><br>",
"code": "400"
},
{
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. ",
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. <br><br>",
"code": "404"
}
],
@ -165,22 +169,22 @@
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection-name",
"description": "The collection name. "
"description": "The collection name. <br><br>"
},
{
"dataType": "Json",
"paramType": "body",
"required": "true",
"name": "index-details",
"description": ""
"description": "<br><br>"
}
],
"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>Note: unique indexes on non-shard keys are not supported in a cluster. <br><br>",
"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> <ul class=\"swagger-list\"><li><em>type</em>: must be equal to <em>\"hash\"</em>. <li><em>fields</em>: A list of attribute paths. <li><em>unique</em>: If <em>true</em>, then create a unique index. </ul> Note: unique indexes on non-shard keys are not supported in a cluster. <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-binary @- --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/199320654\", \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-binary @- --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/199713870\", \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": "<br><br> Creating an unique constraint: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/186007975\", \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><br><br> Creating a hash index: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/186401191\", \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"
}
],
@ -191,19 +195,19 @@
{
"errorResponses": [
{
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. ",
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. <br><br>",
"code": "200"
},
{
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. ",
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. <br><br>",
"code": "201"
},
{
"reason": "If the collection already contains documents and you try to create a unique skip-list index in such a way that there are documents violating the uniqueness, then a <em>HTTP 400</em> is returned. ",
"reason": "If the collection already contains documents and you try to create a unique skip-list index in such a way that there are documents violating the uniqueness, then a <em>HTTP 400</em> is returned. <br><br>",
"code": "400"
},
{
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. ",
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. <br><br>",
"code": "404"
}
],
@ -211,22 +215,22 @@
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection-name",
"description": "The collection name. "
"description": "The collection name. <br><br>"
},
{
"dataType": "Json",
"paramType": "body",
"required": "true",
"name": "index-details",
"description": ""
"description": "<br><br>"
}
],
"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>Note: unique indexes on non-shard keys are not supported in a cluster. <br><br>",
"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> <ul class=\"swagger-list\"><li><em>type</em>: must be equal to <em>\"skiplist\"</em>. <li><em>fields</em>: A list of attribute paths. <li><em>unique</em>: If <em>true</em>, then create a unique index. </ul> Note: unique indexes on non-shard keys are not supported in a cluster. <br><br>",
"summary": "creates a skip list",
"httpMethod": "POST",
"examples": "Creating a skiplist: <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --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/200107086\", \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": "<br><br> Creating a skiplist: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/186794407\", \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"
}
],
@ -237,15 +241,15 @@
{
"errorResponses": [
{
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. ",
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. <br><br>",
"code": "200"
},
{
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. ",
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. <br><br>",
"code": "201"
},
{
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. ",
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. <br><br>",
"code": "404"
}
],
@ -253,22 +257,22 @@
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection-name",
"description": "The collection name. "
"description": "The collection name. <br><br>"
},
{
"dataType": "Json",
"paramType": "body",
"required": "true",
"name": "index-details",
"description": ""
"description": "<br><br>"
}
],
"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>",
"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> <ul class=\"swagger-list\"><li><em>type</em>: must be equal to <em>\"fulltext\"</em>. <li><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>. <li><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.",
"summary": "creates a fulltext index",
"httpMethod": "POST",
"examples": "Creating a fulltext index: <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --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/200434766\", \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": "<br><br> Creating a fulltext index: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/187122087\", \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"
}
],
@ -279,15 +283,15 @@
{
"errorResponses": [
{
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. ",
"reason": "If the index already exists, then a <em>HTTP 200</em> is returned. <br><br>",
"code": "200"
},
{
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. ",
"reason": "If the index does not already exist and could be created, then a <em>HTTP 201</em> is returned. <br><br>",
"code": "201"
},
{
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. ",
"reason": "If the <em>collection-name</em> is unknown, then a <em>HTTP 404</em> is returned. <br><br>",
"code": "404"
}
],
@ -295,22 +299,22 @@
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection-name",
"description": "The collection name. "
"description": "The collection name. <br><br>"
},
{
"dataType": "Json",
"paramType": "body",
"required": "true",
"name": "index-details",
"description": ""
"description": "<br><br>"
}
],
"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>",
"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> <ul class=\"swagger-list\"><li><em>type</em>: must be equal to <em>\"bitarray\"</em>. <li><em>fields</em>: A list of pairs. A pair consists of an attribute path followed by a list of values. <li><em>unique</em>: Must always be set to <em>false</em>.",
"summary": "creates a bitarray index",
"httpMethod": "POST",
"examples": "Creating a bitarray index: <br><br><pre><code class=\"json\" >unix> curl -X POST --data-binary @- --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/200827982\", \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": "<br><br> Creating a bitarray index: <br><br><br><br><pre><code class=\"json\">unix> curl -X POST --data-binary @- --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/187515303\", \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"
}
],
@ -321,35 +325,39 @@
{
"errorResponses": [
{
"reason": "If the index already exists, then an <em>HTTP 200</em> is returned. ",
"reason": "If the index already exists, then an <em>HTTP 200</em> is returned. <br><br>",
"code": "200"
},
{
"reason": "If the index does not already exist and could be created, then an <em>HTTP 201</em> is returned. ",
"reason": "If the index does not already exist and could be created, then an <em>HTTP 201</em> is returned. <br><br>",
"code": "201"
},
{
"reason": "If an invalid index description is posted or attributes are used that the target index will not support, then an <em>HTTP 400</em> is returned. ",
"reason": "If an invalid index description is posted or attributes are used that the target index will not support, then an <em>HTTP 400</em> is returned. <br><br>",
"code": "400"
},
{
"reason": "If <em>collection</em> is unknown, then an <em>HTTP 404</em> is returned.",
"code": "404"
}
],
"parameters": [
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "collection",
"description": "The collection name. "
"description": "The collection name. <br><br>"
},
{
"dataType": "Json",
"paramType": "body",
"required": "true",
"name": "index-details",
"description": ""
"description": "<br><br>"
}
],
"notes": "<br><br>Creates a new index in the collection <em>collection</em>. Expects an object containing the index details. <br><br>The type of the index to be created must specified in the <em>type</em> attribute of the index details. Depending on the index type, additional other attributes may need to specified in the request in order to create the index. <br><br>See the manual, the manual, the manual, the manual, and the manual for details. <br><br>Most indexes (a notable exception being the cap constraint) require the list of attributes to be indexed in the <em>fields</em> attribute of the index details. Depending on the index type, a single attribute or multiple attributes may be indexed. <br><br>Indexing system attributes such as <em>_id</em>, <em>_key</em>, <em>_from</em>, and <em>_to</em> is not supported by any index type. Manually creating an index that relies on any of these attributes is unsupported. <br><br>Some indexes can be created as unique or non-unique variants. Uniqueness can be controlled for most indexes by specifying the <em>unique</em> in the index details. Setting it to <em>true</em> will create a unique index. Setting it to <em>false</em> or omitting the <em>unique</em> attribute will create a non-unique index. <br><br>Note that the following index types do not support uniqueness, and using the <em>unique</em> attribute with these types may lead to an error: - cap constraints- fulltext indexes- bitarray indexes<br><br>Note also that unique indexes on non-shard keys are not supported in a cluster. <br><br>",
"notes": "<br><br> Creates a new index in the collection <em>collection</em>. Expects an object containing the index details. <br><br> The type of the index to be created must specified in the <em>type</em> attribute of the index details. Depending on the index type, additional other attributes may need to specified in the request in order to create the index. <br><br> See the manual, the manual, the manual, the manual, and the manual for details. <br><br> Most indexes (a notable exception being the cap constraint) require the list of attributes to be indexed in the <em>fields</em> attribute of the index details. Depending on the index type, a single attribute or multiple attributes may be indexed. <br><br> Indexing system attributes such as <em>_id</em>, <em>_key</em>, <em>_from</em>, and <em>_to</em> is not supported by any index type. Manually creating an index that relies on any of these attributes is unsupported. <br><br> Some indexes can be created as unique or non-unique variants. Uniqueness can be controlled for most indexes by specifying the <em>unique</em> in the index details. Setting it to <em>true</em> will create a unique index. Setting it to <em>false</em> or omitting the <em>unique</em> attribute will create a non-unique index. <br><br> Note that the following index types do not support uniqueness, and using the <em>unique</em> attribute with these types may lead to an error: <ul class=\"swagger-list\"><li>cap constraints <li>fulltext indexes <li>bitarray indexes </ul> Note also that unique indexes on non-shard keys are not supported in a cluster. <br><br>",
"summary": "creates an index",
"httpMethod": "POST",
"examples": "",
@ -363,23 +371,27 @@
{
"errorResponses": [
{
"reason": "If the index could be deleted, then an <em>HTTP 200</em> is returned. ",
"reason": "If the index could be deleted, then an <em>HTTP 200</em> is returned. <br><br>",
"code": "200"
},
{
"reason": "If the <em>index-handle</em> is unknown, then an <em>HTTP 404</em> is returned.",
"code": "404"
}
],
"parameters": [
{
"dataType": "String",
"paramType": "query",
"required": "True",
"required": "true",
"name": "index-handle",
"description": "The index handle. "
"description": "The index handle. <br><br>"
}
],
"notes": "<br><br>Deletes an index with <em>index-handle</em>. <br><br>",
"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/201221198\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/201221198\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl -X DELETE --dump - http://localhost:8529/_api/index/products/187908519\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"id\" : \"products/187908519\", \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "deletesAnIndex"
}
],

View File

@ -2,115 +2,5 @@
"basePath": "/",
"swaggerVersion": "1.1",
"apiVersion": "0.1",
"apis": [
{
"operations": [
{
"errorResponses": [
{
"reason": "is returned if no <em>job-id</em> was specified in the request. In this case, no <em>x-arango-async-id</em> HTTP header will be returned. ",
"code": "400"
},
{
"reason": "is returned if the job was not found or already deleted or fetched from the job result list. In this case, no <em>x-arango-async-id</em> HTTP header will be returned. ",
"code": "404"
}
],
"parameters": [
{
"dataType": "String",
"paramType": "path",
"required": "true",
"name": "job-id",
"description": "The async job id. "
}
],
"notes": "Returns the result of an async job identified by <em>job-id</em>. If the async job result is present on the server, the result will be removed from the list of result. That means this method can be called for each <em>job-id</em> once. <br><br>The method will return the original job result's headers and body, plus the additional HTTP header <em>x-arango-async-job-id</em>. If this header is present, then the job was found and the response contains the original job's result. If the header is not present, the job was not found and the response contains status information from the job amanger. <br><br>",
"summary": "Returns the result of an async job",
"httpMethod": "PUT",
"examples": "Not providing a job-id: <br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/job/\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\n\n{\"error\":true,\"errorMessage\":\"bad parameter\",\"code\":400,\"errorNum\":400}\n\n</code></pre><br>Providing a job-id for a non-existing job: <br><br><pre><code class=\"json\" >unix> curl -X PUT --dump - http://localhost:8529/_api/job/foobar\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{\"error\":true,\"errorMessage\":\"not found\",\"code\":404,\"errorNum\":404}\n\n</code></pre><br>Fetching the result of an HTTP GET job: <br><br><pre><code class=\"json\" >unix> curl --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 332096590\n\nunix> curl -X PUT --dump - http://localhost:8529/_api/job/332096590\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\nx-arango-async-id: 332096590\n\n{\"server\":\"arango\",\"version\":\"2.0.0-rc1\"}\n\n</code></pre><br>Fetching the result of an HTTP POST job that failed: <br><br><pre><code class=\"json\" >unix> curl -X POST --header 'x-arango-async: store' --data-binary @- --dump - http://localhost:8529/_api/collection\n{\"name\":\" this name is invalid \"}\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 332162126\n\nunix> curl -X PUT --dump - http://localhost:8529/_api/job/332162126\n\nHTTP/1.1 400 Bad Request\ncontent-type: application/json; charset=utf-8\nx-arango-async-id: 332162126\n\n{\"error\":true,\"code\":400,\"errorNum\":1208,\"errorMessage\":\"cannot create collection: illegal name\"}\n\n</code></pre><br>",
"nickname": "ReturnsTheResultOfAnAsyncJob"
}
],
"path": "/_api/job/{job-id}"
},
{
"operations": [
{
"errorResponses": [
{
"reason": "is returned if the list can be compiled successfully. Note: the list might be empty. ",
"code": "200"
},
{
"reason": "is returned if <em>type</em> is not specified or has an invalid value. ",
"code": "400"
}
],
"parameters": [
{
"dataType": "String",
"paramType": "path",
"required": "true",
"name": "type",
"description": "The type of jobs to return. The type can be either <em>done</em> or <em>pending</em>. Setting the type to <em>done</em> will make the method return the ids of already completed async jobs for which results can be fetched. Setting the type to <em>pending</em> will return the ids of not yet finished async jobs. "
},
{
"dataType": "Number",
"paramType": "query",
"name": "count",
"description": "The maximum number of ids to return per call. If not specified, a server-defined maximum value will be used. "
}
],
"notes": "Returns the list of ids of async jobs with a specific status (either done or pending). The list can be used by the client to get an overview of the job system status and to retrieve completed job results later. <br><br>",
"summary": "Returns the list of job result ids with a specific status",
"httpMethod": "GET",
"examples": "Fetching the list of done jobs: <br><br><pre><code class=\"json\" >unix> curl --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 332227662\n\nunix> curl --dump - http://localhost:8529/_api/job/done\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ \n \"332227662\" \n]\n\n</code></pre><br>Fetching the list of pending jobs: <br><br><pre><code class=\"json\" >unix> curl --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 332293198\n\nunix> curl --dump - http://localhost:8529/_api/job/pending\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n[ ]\n\n</code></pre><br>",
"nickname": "ReturnsTheListOfJobResultIdsWithASpecificStatus"
}
],
"path": "/_api/job/{type}"
},
{
"operations": [
{
"errorResponses": [
{
"reason": "is returned if the deletion operation was carried out successfully. This code will also be returned if no results were deleted. ",
"code": "200"
},
{
"reason": "is returned if <em>type</em> is not specified or has an invalid value. ",
"code": "400"
},
{
"reason": "is returned if <em>type</em> is a job-id but no async job with the specified id was found. ",
"code": "404"
}
],
"parameters": [
{
"dataType": "String",
"paramType": "path",
"required": "true",
"name": "type",
"description": "The type of jobs to delete. <em>type</em> can be: - <em>all</em>: deletes all jobs results. Currently executing or queued async jobs will not be stopped by this call. - <em>expired</em>: deletes expired results. To determine the expiration status of a result, pass the <em>stamp</em> URL parameter. <em>stamp</em> needs to be a UNIX timestamp, and all async job results created at a lower timestamp will be deleted. - an actual job-id: in this case, the call will remove the result of the specified async job. If the job is currently executing or queued, it will not be aborted. "
},
{
"dataType": "Number",
"paramType": "query",
"name": "stamp",
"description": "A UNIX timestamp specifying the expiration threshold when type is <em>expired</em>. "
}
],
"notes": "Deletes either all job results, expired job results, or the result of a specific job. Clients can use this method to perform an eventual garbage collection of job results. <br><br>",
"summary": "Deletes the result of async jobs",
"httpMethod": "DELETE",
"examples": "Deleting all jobs: <br><br><pre><code class=\"json\" >unix> curl --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 332358734\n\nunix> curl -X DELETE --dump - http://localhost:8529/_api/job/all\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true \n}\n\n</code></pre><br>Deleting expired jobs: <br><br><pre><code class=\"json\" >unix> curl --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 332424270\n\nunix> curl -X DELETE --dump - http://localhost:8529/_api/job/expired?stamp=1393856538\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true \n}\n\n</code></pre><br>Deleting the result of a specific job: <br><br><pre><code class=\"json\" >unix> curl --header 'x-arango-async: store' --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 202 Accepted\ncontent-type: text/plain; charset=utf-8\nx-arango-async-id: 332489806\n\nunix> curl -X DELETE --dump - http://localhost:8529/_api/job/332489806\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : true \n}\n\n</code></pre><br>Deleting the result of a non-existing job: <br><br><pre><code class=\"json\" >unix> curl -X DELETE --dump - http://localhost:8529/_api/job/foobar\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"errorMessage\" : \"not found\", \n \"code\" : 404, \n \"errorNum\" : 404 \n}\n\n</code></pre><br>",
"nickname": "DeletesTheResultOfAsyncJobs"
}
],
"path": "/_api/job/{type}"
}
]
"apis": []
}

View File

@ -78,7 +78,7 @@
"nickname": "readsTheGlobalLogFromTheServer"
}
],
"path": "/_api/log"
"path": "/_admin/log"
}
]
}

File diff suppressed because one or more lines are too long

View File

@ -8,15 +8,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. <br><br>",
"code": "404"
}
],
@ -26,10 +26,10 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query specification. "
"description": "Contains the query specification. <br><br>"
}
],
"notes": "<br><br>This will find all documents matching a given example, using the specified hash index. <br><br>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>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>hash</em>. <br><br>- <em>example</em>: an example document. The example must contain a value for each attribute in the index. <br><br>- <em>skip</em>: The number of documents to skip in the query. (optional)<br><br>- <em>limit</em>: The maximal number of documents to return. (optional)<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
"notes": "<br><br> This will find all documents matching a given example, using the specified hash index. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>hash</em>. <li><em>example</em>: an example document. The example must contain a value for each attribute in the index. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><em>limit</em>: The maximal number of documents to return. (optional) </ul> Returns a cursor containing the result, see the manual for details. <br><br>",
"summary": "executes query by-example using a hash index",
"httpMethod": "PUT",
"examples": "",
@ -43,15 +43,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. <br><br>",
"code": "404"
}
],
@ -61,10 +61,10 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query specification. "
"description": "Contains the query specification. <br><br>"
}
],
"notes": "<br><br>This will find all documents matching a given example, using the specified skiplist index. <br><br>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>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>skiplist</em>. <br><br>- <em>example</em>: an example document. The example must contain a value for each attribute in the index. <br><br>- <em>skip</em>: The number of documents to skip in the query. (optional)<br><br>- <em>limit</em>: The maximal number of documents to return. (optional)<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
"notes": "<br><br> This will find all documents matching a given example, using the specified skiplist index. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>skiplist</em>. <li><em>example</em>: an example document. The example must contain a value for each attribute in the index. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><em>limit</em>: The maximal number of documents to return. (optional) </ul> Returns a cursor containing the result, see the manual for details. <br><br>",
"summary": "executes query by-example using a skiplist index",
"httpMethod": "PUT",
"examples": "",
@ -78,15 +78,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. <br><br>",
"code": "404"
}
],
@ -96,10 +96,10 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query specification. "
"description": "Contains the query specification. <br><br>"
}
],
"notes": "<br><br>This will find all documents matching a given example, using the specified skiplist index. <br><br>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>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>bitarray</em>. <br><br>- <em>example</em>: an example document. The example must contain a value for each attribute in the index. <br><br>- <em>skip</em>: The number of documents to skip in the query. (optional)<br><br>- <em>limit</em>: The maximal number of documents to return. (optional)<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
"notes": "<br><br> This will find all documents matching a given example, using the specified skiplist index. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>bitarray</em>. <li><em>example</em>: an example document. The example must contain a value for each attribute in the index. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><em>limit</em>: The maximal number of documents to return. (optional) </ul> Returns a cursor containing the result, see the manual for details. <br><br>",
"summary": "executes query by-example using a bitarray index",
"httpMethod": "PUT",
"examples": "",
@ -113,15 +113,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. <br><br>",
"code": "404"
}
],
@ -131,10 +131,10 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query specification. "
"description": "Contains the query specification. <br><br>"
}
],
"notes": "<br><br>This will find all documents matching a given condition, using the specified skiplist index. <br><br>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>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>skiplist</em>. <br><br>- <em>condition</em>: the condition which all returned documents shall satisfy. Conditions must be specified for all indexed attributes. <br><br>- <em>skip</em>: The number of documents to skip in the query. (optional)<br><br>- <em>limit</em>: The maximal number of documents to return. (optional)<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
"notes": "<br><br> This will find all documents matching a given condition, using the specified skiplist index. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>skiplist</em>. <li><em>condition</em>: the condition which all returned documents shall satisfy. Conditions must be specified for all indexed attributes. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><em>limit</em>: The maximal number of documents to return. (optional) </ul> Returns a cursor containing the result, see the manual for details. <br><br>",
"summary": "executes query by-condition using a skiplist index",
"httpMethod": "PUT",
"examples": "",
@ -148,15 +148,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. <br><br>",
"code": "404"
}
],
@ -166,10 +166,10 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query specification. "
"description": "Contains the query specification. <br><br>"
}
],
"notes": "<br><br>This will find all documents matching a given condition, using the specified skiplist index. <br><br>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>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>bitarray</em>. <br><br>- <em>condition</em>: the condition which all returned documents shall satisfy. Conditions must be specified for all indexed attributes. <br><br>- <em>skip</em>: The number of documents to skip in the query. (optional)<br><br>- <em>limit</em>: The maximal number of documents to return. (optional)<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
"notes": "<br><br> This will find all documents matching a given condition, using the specified skiplist index. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>bitarray</em>. <li><em>condition</em>: the condition which all returned documents shall satisfy. Conditions must be specified for all indexed attributes. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><em>limit</em>: The maximal number of documents to return. (optional) </ul> Returns a cursor containing the result, see the manual for details. <br><br>",
"summary": "executes query by-condition using a bitarray index",
"httpMethod": "PUT",
"examples": "",
@ -183,15 +183,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -201,13 +201,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"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>",
"notes": "<br><br> Returns all documents of a collections. The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>skip</em>: The number of documents to skip in the query (optional). <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. (optional) </ul> 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-binary @- --dump - http://localhost:8529/_api/simple/all\n{ \"collection\": \"products\", \"skip\": 2, \"limit\" : 2 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/202007630\", \n \"_rev\" : \"202007630\", \n \"_key\" : \"202007630\", \n \"Hello2\" : \"World2\" \n }, \n { \n \"_id\" : \"products/202990670\", \n \"_rev\" : \"202990670\", \n \"_key\" : \"202990670\", \n \"Hello5\" : \"World5\" \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-binary @- --dump - http://localhost:8529/_api/simple/all\n{ \"collection\": \"products\", \"batchSize\" : 3 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/204235854\", \n \"_rev\" : \"204235854\", \n \"_key\" : \"204235854\", \n \"Hello3\" : \"World3\" \n }, \n { \n \"_id\" : \"products/204891214\", \n \"_rev\" : \"204891214\", \n \"_key\" : \"204891214\", \n \"Hello5\" : \"World5\" \n }, \n { \n \"_id\" : \"products/203908174\", \n \"_rev\" : \"203908174\", \n \"_key\" : \"203908174\", \n \"Hello2\" : \"World2\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"205087822\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
"examples": "<br><br> Limit the amount of documents using <em>limit</em> <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/all\n{ \"collection\": \"products\", \"skip\": 2, \"limit\" : 2 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/188694951\", \n \"_rev\" : \"188694951\", \n \"_key\" : \"188694951\", \n \"Hello2\" : \"World2\" \n }, \n { \n \"_id\" : \"products/188367271\", \n \"_rev\" : \"188367271\", \n \"_key\" : \"188367271\", \n \"Hello1\" : \"World1\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br><br><br> Using a <em>batchSize</em> value <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/all\n{ \"collection\": \"products\", \"batchSize\" : 3 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/190595495\", \n \"_rev\" : \"190595495\", \n \"_key\" : \"190595495\", \n \"Hello2\" : \"World2\" \n }, \n { \n \"_id\" : \"products/191578535\", \n \"_rev\" : \"191578535\", \n \"_key\" : \"191578535\", \n \"Hello5\" : \"World5\" \n }, \n { \n \"_id\" : \"products/190267815\", \n \"_rev\" : \"190267815\", \n \"_key\" : \"190267815\", \n \"Hello1\" : \"World1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"191775143\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
"nickname": "executesSimpleQueryAll"
}
],
@ -218,15 +218,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "200"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -236,13 +236,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"notes": "<br><br>Returns a random document from 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 <em>document</em> attrbute contains null. <br><br>",
"notes": "<br><br> Returns a random document from a collection. The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The identifier or name of the collection to query. </ul> 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 <em>document</em> attrbute contains null. <br><br>",
"summary": "returns a random document from a collection",
"httpMethod": "PUT",
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/any\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"document\" : { \n \"_id\" : \"products/205808718\", \n \"_rev\" : \"205808718\", \n \"_key\" : \"205808718\", \n \"Hello2\" : \"World2\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/any\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"document\" : { \n \"_id\" : \"products/192168359\", \n \"_rev\" : \"192168359\", \n \"_key\" : \"192168359\", \n \"Hello1\" : \"World1\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "returnsARandomDocumentFromACollection"
}
],
@ -253,15 +253,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -271,13 +271,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"notes": "<br><br>The default will find at most 100 documents near the given coordinate. The returned list is sorted according to the distance, with the nearest document being first in the list. If there are near documents of equal distance, documents are chosen randomly from this set until the limit is reached. <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 object 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 return the distance to the given coordinate. (optional). If specified, distances are returned in meters. <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>",
"notes": "<br><br> The default will find at most 100 documents near the given coordinate. The returned list is sorted according to the distance, with the nearest document being first in the list. If there are near documents of equal distance, documents are chosen randomly from this set until the limit is reached. <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 object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>latitude</em>: The latitude of the coordinate. <li><em>longitude</em>: The longitude of the coordinate. <li><em>distance</em>: If given, the attribute key used to return the distance to the given coordinate. (optional). If specified, distances are returned in meters. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><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) <li><em>geo</em>: If given, the identifier of the geo-index to use. (optional) </ul> Returns a cursor containing the result, see the manual for details. <br><br>",
"summary": "executes a near query",
"httpMethod": "PUT",
"examples": "Without distance: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/208757838\", \n \"_rev\" : \"208757838\", \n \"_key\" : \"208757838\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/208364622\", \n \"_rev\" : \"208364622\", \n \"_key\" : \"208364622\", \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-binary @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/211248206\", \n \"_rev\" : \"211248206\", \n \"_key\" : \"211248206\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/211641422\", \n \"_rev\" : \"211641422\", \n \"_key\" : \"211641422\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/211051598\", \n \"_rev\" : \"211051598\", \n \"_key\" : \"211051598\", \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": "<br><br> Without distance: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/195445159\", \n \"_rev\" : \"195445159\", \n \"_key\" : \"195445159\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/195051943\", \n \"_rev\" : \"195051943\", \n \"_key\" : \"195051943\", \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br><br><br> With distance: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/197935527\", \n \"_rev\" : \"197935527\", \n \"_key\" : \"197935527\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/198328743\", \n \"_rev\" : \"198328743\", \n \"_key\" : \"198328743\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/197738919\", \n \"_rev\" : \"197738919\", \n \"_key\" : \"197738919\", \n \"distance\" : 444.779706578235, \n \"name\" : \"Name/-0.004/\", \n \"loc\" : [ \n -0.004, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 3, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
"nickname": "executesANearQuery"
}
],
@ -288,15 +288,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -306,13 +306,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"notes": "<br><br>This will find all documents within 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 object 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 attribute key used to return the distance to the given coordinate. (optional). If specified, distances are returned in meters. <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>",
"notes": "<br><br> This will find all documents within 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 object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>latitude</em>: The latitude of the coordinate. <li><em>longitude</em>: The longitude of the coordinate. <li><em>radius</em>: The maximal radius (in meters). <li><em>distance</em>: If given, the attribute key used to return the distance to the given coordinate. (optional). If specified, distances are returned in meters. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><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) <li><em>geo</em>: If given, the identifier of the geo-index to use. (optional) </ul> Returns a cursor containing the result, see the manual for details. <br><br>",
"summary": "executes a within query",
"httpMethod": "PUT",
"examples": "Without distance: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2, \"radius\" : 500 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/214525006\", \n \"_rev\" : \"214525006\", \n \"_key\" : \"214525006\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/214131790\", \n \"_rev\" : \"214131790\", \n \"_key\" : \"214131790\", \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-binary @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\", \"radius\" : 300 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/217015374\", \n \"_rev\" : \"217015374\", \n \"_key\" : \"217015374\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/217408590\", \n \"_rev\" : \"217408590\", \n \"_key\" : \"217408590\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/216818766\", \n \"_rev\" : \"216818766\", \n \"_key\" : \"216818766\", \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": "<br><br> Without distance: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2, \"radius\" : 500 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/201212327\", \n \"_rev\" : \"201212327\", \n \"_key\" : \"201212327\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/200819111\", \n \"_rev\" : \"200819111\", \n \"_key\" : \"200819111\", \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br><br><br> With distance: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\", \"radius\" : 300 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/203702695\", \n \"_rev\" : \"203702695\", \n \"_key\" : \"203702695\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/204095911\", \n \"_rev\" : \"204095911\", \n \"_key\" : \"204095911\", \n \"distance\" : 222.38985328911744, \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/203506087\", \n \"_rev\" : \"203506087\", \n \"_key\" : \"203506087\", \n \"distance\" : 444.779706578235, \n \"name\" : \"Name/-0.004/\", \n \"loc\" : [ \n -0.004, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 3, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
"nickname": "executesAWithinQuery"
}
],
@ -323,15 +323,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -341,13 +341,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"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 object 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 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>- <em>index</em>: The identifier of the fulltext-index to use.<br><br>Returns a cursor containing the result, see the manual for details. <br><br>",
"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 object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>attribute</em>: The attribute that contains the texts. <li><em>query</em>: The fulltext query. <li><em>skip</em>: The number of documents to skip in the query (optional). <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. (optional) <li><em>index</em>: The identifier of the fulltext-index to use. </ul> Returns a cursor containing the result, see the manual for details. <br><br>",
"summary": "executes a fulltext index query",
"httpMethod": "PUT",
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/fulltext\n{ \"collection\": \"products\", \"attribute\" : \"text\", \"query\" : \"word\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/218850382\", \n \"_rev\" : \"218850382\", \n \"_key\" : \"218850382\", \n \"text\" : \"this text contains word\" \n }, \n { \n \"_id\" : \"products/219046990\", \n \"_rev\" : \"219046990\", \n \"_key\" : \"219046990\", \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><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/fulltext\n{ \"collection\": \"products\", \"attribute\" : \"text\", \"query\" : \"word\" }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/205734311\", \n \"_rev\" : \"205734311\", \n \"_key\" : \"205734311\", \n \"text\" : \"this text also has a word\" \n }, \n { \n \"_id\" : \"products/205537703\", \n \"_rev\" : \"205537703\", \n \"_key\" : \"205537703\", \n \"text\" : \"this text contains word\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
"nickname": "executesAFulltextIndexQuery"
}
],
@ -358,15 +358,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -376,13 +376,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"notes": "<br><br>This will find all documents matching a given example. <br><br>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>example</em>: The example document.<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>",
"notes": "<br><br> This will find all documents matching a given example. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>example</em>: The example document. <li><em>skip</em>: The number of documents to skip in the query (optional). <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. (optional) </ul> 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-binary @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"i\" : 1 } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/220881998\", \n \"_rev\" : \"220881998\", \n \"_key\" : \"220881998\", \n \"i\" : 1 \n }, \n { \n \"_id\" : \"products/220292174\", \n \"_rev\" : \"220292174\", \n \"_key\" : \"220292174\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/220619854\", \n \"_rev\" : \"220619854\", \n \"_key\" : \"220619854\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/221078606\", \n \"_rev\" : \"221078606\", \n \"_key\" : \"221078606\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 4, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>Matching an attribute which is a sub-document: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"a.j\" : 1 } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/222585934\", \n \"_rev\" : \"222585934\", \n \"_key\" : \"222585934\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/222258254\", \n \"_rev\" : \"222258254\", \n \"_key\" : \"222258254\", \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-binary @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/224748622\", \n \"_rev\" : \"224748622\", \n \"_key\" : \"224748622\", \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": "<br><br> Matching an attribute: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"i\" : 1 } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/207307175\", \n \"_rev\" : \"207307175\", \n \"_key\" : \"207307175\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/207765927\", \n \"_rev\" : \"207765927\", \n \"_key\" : \"207765927\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n { \n \"_id\" : \"products/206979495\", \n \"_rev\" : \"206979495\", \n \"_key\" : \"206979495\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/207569319\", \n \"_rev\" : \"207569319\", \n \"_key\" : \"207569319\", \n \"i\" : 1 \n } \n ], \n \"hasMore\" : false, \n \"count\" : 4, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br><br><br> Matching an attribute which is a sub-document: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"a.j\" : 1 } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/209273255\", \n \"_rev\" : \"209273255\", \n \"_key\" : \"209273255\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/208945575\", \n \"_rev\" : \"208945575\", \n \"_key\" : \"208945575\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br><br><br> Matching an attribute within a sub-document: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/211239335\", \n \"_rev\" : \"211239335\", \n \"_key\" : \"211239335\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 1, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
"nickname": "executesSimpleQueryBy-example"
}
],
@ -393,15 +393,15 @@
{
"errorResponses": [
{
"reason": "is returned when the query was successfully executed. ",
"reason": "is returned when the query was successfully executed. <br><br>",
"code": "200"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -411,13 +411,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"notes": "<br><br>This will return the first document matching a given example. <br><br>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>example</em>: The example document.<br><br>Returns a result containing the document or <em>HTTP 404</em> if no document matched the example. <br><br>If more than one document in the collection matches the specified example, only one of these documents will be returned, and it is undefined which of the matching documents is returned. <br><br>",
"notes": "<br><br> This will return the first document matching a given example. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>example</em>: The example document. </ul> Returns a result containing the document or <em>HTTP 404</em> if no document matched the example. <br><br> If more than one document in the collection matches the specified example, only one of these documents will be returned, and it is undefined which of the matching documents is returned. <br><br>",
"summary": "returns a document matching an example",
"httpMethod": "PUT",
"examples": "If a matching document was found: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first-example\n{ \"collection\": \"products\", \"example\" : { \"i\" : 1 } }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"document\" : { \n \"_id\" : \"products/226714702\", \n \"_rev\" : \"226714702\", \n \"_key\" : \"226714702\", \n \"i\" : 1, \n \"a\" : { \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-binary @- --dump - http://localhost:8529/_api/simple/first-example\n{ \"collection\": \"products\", \"example\" : { \"l\" : 1 } }\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 404, \n \"errorMessage\" : \"no match\" \n}\n\n</code></pre><br>",
"examples": "<br><br> If a matching document was found: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first-example\n{ \"collection\": \"products\", \"example\" : { \"i\" : 1 } }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"document\" : { \n \"_id\" : \"products/212877735\", \n \"_rev\" : \"212877735\", \n \"_key\" : \"212877735\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br><br><br> If no document was found: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first-example\n{ \"collection\": \"products\", \"example\" : { \"l\" : 1 } }\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 404, \n \"errorMessage\" : \"no match\" \n}\n\n</code></pre><br>",
"nickname": "returnsADocumentMatchingAnExample"
}
],
@ -428,15 +428,15 @@
{
"errorResponses": [
{
"reason": "is returned when the query was successfully executed. ",
"reason": "is returned when the query was successfully executed. <br><br>",
"code": "200"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -446,13 +446,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"notes": "<br><br>This will return the first document(s) 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>The request body must be a JSON object with the following attributes: - <em>collection</em>: the name of the collection<br><br>- <em>count</em>: the number of documents to return at most. Specifiying count is optional. If it is not specified, it defaults to 1. <br><br>Note: this method is not supported for sharded collections with more than one shard. <br><br>",
"notes": "<br><br> This will return the first document(s) 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> The request body must be a JSON object with the following attributes: <ul class=\"swagger-list\"><li><em>collection</em>: the name of the collection <li><em>count</em>: the number of documents to return at most. Specifiying count is optional. If it is not specified, it defaults to 1. </ul> Note: this method is not supported for sharded collections with more than one shard. <br><br>",
"summary": "returns the first document(s) of a collection",
"httpMethod": "PUT",
"examples": "Retrieving the first n documents: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first\n{ \"collection\": \"products\", \"count\" : 2 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/230188110\", \n \"_rev\" : \"230188110\", \n \"_key\" : \"230188110\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/230515790\", \n \"_rev\" : \"230515790\", \n \"_key\" : \"230515790\", \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-binary @- --dump - http://localhost:8529/_api/simple/first\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"_id\" : \"products/231760974\", \n \"_rev\" : \"231760974\", \n \"_key\" : \"231760974\", \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": "<br><br> Retrieving the first n documents: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first\n{ \"collection\": \"products\", \"count\" : 2 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/216678823\", \n \"_rev\" : \"216678823\", \n \"_key\" : \"216678823\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/217006503\", \n \"_rev\" : \"217006503\", \n \"_key\" : \"217006503\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br><br><br> Retrieving the first document: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"_id\" : \"products/218251687\", \n \"_rev\" : \"218251687\", \n \"_key\" : \"218251687\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "returnsTheFirstDocument(s)OfACollection"
}
],
@ -463,15 +463,15 @@
{
"errorResponses": [
{
"reason": "is returned when the query was successfully executed. ",
"reason": "is returned when the query was successfully executed. <br><br>",
"code": "200"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -481,13 +481,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"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. <br><br>The request body must be a JSON object with the following attributes: - <em>collection</em>: the name of the collection<br><br>- <em>count</em>: the number of documents to return at most. Specifiying count is optional. If it is not specified, it defaults to 1. <br><br>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>Note: this method is not supported for sharded collections with more than one shard. <br><br>",
"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. <br><br> The request body must be a JSON object with the following attributes: <ul class=\"swagger-list\"><li><em>collection</em>: the name of the collection <li><em>count</em>: the number of documents to return at most. Specifiying count is optional. If it is not specified, it defaults to 1. </ul> 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> Note: this method is not supported for sharded collections with more than one shard. <br><br>",
"summary": "returns the last document(s) of a collection",
"httpMethod": "PUT",
"examples": "Retrieving the last n documents: <br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/last\n{ \"collection\": \"products\", \"count\" : 2 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/234120270\", \n \"_rev\" : \"234120270\", \n \"_key\" : \"234120270\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n { \n \"_id\" : \"products/233923662\", \n \"_rev\" : \"233923662\", \n \"_key\" : \"233923662\", \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-binary @- --dump - http://localhost:8529/_api/simple/last\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"_id\" : \"products/235693134\", \n \"_rev\" : \"235693134\", \n \"_key\" : \"235693134\", \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": "<br><br> Retrieving the last n documents: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/last\n{ \"collection\": \"products\", \"count\" : 2 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/220610983\", \n \"_rev\" : \"220610983\", \n \"_key\" : \"220610983\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n { \n \"_id\" : \"products/220414375\", \n \"_rev\" : \"220414375\", \n \"_key\" : \"220414375\", \n \"i\" : 1 \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br><br><br> Retrieving the first document: <br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/last\n{ \"collection\": \"products\" }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"_id\" : \"products/222183847\", \n \"_rev\" : \"222183847\", \n \"_key\" : \"222183847\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "returnsTheLastDocument(s)OfACollection"
}
],
@ -498,15 +498,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "201"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -516,13 +516,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"notes": "<br><br>This will find all documents within a given range. In order to execute a range query, a skip-list index on the queried attribute must be present. <br><br>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>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 <em>true</em>, 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 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>",
"notes": "<br><br> This will find all documents within a given range. In order to execute a range query, a skip-list index on the queried attribute must be present. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>attribute</em>: The attribute path to check. <li><em>left</em>: The lower bound. <li><em>right</em>: The upper bound. <li><em>closed</em>: If <em>true</em>, use interval including <em>left</em> and <em>right</em>, otherwise exclude <em>right</em>, but include <em>left</em>. <li><em>skip</em>: The number of documents to skip in the query (optional). <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. (optional) </ul> 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-binary @- --dump - http://localhost:8529/_api/simple/range\n{ \"collection\": \"products\", \"attribute\" : \"i\", \"left\" : 2, \"right\" : 4 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/236545102\", \n \"_rev\" : \"236545102\", \n \"_key\" : \"236545102\", \n \"i\" : 2 \n }, \n { \n \"_id\" : \"products/236741710\", \n \"_rev\" : \"236741710\", \n \"_key\" : \"236741710\", \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><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/range\n{ \"collection\": \"products\", \"attribute\" : \"i\", \"left\" : 2, \"right\" : 4 }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/223035815\", \n \"_rev\" : \"223035815\", \n \"_key\" : \"223035815\", \n \"i\" : 2 \n }, \n { \n \"_id\" : \"products/223232423\", \n \"_rev\" : \"223232423\", \n \"_key\" : \"223232423\", \n \"i\" : 3 \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n\n</code></pre><br>",
"nickname": "executesSimpleRangeQuery"
}
],
@ -533,15 +533,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "200"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -551,13 +551,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"notes": "<br><br>This will find all documents in the collection that match the specified example object. <br><br>The call expects a JSON object as body with the following attributes: <br><br>- <em>collection</em>: The name of the collection to remove from.<br><br>- <em>example</em>: An example document that all collection documents are compared against. <br><br>- <em>waitForSync</em>: if set to true, then all removal operations will instantly be synchronised to disk. If this is not specified, then the collection's default sync behavior will be applied. <br><br>- <em>limit</em>: an optional value that determines how many documents to delete at most. If <em>limit</em> is specified but is less than the number of documents in the collection, it is undefined which of the documents will be deleted. <br><br>Note: the <em>limit</em> attribute is not supported on sharded collections. Using it will result in an error. <br><br>Returns the number of documents that were deleted. <br><br>",
"notes": "<br><br> This will find all documents in the collection that match the specified example object. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to remove from. <li><em>example</em>: An example document that all collection documents are compared against. <li>options: an json object which can contains following attributes: <li><em>waitForSync</em>: if set to true, then all removal operations will instantly be synchronised to disk. If this is not specified, then the collection's default sync behavior will be applied. <li><em>limit</em>: an optional value that determines how many documents to delete at most. If <em>limit</em> is specified but is less than the number of documents in the collection, it is undefined which of the documents will be deleted. </ul> Note: the <em>limit</em> attribute is not supported on sharded collections. Using it will result in an error. The options attributes waitForSync and limit can given yet without an ecapsulation into a json object. but this may be deprecated in future versions of arango <br><br> Returns the number of documents that were deleted. <br><br>",
"summary": "removes documents by example",
"httpMethod": "PUT",
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"deleted\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"deleted\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Using Parameter: waitForSync and limit<br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } },\"waitForSync\": true, \"limit\": 2 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"deleted\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Using Parameter: waitForSync and limit with new signature<br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example\n{\"collection\": \"products\",\"example\" : { \"a\" : { \"j\" : 1 } },\"options\": {\"waitForSync\": true, \"limit\": 2} }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"deleted\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "removesDocumentsByExample"
}
],
@ -568,15 +568,15 @@
{
"errorResponses": [
{
"reason": "is returned if the query was executed successfully. ",
"reason": "is returned if the query was executed successfully. <br><br>",
"code": "200"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -586,13 +586,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"notes": "<br><br>This will find all documents in the collection that match the specified example object, and replace the entire document body with the new value specified. Note that document meta-attributes such as <em>_id</em>, <em>_key</em>, <em>_from</em>, <em>_to</em> etc. cannot be replaced. <br><br>The call expects a JSON object as body with the following attributes: <br><br>- <em>collection</em>: The name of the collection to replace within.<br><br>- <em>example</em>: An example document that all collection documents are compared against. <br><br>- <em>newValue</em>: The replacement document that will get inserted in place of the \"old\" documents. <br><br>- <em>waitForSync</em>: if set to true, then all removal operations will instantly be synchronised to disk. If this is not specified, then the collection's default sync behavior will be applied. <br><br>- <em>limit</em>: an optional value that determines how many documents to replace at most. If <em>limit</em> is specified but is less than the number of documents in the collection, it is undefined which of the documents will be replaced. <br><br>Note: the <em>limit</em> attribute is not supported on sharded collections. Using it will result in an error. <br><br>Returns the number of documents that were replaced. <br><br>",
"notes": "<br><br> This will find all documents in the collection that match the specified example object, and replace the entire document body with the new value specified. Note that document meta-attributes such as <em>_id</em>, <em>_key</em>, <em>_from</em>, <em>_to</em> etc. cannot be replaced. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to replace within. <li><em>example</em>: An example document that all collection documents are compared against. <li><em>newValue</em>: The replacement document that will get inserted in place of the \"old\" documents. <li><em>options</em>: an json object which can contain following attributes <li><em>waitForSync</em>: if set to true, then all removal operations will instantly be synchronised to disk. If this is not specified, then the collection's default sync behavior will be applied. <li><em>limit</em>: an optional value that determines how many documents to replace at most. If <em>limit</em> is specified but is less than the number of documents in the collection, it is undefined which of the documents will be replaced. </ul> Note: the <em>limit</em> attribute is not supported on sharded collections. Using it will result in an error. The options attributes waitForSync and limit can given yet without an ecapsulation into a json object. but this may be deprecated in future versions of arango <br><br> Returns the number of documents that were replaced. <br><br>",
"summary": "replaces documents by example",
"httpMethod": "PUT",
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/replace-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : {\"foo\" : \"bar\"}, \"limit\" : 3 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"replaced\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "<br><br><br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/replace-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : {\"foo\" : \"bar\"}, \"options\": {\"limit\" : 3, \"waitForSync\": true }}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"replaced\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>Using new Signature for attributes WaitForSync and limit<br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/replace-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : {\"foo\" : \"bar\"}, \"options\": {\"limit\" : 3, \"waitForSync\": true }}\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"replaced\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "replacesDocumentsByExample"
}
],
@ -603,15 +603,15 @@
{
"errorResponses": [
{
"reason": "is returned if the collection was updated successfully and <em>waitForSync</em> was <em>true</em>. ",
"reason": "is returned if the collection was updated successfully and <em>waitForSync</em> was <em>true</em>. <br><br>",
"code": "200"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. ",
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
"code": "400"
},
{
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. ",
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
"code": "404"
}
],
@ -621,13 +621,13 @@
"paramType": "body",
"required": "true",
"name": "query",
"description": "Contains the query. "
"description": "Contains the query. <br><br>"
}
],
"notes": "<br><br>This will find all documents in the collection that match the specified example object, and partially update the document body with the new value specified. Note that document meta-attributes such as <em>_id</em>, <em>_key</em>, <em>_from</em>, <em>_to</em> etc. cannot be replaced. <br><br>The call expects a JSON object as body with the following attributes: <br><br>- <em>collection</em>: The name of the collection to update within.<br><br>- <em>example</em>: An example document that all collection documents are compared against. <br><br>- <em>newValue</em>: A document containing all the attributes to update in the found documents. <br><br>- <em>keepNull</em>: This parameter can be used to modify the behavior when handling <em>null</em> values. Normally, <em>null</em> values are stored in the database. By setting the <em>keepNull</em> parameter to <em>false</em>, this behavior can be changed so that all attributes in <em>data</em> with <em>null</em> values will be removed from the updated document. <br><br>- <em>waitForSync</em>: if set to true, then all removal operations will instantly be synchronised to disk. If this is not specified, then the collection's default sync behavior will be applied. <br><br>- <em>limit</em>: an optional value that determines how many documents to update at most. If <em>limit</em> is specified but is less than the number of documents in the collection, it is undefined which of the documents will be updated. <br><br>Note: the <em>limit</em> attribute is not supported on sharded collections. Using it will result in an error. <br><br>Returns the number of documents that were updated. <br><br><br><br>",
"notes": "<br><br> This will find all documents in the collection that match the specified example object, and partially update the document body with the new value specified. Note that document meta-attributes such as <em>_id</em>, <em>_key</em>, <em>_from</em>, <em>_to</em> etc. cannot be replaced. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to update within. <li><em>example</em>: An example document that all collection documents are compared against. <li><em>newValue</em>: A document containing all the attributes to update in the found documents. <li><em>options</em>: a json object wich can contains following attributes: <li><em>keepNull</em>: This parameter can be used to modify the behavior when handling <em>null</em> values. Normally, <em>null</em> values are stored in the database. By setting the <em>keepNull</em> parameter to <em>false</em>, this behavior can be changed so that all attributes in <em>data</em> with <em>null</em> values will be removed from the updated document. <li><em>waitForSync</em>: if set to true, then all removal operations will instantly be synchronised to disk. If this is not specified, then the collection's default sync behavior will be applied. <li><em>limit</em>: an optional value that determines how many documents to update at most. If <em>limit</em> is specified but is less than the number of documents in the collection, it is undefined which of the documents will be updated. </ul> Note: the <em>limit</em> attribute is not supported on sharded collections. Using it will result in an error. <br><br> Returns the number of documents that were updated. <br><br> <br><br>",
"summary": "updates documents by example",
"httpMethod": "PUT",
"examples": "<br><br><pre><code class=\"json\" >unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/update-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : { \"a\" : { \"j\" : 22 } }, \"limit\" : 3 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"updated\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"examples": "using old syntax for options<br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/update-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : { \"a\" : { \"j\" : 22 } }, \"limit\" : 3 }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"updated\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>using new signature for options<br><br><pre><code class=\"json\">unix> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/update-by-example\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : { \"a\" : { \"j\" : 22 } }, \"options\" : { \"limit\" : 3, \"waitForSync\": true } }\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"updated\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n\n</code></pre><br>",
"nickname": "updatesDocumentsByExample"
}
],

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@
{
"errorResponses": [
{
"reason": "is returned in all cases. ",
"reason": "is returned in all cases. <br><br>",
"code": "200"
}
],
@ -16,14 +16,15 @@
{
"dataType": "Boolean",
"paramType": "query",
"required": "false",
"name": "details",
"description": "If set to <em>true</em>, the response will contain a <em>details</em> attribute with additional information about included components and their versions. The attribute names and internals of the <em>details</em> object may vary depending on platform and ArangoDB version. "
"description": "If set to <em>true</em>, the response will contain a <em>details</em> attribute with additional information about included components and their versions. The attribute names and internals of the <em>details</em> object may vary depending on platform and ArangoDB version. <br><br>"
}
],
"notes": "Returns the server name and version number. The response is a JSON object with the following attributes: <br><br>- <em>server</em>: will always contain <em>arango</em><br><br>- <em>version</em>: the server version string. The string has the format \"<em>major</em>.`minor<em>.`sub</em>\". <em>major</em> and <em>minor</em> will be numeric, and <em>sub</em> may contain a number or a textual version. <br><br>- <em>details</em>: an optional JSON object with additional details. This is returned only if the <em>details</em> URL parameter is set to <em>true</em> in the request. <br><br>",
"notes": "Returns the server name and version number. The response is a JSON object with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>server</em>: will always contain <em>arango</em> <li><em>version</em>: the server version string. The string has the format \"<em>major</em>.`minor<em>.`sub</em>\". <em>major</em> and <em>minor</em> will be numeric, and <em>sub</em> may contain a number or a textual version. <li><em>details</em>: an optional JSON object with additional details. This is returned only if the <em>details</em> URL parameter is set to <em>true</em> in the request.",
"summary": "returns the server version",
"httpMethod": "GET",
"examples": "Returns the version information. <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"server\" : \"arango\", \n \"version\" : \"2.0.0-rc1\" \n}\n\n</code></pre><br>Returns the version information with details. <br><br><pre><code class=\"json\" >unix> curl --dump - http://localhost:8529/_api/version?details=true\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"server\" : \"arango\", \n \"version\" : \"2.0.0-rc1\", \n \"details\" : { \n \"build-date\" : \"Mar 3 2014 14:05:01\", \n \"configure\" : \"'./configure' '--enable-relative' '--enable-all-in-one-v8' '--enable-all-in-one-...\", \n \"icu-version\" : \"52.1\", \n \"libev-version\" : \"4.11\", \n \"openssl-version\" : \"OpenSSL 1.0.1e 11 Feb 2013\", \n \"repository-version\" : \"heads/devel-0-gc82434c6a39ebd0be5a1f154ab8f9130a8028c38-dirty\", \n \"server-version\" : \"2.0.0-rc1\", \n \"sizeof int\" : \"4\", \n \"v8-version\" : \"3.16.14.1\" \n } \n}\n\n</code></pre><br>",
"examples": "<br><br> Returns the version information. <br><br><br><br><pre><code class=\"json\">unix> curl --dump - http://localhost:8529/_api/version\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"server\" : \"arango\", \n \"version\" : \"2.1.0-devel\" \n}\n\n</code></pre><br><br><br> Returns the version information with details. <br><br><br><br><pre><code class=\"json\">unix> curl --dump - http://localhost:8529/_api/version?details=true\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"server\" : \"arango\", \n \"version\" : \"2.1.0-devel\", \n \"details\" : { \n \"build-date\" : \"Jun 6 2014 15:25:47\", \n \"configure\" : \"'./configure' '--enable-all-in-one-icu'\", \n \"icu-version\" : \"49.1.2\", \n \"libev-version\" : \"4.11\", \n \"openssl-version\" : \"OpenSSL 0.9.8y 5 Feb 2013\", \n \"repository-version\" : \"heads/devel-0-gf5bbf94b043745ab45c9fe14bc8429b502bcfa3d-dirty\", \n \"server-version\" : \"2.1.0-devel\", \n \"sizeof int\" : \"4\", \n \"sizeof void*\" : \"8\", \n \"v8-version\" : \"3.16.14\" \n } \n}\n\n</code></pre><br>",
"nickname": "returnsTheServerVersion"
}
],

View File

@ -0,0 +1,82 @@
module.define("org/arangodb/is", function(exports, module) {
/*jslint indent: 2, nomen: true, maxlen: 100, white: true, plusplus: true, eqeq: true */
/*global require, exports */
////////////////////////////////////////////////////////////////////////////////
/// @brief Check if something is something
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler, Lucas Dohmen
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
// Check if a value is not undefined or null
var existy = function (x) {
"use strict";
// This is != on purpose to also check for undefined
return x != null;
};
// Check if a value is undefined or null
var notExisty = function (x) {
"use strict";
return !existy(x);
};
// Check if a value is existy and not false
var truthy = function (x) {
"use strict";
return (x !== false) && existy(x);
};
// Check if a value is not truthy
var falsy = function (x) {
"use strict";
return !truthy(x);
};
// is.object, is.noObject, is.array, is.noArray...
[
'Object',
'Array',
'Boolean',
'Date',
'Function',
'Number',
'String',
'RegExp'
].forEach(function(type) {
"use strict";
exports[type.toLowerCase()] = function(obj) {
return Object.prototype.toString.call(obj) === '[object '+type+']';
};
exports["no" + type] = function(obj) {
return Object.prototype.toString.call(obj) !== '[object '+type+']';
};
});
exports.existy = existy;
exports.notExisty = notExisty;
exports.truthy = truthy;
exports.falsy = falsy;
});

View File

@ -0,0 +1,504 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true, plusplus: true, unparam: true */
/*global require, applicationContext*/
////////////////////////////////////////////////////////////////////////////////
/// @brief A Foxx.Controller to show all Foxx Applications
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2013 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Michael Hackstein
/// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
(function() {
"use strict";
var FoxxController = require("org/arangodb/foxx").Controller,
controller = new FoxxController(applicationContext),
ArangoError = require("org/arangodb").ArangoError,
actions = require("org/arangodb/actions"),
Model = require("org/arangodb/foxx").Model,
Graph = require("org/arangodb/general-graph"),
errors = require("internal").errors,
toId = function(c, k) {
return c + "/" + k;
},
_ = require("underscore"),
setResponse = function (res, name, body, code) {
var obj = {};
obj.error = false;
obj.code = code || actions.HTTP_OK;
if (name !== undefined && body !== undefined) {
obj[name] = body;
if (body._rev) {
res.set("etag", body._rev);
}
}
res.json(obj);
if (code) {
res.status(code);
}
},
setGraphResponse = function(res, g, code) {
code = code || actions.HTTP_OK;
setResponse(res, "graph", {
name: g.__name,
edgeDefinitions: g.__edgeDefinitions
}, code);
};
/** Create a new vertex.
*
* Stores a new vertex with the information contained
* within the body into the given collection.
*/
controller.post("/:graph/vertex/:collection", function(req, res) {
var name = req.params("graph");
var collection = req.params("collection");
var body = req.params("vertex");
var g = Graph._graph(name);
setResponse(res, "vertex", g[collection].save(body.forDB()));
})
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.pathParam("collection", {
type: "string",
description: "Name of the vertex collection."
})
.bodyParam("vertex", "The document to be stored", Model);
/** Load a vertex.
*
* Loads a vertex with the given id if it is contained
* within your graph.
*/
controller.get("/:graph/vertex/:collection/:key", function(req, res) {
var name = req.params("graph");
var collection = req.params("collection");
var key = req.params("key");
var id = toId(collection, key);
var g = Graph._graph(name);
setResponse(res, "vertex", g[collection].document(id));
})
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.pathParam("collection", {
type: "string",
description: "Name of the vertex collection."
})
.pathParam("key", {
type: "string",
description: "_key attribute of one specific vertex."
})
.errorResponse(
ArangoError, actions.HTTP_NOT_FOUND, "The vertex does not exist.", function(e) {
return {
code: actions.HTTP_NOT_FOUND,
error: e.errorMessage
};
}
);
/** Replace a vertex.
*
* Replaces a vertex with the given id by the content in the body.
* This will only run successfully if the vertex is contained
* within the graph.
*/
controller.put("/:graph/vertex/:collection/:key", function(req, res) {
var name = req.params("graph");
var collection = req.params("collection");
var key = req.params("key");
var id = toId(collection, key);
var body = req.params("vertex");
var g = Graph._graph(name);
setResponse(res, "vertex", g[collection].replace(id, body.forDB()));
})
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.pathParam("collection", {
type: "string",
description: "Name of the vertex collection."
})
.pathParam("key", {
type: "string",
description: "_key attribute of one specific vertex."
})
.bodyParam("vertex", "The document to be stored", Model)
.errorResponse(
ArangoError, actions.HTTP_NOT_FOUND, "The vertex does not exist.", function(e) {
return {
code: actions.HTTP_NOT_FOUND,
error: e.errorMessage
};
}
);
/** Update a vertex.
*
* Updates a vertex with the given id by adding the content in the body.
* This will only run successfully if the vertex is contained
* within the graph.
*/
controller.patch("/:graph/vertex/:collection/:key", function(req, res) {
var name = req.params("graph");
var collection = req.params("collection");
var key = req.params("key");
var id = toId(collection, key);
var body = req.params("vertex");
var g = Graph._graph(name);
setResponse(res, "vertex", g[collection].update(id, body.forDB()));
})
.bodyParam("vertex", "The values that should be modified", Model)
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.pathParam("collection", {
type: "string",
description: "Name of the vertex collection."
})
.pathParam("key", {
type: "string",
description: "_key attribute of one specific vertex."
})
.errorResponse(
ArangoError, actions.HTTP_NOT_FOUND, "The vertex does not exist.", function(e) {
return {
code: actions.HTTP_NOT_FOUND,
error: e.errorMessage
};
}
);
/** Delete a vertex.
*
* Deletes a vertex with the given id, if it is contained
* within the graph.
* Furthermore all edges connected to this vertex will be deleted.
*/
controller.del("/:graph/vertex/:collection/:key", function(req, res) {
var name = req.params("graph");
var collection = req.params("collection");
var key = req.params("key");
var id = toId(collection, key);
var g = Graph._graph(name);
setResponse(res, "vertex", g[collection].remove(id));
})
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.pathParam("collection", {
type: "string",
description: "Name of the vertex collection."
})
.pathParam("key", {
type: "string",
description: "_key attribute of one specific vertex."
})
.errorResponse(
ArangoError, actions.HTTP_NOT_FOUND, "The vertex does not exist.", function(e) {
return {
code: actions.HTTP_NOT_FOUND,
error: e.errorMessage
};
}
);
///////////////////////////////////////////////// Edges //////////
/** Create a new edge definition.
*
* Stores a new edge definition with the information contained
* within the body.
* This has to contain the edge-collection name, as well as set of from and to
* collections-names respectively.
*/
controller.post("/:graph/edge", function(req, res) {
var name = req.params("graph");
var body = req.params("edgeDefinition");
var g = Graph._graph(name);
g._extendEdgeDefinitions(body.forDB());
setGraphResponse(res, g);
})
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.bodyParam(
"edgeDefinition", "The edge definition to be stored.", Model
)
.errorResponse(
ArangoError, actions.HTTP_BAD, "The edge definition is invalid.", function(e) {
return {
code: actions.HTTP_BAD,
error: e.errorMessage
};
}
);
/** Create a new edge.
*
* Stores a new edge with the information contained
* within the body into the given collection.
*/
controller.post("/:graph/edge/:collection", function(req, res) {
var name = req.params("graph");
var collection = req.params("collection");
var body = req.params("edge");
var from = body.get("_from");
var to = body.get("_to");
var err;
if (!from || !to) {
err = new ArangoError();
err.errorNum = errors.ERROR_GRAPH_INVALID_EDGE.code;
err.errorMessage = errors.ERROR_GRAPH_INVALID_EDGE.message;
throw err;
}
var g = Graph._graph(name);
setResponse(res, "edge", g[collection].save(from, to, body.forDB()));
})
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.pathParam("collection", {
type: "string",
description: "Name of the edge collection."
})
.bodyParam(
"edge", "The edge to be stored. Has to contain _from and _to attributes.", Model
)
.errorResponse(
ArangoError, actions.HTTP_BAD_REQUEST, "The edge could not be created.", function(e) {
return {
code: actions.HTTP_BAD_REQUEST,
error: e.errorMessage
};
}
);
/** Load an edge.
*
* Loads an edge with the given id if it is contained
* within your graph.
*/
controller.get("/:graph/edge/:collection/:key", function(req, res) {
var name = req.params("graph");
var collection = req.params("collection");
var key = req.params("key");
var id = toId(collection, key);
var g = Graph._graph(name);
setResponse(res, "edge", g[collection].document(id));
})
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.pathParam("collection", {
type: "string",
description: "Name of the edge collection."
})
.pathParam("key", {
type: "string",
description: "_key attribute of one specific edge."
})
.errorResponse(
ArangoError, actions.HTTP_NOT_FOUND, "The edge does not exist.", function(e) {
return {
code: actions.HTTP_NOT_FOUND,
error: e.errorMessage
};
}
);
/** Replace an edge.
*
* Replaces an edge with the given id by the content in the body.
* This will only run successfully if the edge is contained
* within the graph.
*/
controller.put("/:graph/edge/:collection/:key", function(req, res) {
var name = req.params("graph");
var collection = req.params("collection");
var key = req.params("key");
var id = toId(collection, key);
var body = req.params("edge");
var g = Graph._graph(name);
setResponse(res, "edge", g[collection].replace(id, body.forDB()));
})
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.pathParam("collection", {
type: "string",
description: "Name of the edge collection."
})
.pathParam("key", {
type: "string",
description: "_key attribute of one specific edge."
})
.bodyParam("edge", "The document to be stored. _from and _to attributes are ignored", Model)
.errorResponse(
ArangoError, actions.HTTP_NOT_FOUND, "The edge does not exist.", function(e) {
return {
code: actions.HTTP_NOT_FOUND,
error: e.errorMessage
};
}
);
/** Update an edge.
*
* Updates an edge with the given id by adding the content in the body.
* This will only run successfully if the edge is contained
* within the graph.
*/
controller.patch("/:graph/edge/:collection/:key", function(req, res) {
var name = req.params("graph");
var collection = req.params("collection");
var key = req.params("key");
var id = toId(collection, key);
var body = req.params("edge");
var g = Graph._graph(name);
setResponse(res, "edge", g[collection].update(id, body.forDB()));
})
.bodyParam(
"edge", "The values that should be modified. _from and _to attributes are ignored", Model
)
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.pathParam("collection", {
type: "string",
description: "Name of the edge collection."
})
.pathParam("key", {
type: "string",
description: "_key attribute of one specific edge."
})
.errorResponse(
ArangoError, actions.HTTP_NOT_FOUND, "The edge does not exist.", function(e) {
return {
code: actions.HTTP_NOT_FOUND,
error: e.errorMessage
};
}
);
/** Delete an edge.
*
* Deletes an edge with the given id, if it is contained
* within the graph.
*/
controller.del("/:graph/edge/:collection/:key", function(req, res) {
var name = req.params("graph");
var collection = req.params("collection");
var key = req.params("key");
var id = toId(collection, key);
var g = Graph._graph(name);
setResponse(res, "edge", g[collection].remove(id));
})
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.pathParam("collection", {
type: "string",
description: "Name of the edge collection."
})
.pathParam("key", {
type: "string",
description: "_key attribute of one specific edge."
})
.errorResponse(
ArangoError, actions.HTTP_NOT_FOUND, "The edge does not exist.", function(e) {
return {
code: actions.HTTP_NOT_FOUND,
error: e.errorMessage
};
}
);
///////////////// GRAPH /////////////////////////////////
/** Creates a new graph
*
* Creates a new graph object
*/
controller.post("/", function(req, res) {
var infos = req.params("graph");
var g = Graph._create(infos.get("name"), infos.get("edgeDefinitions"));
setGraphResponse(res, g, actions.HTTP_CREATED);
}).errorResponse(
ArangoError, actions.HTTP_CONFLICT, "Graph creation error.", function(e) {
return {
code: actions.HTTP_CONFLICT,
error: e.errorMessage
};
}
).bodyParam("graph", "The required information for a graph", Model);
/** Drops an existing graph
*
* Drops an existing graph object by name.
* By default all collections not used by other graphs will be dropped as
* well. It can be optionally configured to not drop the collections.
*/
controller.del("/:graph", function(req, res) {
var name = req.params("graph");
Graph._drop(name);
setResponse(res);
})
.pathParam("graph", {
type: "string",
description: "Name of the graph."
})
.errorResponse(
ArangoError, actions.HTTP_NOT_FOUND, "The graph does not exist.", function(e) {
return {
code: actions.HTTP_NOT_FOUND,
error: e.errorMessage
};
}
);
}());
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
/// Local Variables:
/// mode: outline-minor
/// outline-regexp: "/// @brief\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\|/\\*jslint"
/// End:

View File

@ -0,0 +1,16 @@
{
"name": "gharial",
"description": "ArangoDB Graph Module",
"author": "Michael Hackstein",
"version": "0.1",
"isSystem": true,
"controllers": {
"/": "gharial.js"
},
"defaultDocument": "",
"lib": "."
}