ArangoDB v3.10 reached End of Life (EOL) and is no longer supported.
This documentation is outdated. Please see the most recent stable version.
HTTP interface for named graphs
The HTTP API for named graphs lets you manage General Graphs, SmartGraphs, EnterpriseGraphs, and SatelliteGraphs
The HTTP API for named graphs is called Gharial.
You can manage all types of ArangoDB’s named graphs with Gharial:
The examples use the following example graphs:
Management
List all graphs
200 OK
Is returned if the module is available and the graphs can be listed.
graphs* array of objects
A list of all named graphs.
graph object
The properties of the named graph.
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object
Examples
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial
Show output
HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 623
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 200,
"graphs" : [
{
"_id" : "_graphs/social",
"_key" : "social",
"_rev" : "_holfdE---_",
"edgeDefinitions" : [
{
"collection" : "relation",
"from" : [
"female",
"male"
],
"to" : [
"female",
"male"
]
}
],
"orphanCollections" : [ ],
"name" : "social"
},
{
"_id" : "_graphs/routeplanner",
"_key" : "routeplanner",
"_rev" : "_holfdEO--_",
"edgeDefinitions" : [
{
"collection" : "frenchHighway",
"from" : [
"frenchCity"
],
"to" : [
"frenchCity"
]
},
{
"collection" : "germanHighway",
"from" : [
"germanCity"
],
"to" : [
"germanCity"
]
},
{
"collection" : "internationalHighway",
"from" : [
"frenchCity",
"germanCity"
],
"to" : [
"frenchCity",
"germanCity"
]
}
],
"orphanCollections" : [ ],
"name" : "routeplanner"
}
]
}
Create a graph
options object
a JSON object to define options for creating collections within this graph. It can contain the following attributes:
writeConcern integer
Write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
201 Created
Is returned if the graph can be created and
waitForSync
is enabled for the_graphs
collection, or given in the request. The response body contains the graph configuration that has been stored.graph* object
The information about the newly created graph.
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object202 Accepted
Is returned if the graph can be created and
waitForSync
is disabled for the_graphs
collection and not given in the request. The response body contains the graph configuration that has been stored.graph* object
The information about the newly created graph.
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object
Examples
Create a General Graph. This graph type does not make use of any sharding strategy and is useful on the single server.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial
{
"name": "myGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
]
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 227
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdG6--_
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "myGraph",
"edgeDefinitions" : [
{
"collection" : "edges",
"from" : [
"startVertices"
],
"to" : [
"endVertices"
]
}
],
"orphanCollections" : [ ],
"_rev" : "_holfdG6--_",
"_id" : "_graphs/myGraph",
"name" : "myGraph"
}
}
Create a SmartGraph. This graph uses 9 shards and is sharded by the “region” attribute. Available in the Enterprise Edition only.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial
{
"name": "smartGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
],
"orphanCollections": [
"orphanVertices"
],
"isSmart": true,
"options": {
"replicationFactor": 2,
"numberOfShards": 9,
"smartGraphAttribute": "region"
}
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 465
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdHa--A
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "smartGraph",
"numberOfShards" : 9,
"replicationFactor" : 2,
"minReplicationFactor" : 1,
"writeConcern" : 1,
"isSmart" : true,
"isSatellite" : false,
"edgeDefinitions" : [
{
"collection" : "edges",
"from" : [
"startVertices"
],
"to" : [
"endVertices"
]
}
],
"orphanCollections" : [
"orphanVertices"
],
"initial" : "startVertices",
"initialCid" : 69414,
"smartGraphAttribute" : "region",
"isDisjoint" : false,
"_rev" : "_holfdHa--A",
"_id" : "_graphs/smartGraph",
"name" : "smartGraph"
}
}
Create a disjoint SmartGraph. This graph uses 9 shards and is sharded by the “region” attribute. Available in the Enterprise Edition only. Note that as you are using a disjoint version, you can only create edges between vertices sharing the same region.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial
{
"name": "disjointSmartGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
],
"orphanCollections": [
"orphanVertices"
],
"isSmart": true,
"options": {
"isDisjoint": true,
"replicationFactor": 2,
"numberOfShards": 9,
"smartGraphAttribute": "region"
}
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 488
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdIq--A
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "disjointSmartGraph",
"numberOfShards" : 9,
"replicationFactor" : 2,
"minReplicationFactor" : 1,
"writeConcern" : 1,
"isSmart" : true,
"isSatellite" : false,
"edgeDefinitions" : [
{
"collection" : "edges",
"from" : [
"startVertices"
],
"to" : [
"endVertices"
]
}
],
"orphanCollections" : [
"orphanVertices"
],
"initial" : "startVertices",
"initialCid" : 69468,
"smartGraphAttribute" : "region",
"isDisjoint" : true,
"_rev" : "_holfdIq--A",
"_id" : "_graphs/disjointSmartGraph",
"name" : "disjointSmartGraph"
}
}
Create a SmartGraph with a satellite vertex collection. It uses the collection “endVertices” as a satellite collection. This collection is cloned to all servers, all other vertex collections are split into 9 shards and are sharded by the “region” attribute. Available in the Enterprise Edition only.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial
{
"name": "smartGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
],
"orphanCollections": [
"orphanVertices"
],
"isSmart": true,
"options": {
"replicationFactor": 2,
"numberOfShards": 9,
"smartGraphAttribute": "region",
"satellites": [
"endVertices"
]
}
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 465
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdJi--_
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "smartGraph",
"numberOfShards" : 9,
"replicationFactor" : 2,
"minReplicationFactor" : 1,
"writeConcern" : 1,
"isSmart" : true,
"isSatellite" : false,
"edgeDefinitions" : [
{
"collection" : "edges",
"from" : [
"startVertices"
],
"to" : [
"endVertices"
]
}
],
"orphanCollections" : [
"orphanVertices"
],
"initial" : "startVertices",
"initialCid" : 69522,
"smartGraphAttribute" : "region",
"isDisjoint" : false,
"_rev" : "_holfdJi--_",
"_id" : "_graphs/smartGraph",
"name" : "smartGraph"
}
}
Create an EnterpriseGraph. This graph uses 9 shards, it does not make use of specific sharding attributes. Available in the Enterprise Edition only.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial
{
"name": "enterpriseGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
],
"orphanCollections": [],
"isSmart": true,
"options": {
"replicationFactor": 2,
"numberOfShards": 9
}
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 433
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdKe--A
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "enterpriseGraph",
"numberOfShards" : 9,
"replicationFactor" : 2,
"minReplicationFactor" : 1,
"writeConcern" : 1,
"isSmart" : true,
"isSatellite" : false,
"edgeDefinitions" : [
{
"collection" : "edges",
"from" : [
"startVertices"
],
"to" : [
"endVertices"
]
}
],
"orphanCollections" : [ ],
"initial" : "startVertices",
"initialCid" : 69576,
"isDisjoint" : false,
"_rev" : "_holfdKe--A",
"_id" : "_graphs/enterpriseGraph",
"name" : "enterpriseGraph"
}
}
Create a SatelliteGraph. A SatelliteGraph does not use shards, but uses “satellite” as replicationFactor. Make sure to keep this graph small as it is cloned to every server. Available in the Enterprise Edition only.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial
{
"name": "satelliteGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
],
"orphanCollections": [],
"options": {
"replicationFactor": "satellite"
}
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 379
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdM---_
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "satelliteGraph",
"numberOfShards" : 1,
"replicationFactor" : "satellite",
"isSmart" : false,
"isSatellite" : true,
"edgeDefinitions" : [
{
"collection" : "edges",
"from" : [
"startVertices"
],
"to" : [
"endVertices"
]
}
],
"orphanCollections" : [ ],
"initial" : "startVertices",
"initialCid" : 69619,
"_rev" : "_holfdM---_",
"_id" : "_graphs/satelliteGraph",
"name" : "satelliteGraph"
}
}
Get a graph
200 OK
Returns the graph if it can be found. The result has the following format:
graph* object
The information about the newly created graph
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object
Examples
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/myGraph
Show output
HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 227
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 200,
"graph" : {
"_key" : "myGraph",
"edgeDefinitions" : [
{
"collection" : "edges",
"from" : [
"startVertices"
],
"to" : [
"endVertices"
]
}
],
"orphanCollections" : [ ],
"_rev" : "_holfdNS--_",
"_id" : "_graphs/myGraph",
"name" : "myGraph"
}
}
Drop a graph
Examples
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/social?dropCollections=true
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 41
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"removed" : true
}
List vertex collections
Examples
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/social/vertex
Show output
HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 58
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 200,
"collections" : [
"female",
"male"
]
}
Add a vertex collection
Adding a vertex collection on its own to a graph adds it as an orphan collection. If you want to use an additional vertex collection for graph relations, add it by adding a new edge definition or modifying an existing edge definition instead.
201 Created
Is returned if the collection can be created and
waitForSync
is enabled for the_graphs
collection, or given in the request. The response body contains the graph configuration that has been stored.graph* object
The information about the modified graph.
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object202 Accepted
Is returned if the collection can be created and
waitForSync
is disabled for the_graphs
collection, or given in the request. The response body contains the graph configuration that has been stored.graph* object
The information about the newly created graph
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object
Examples
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial/social/vertex
{
"collection": "otherVertices"
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 244
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdQm--_
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "social",
"edgeDefinitions" : [
{
"collection" : "relation",
"from" : [
"female",
"male"
],
"to" : [
"female",
"male"
]
}
],
"orphanCollections" : [
"otherVertices"
],
"_rev" : "_holfdQm--_",
"_id" : "_graphs/social",
"name" : "social"
}
}
Remove a vertex collection
Removes a vertex collection from the list of the graph’s orphan collections. It can optionally delete the collection if it is not used in any other graph.
You cannot remove vertex collections that are used in one of the edge definitions of the graph. You need to modify or remove the edge definition first in order to fully remove a vertex collection from the graph.
200 OK
Returned if the vertex collection was removed from the graph successfully and
waitForSync
istrue
.graph* object
The information about the newly created graph
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object202 Accepted
Returned if the request was successful but
waitForSync
isfalse
.graph* object
The information about the newly created graph
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object
Examples
You can remove vertex collections that are not used in any edge definition:
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/social/vertex/otherVertices
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 229
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdSu---
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "social",
"edgeDefinitions" : [
{
"collection" : "relation",
"from" : [
"female",
"male"
],
"to" : [
"female",
"male"
]
}
],
"orphanCollections" : [ ],
"_rev" : "_holfdSu---",
"_id" : "_graphs/social",
"name" : "social"
}
}
You cannot remove vertex collections that are used in edge definitions:
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/social/vertex/male
Show output
HTTP/1.1 400 Bad Request
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 106
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"code" : 400,
"error" : true,
"errorMessage" : "collection is not in list of orphan collections",
"errorNum" : 1928
}
List edge collections
Examples
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/social/edge
Show output
HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 53
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 200,
"collections" : [
"relation"
]
}
Add an edge definition
Adds an additional edge definition to the graph.
This edge definition has to contain a collection
and an array of
each from
and to
vertex collections. An edge definition can only
be added if this definition is either not used in any other graph, or
it is used with exactly the same definition. For example, it is not
possible to store a definition “e” from “v1” to “v2” in one graph, and
“e” from “v2” to “v1” in another graph, but both can have “e” from
“v1” to “v2”.
Additionally, collection creation options can be set.
201 Created
Returned if the definition can be added successfully and
waitForSync
is enabled for the_graphs
collection. The response body contains the graph configuration that has been stored.graph* object
The information about the modified graph.
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object202 Accepted
Returned if the definition can be added successfully and
waitForSync
is disabled for the_graphs
collection. The response body contains the graph configuration that has been stored.graph* object
The information about the modified graph.
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object
Examples
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial/social/edge
{
"collection": "works_in",
"from": [
"female",
"male"
],
"to": [
"city"
]
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 294
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdWK--_
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "social",
"edgeDefinitions" : [
{
"collection" : "relation",
"from" : [
"female",
"male"
],
"to" : [
"female",
"male"
]
},
{
"collection" : "works_in",
"from" : [
"female",
"male"
],
"to" : [
"city"
]
}
],
"orphanCollections" : [ ],
"_rev" : "_holfdWK--_",
"_id" : "_graphs/social",
"name" : "social"
}
}
Replace an edge definition
201 Created
Returned if the request was successful and
waitForSync
istrue
.graph* object
The information about the modified graph.
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object202 Accepted
Returned if the request was successful but
waitForSync
isfalse
.graph* object
The information about the modified graph.
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object
Examples
curl -X PUT --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial/social/edge/relation
{
"collection": "relation",
"from": [
"female",
"male",
"animal"
],
"to": [
"female",
"male",
"animal"
]
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 247
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdXe--_
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "social",
"edgeDefinitions" : [
{
"collection" : "relation",
"from" : [
"animal",
"female",
"male"
],
"to" : [
"animal",
"female",
"male"
]
}
],
"orphanCollections" : [ ],
"_rev" : "_holfdXe--_",
"_id" : "_graphs/social",
"name" : "social"
}
}
Remove an edge definition
201 Created
Returned if the edge definition can be removed from the graph and
waitForSync
istrue
.graph* object
The information about the modified graph.
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object202 Accepted
Returned if the edge definition can be removed from the graph and
waitForSync
isfalse
.graph* object
The information about the modified graph.
writeConcern integer
The default write concern for new collections in the graph. It determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of
writeConcern
cannot be greater thanreplicationFactor
. For SatelliteGraphs, thewriteConcern
is automatically controlled to equal the number of DB-Servers and the attribute is not available. (cluster only)
Response Body application/json object
Examples
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/social/edge/relation
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 171
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdZa---
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"graph" : {
"_key" : "social",
"edgeDefinitions" : [ ],
"orphanCollections" : [
"female",
"male"
],
"_rev" : "_holfdZa---",
"_id" : "_graphs/social",
"name" : "social"
}
}
Vertices
Create a vertex
Examples
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial/social/vertex/male
{
"name": "Francis"
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 92
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdae--A
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"vertex" : {
"_id" : "male/70344",
"_key" : "70344",
"_rev" : "_holfdae--A"
}
}
Get a vertex
Examples
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/social/vertex/female/alice
Show output
HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 109
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdbi---
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 200,
"vertex" : {
"_key" : "alice",
"_id" : "female/alice",
"_rev" : "_holfdbi---",
"name" : "Alice"
}
}
Update a vertex
keepNull boolean
Define if values set to
null
should be stored. By default (true
), the given documents attribute(s) are set tonull
. If this parameter is set tofalse
, top-level attribute and sub-attributes with anull
value in the request are removed from the document (but not attributes of objects that are nested inside of arrays).
Examples
curl -X PATCH --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial/social/vertex/female/alice
{
"age": 26
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 118
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdc6--_
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"vertex" : {
"_id" : "female/alice",
"_key" : "alice",
"_oldRev" : "_holfdcy---",
"_rev" : "_holfdc6--_"
}
}
Replace a vertex
keepNull boolean
Define if values set to
null
should be stored. By default (true
), the given documents attribute(s) are set tonull
. If this parameter is set tofalse
, top-level attribute and sub-attributes with anull
value in the request are removed from the document (but not attributes of objects that are nested inside of arrays).
Examples
curl -X PUT --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial/social/vertex/female/alice
{
"name": "Alice Cooper",
"age": 26
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 118
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdeS---
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"vertex" : {
"_id" : "female/alice",
"_key" : "alice",
"_oldRev" : "_holfdeK---",
"_rev" : "_holfdeS---"
}
}
Remove a vertex
Examples
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/social/vertex/female/alice
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 41
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"removed" : true
}
Edges
Create an edge
_from
and _to
value referencing to valid vertices in the graph.
Furthermore, the edge has to be valid according to the edge definitions.404 Not Found
Returned in any of the following cases:
- No graph with this name can be found.
- The edge collection is not part of the graph.
- The vertex collection referenced in the
_from
or_to
attribute is not part of the graph. - The vertex collection is part of the graph, but does not exist.
_from
or_to
vertex does not exist.
Response Body application/json object
Examples
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial/social/edge/relation
{
"type": "friend",
"_from": "female/alice",
"_to": "female/diana"
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 94
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdhe---
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"edge" : {
"_id" : "relation/70653",
"_key" : "70653",
"_rev" : "_holfdhe---"
}
}
Get an edge
Examples
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/social/edge/relation/70706
Show output
HTTP/1.1 200 OK
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 168
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdie--B
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 200,
"edge" : {
"_key" : "70706",
"_id" : "relation/70706",
"_from" : "female/alice",
"_to" : "male/bob",
"_rev" : "_holfdie--B",
"type" : "married",
"vertex" : "alice"
}
}
Update an edge
keepNull boolean
Define if values set to
null
should be stored. By default (true
), the given documents attribute(s) are set tonull
. If this parameter is set tofalse
, top-level attribute and sub-attributes with anull
value in the request are removed from the document (but not attributes of objects that are nested inside of arrays).
Examples
curl -X PATCH --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial/social/edge/relation/70770
{
"since": "01.01.2001"
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 118
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdkC---
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"edge" : {
"_id" : "relation/70770",
"_key" : "70770",
"_oldRev" : "_holfdk----",
"_rev" : "_holfdkC---"
}
}
Replace an edge
keepNull boolean
Define if values set to
null
should be stored. By default (true
), the given documents attribute(s) are set tonull
. If this parameter is set tofalse
, top-level attribute and sub-attributes with anull
value in the request are removed from the document (but not attributes of objects that are nested inside of arrays).
Examples
curl -X PUT --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/gharial/social/edge/relation/70834
{
"type": "divorced",
"_from": "female/alice",
"_to": "male/bob"
}
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 118
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _holfdla---
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"edge" : {
"_id" : "relation/70834",
"_key" : "70834",
"_oldRev" : "_holfdlW--A",
"_rev" : "_holfdla---"
}
}
Remove an edge
Examples
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/gharial/social/edge/relation/70896
Show output
HTTP/1.1 202 Accepted
content-type: application/json
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
connection: Keep-Alive
content-length: 41
content-security-policy: frame-ancestors 'self'; form-action 'self';
expires: 0
pragma: no-cache
server: ArangoDB
strict-transport-security: max-age=31536000 ; includeSubDomains
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"removed" : true
}