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" : "_j4Jf0M2---",
"edgeDefinitions" : [
{
"collection" : "relation",
"from" : [
"female",
"male"
],
"to" : [
"female",
"male"
]
}
],
"orphanCollections" : [ ],
"name" : "social"
},
{
"_id" : "_graphs/routeplanner",
"_key" : "routeplanner",
"_rev" : "_j4Jf0NK--_",
"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
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' <<'EOF'
{
"name": "myGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startNodes"
],
"to": [
"endNodes"
]
}
]
}
EOF
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: 221
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _kKbiiVK--_
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" : [
"startNodes"
],
"to" : [
"endNodes"
]
}
],
"orphanCollections" : [ ],
"_rev" : "_kKbiiVK--_",
"_id" : "_graphs/myGraph",
"name" : "myGraph"
}
}
Create a SmartGraph. This graph uses 9 shards and is sharded by the “region” attribute.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial' <<'EOF'
{
"name": "smartGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startNodes"
],
"to": [
"endNodes"
]
}
],
"orphanCollections": [
"orphanNodes"
],
"isSmart": true,
"options": {
"replicationFactor": 2,
"numberOfShards": 9,
"smartGraphAttribute": "region"
}
}
EOF
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: 434
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _kKbiiaC--_
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" : [
"startNodes"
],
"to" : [
"endNodes"
]
}
],
"orphanCollections" : [
"orphanNodes"
],
"initial" : "startNodes",
"smartGraphAttribute" : "region",
"isDisjoint" : false,
"_rev" : "_kKbiiaC--_",
"_id" : "_graphs/smartGraph",
"name" : "smartGraph"
}
}
Create a disjoint SmartGraph. This graph uses 9 shards and is sharded by the “region” attribute. Note that as you are using a disjoint version, you can only create edges between nodes sharing the same region.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial' <<'EOF'
{
"name": "disjointSmartGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startNodes"
],
"to": [
"endNodes"
]
}
],
"orphanCollections": [
"orphanNodes"
],
"isSmart": true,
"options": {
"isDisjoint": true,
"replicationFactor": 2,
"numberOfShards": 9,
"smartGraphAttribute": "region"
}
}
EOF
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: 457
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _kKbiieC--_
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" : [
"startNodes"
],
"to" : [
"endNodes"
]
}
],
"orphanCollections" : [
"orphanNodes"
],
"initial" : "startNodes",
"smartGraphAttribute" : "region",
"isDisjoint" : true,
"_rev" : "_kKbiieC--_",
"_id" : "_graphs/disjointSmartGraph",
"name" : "disjointSmartGraph"
}
}
Create a SmartGraph with a satellite node collection. It uses the collection “endNodes” as a satellite collection. This collection is cloned to all servers, all other node collections are split into 9 shards and are sharded by the “region” attribute.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial' <<'EOF'
{
"name": "smartGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startNodes"
],
"to": [
"endNodes"
]
}
],
"orphanCollections": [
"orphanNodes"
],
"isSmart": true,
"options": {
"replicationFactor": 2,
"numberOfShards": 9,
"smartGraphAttribute": "region",
"satellites": [
"endNodes"
]
}
}
EOF
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: 434
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _kKbiihq--_
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" : [
"startNodes"
],
"to" : [
"endNodes"
]
}
],
"orphanCollections" : [
"orphanNodes"
],
"initial" : "startNodes",
"smartGraphAttribute" : "region",
"isDisjoint" : false,
"_rev" : "_kKbiihq--_",
"_id" : "_graphs/smartGraph",
"name" : "smartGraph"
}
}
Create an EnterpriseGraph. This graph uses 9 shards, it does not make use of specific sharding attributes.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial' <<'EOF'
{
"name": "enterpriseGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startNodes"
],
"to": [
"endNodes"
]
}
],
"orphanCollections": [],
"isSmart": true,
"options": {
"replicationFactor": 2,
"numberOfShards": 9
}
}
EOF
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: 405
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _kKbiim---_
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" : [
"startNodes"
],
"to" : [
"endNodes"
]
}
],
"orphanCollections" : [ ],
"initial" : "startNodes",
"isDisjoint" : false,
"_rev" : "_kKbiim---_",
"_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.
curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial' <<'EOF'
{
"name": "satelliteGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startNodes"
],
"to": [
"endNodes"
]
}
],
"orphanCollections": [],
"options": {
"replicationFactor": "satellite"
}
}
EOF
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: 351
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _kKbiirK--_
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" : [
"startNodes"
],
"to" : [
"endNodes"
]
}
],
"orphanCollections" : [ ],
"initial" : "startNodes",
"_rev" : "_kKbiirK--_",
"_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: 221
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" : [
"startNodes"
],
"to" : [
"endNodes"
]
}
],
"orphanCollections" : [ ],
"_rev" : "_kKbiiwW--_",
"_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 node 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 node collection
Adding a node collection on its own to a graph adds it as an orphan collection. If you want to use an additional node 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' <<'EOF'
{
"collection": "otherNodes"
}
EOF
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: 241
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _kKbijMa---
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" : [
"otherNodes"
],
"_rev" : "_kKbijMa---",
"_id" : "_graphs/social",
"name" : "social"
}
}
Remove a node collection
Removes a node 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 node 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 node collection from the graph.
200 OK
Returned if the node 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 node collections that are not used in any edge definition:
curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social/vertex/otherNodes'
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: _kKbikCG---
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" : "_kKbikCG---",
"_id" : "_graphs/social",
"name" : "social"
}
}
You cannot remove node 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
node 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' <<'EOF'
{
"collection": "works_in",
"from": [
"female",
"male"
],
"to": [
"city"
]
}
EOF
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: _j4Jf0c6--_
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" : "_j4Jf0c6--_",
"_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' <<'EOF'
{
"collection": "relation",
"from": [
"female",
"male",
"animal"
],
"to": [
"female",
"male",
"animal"
]
}
EOF
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: _j4Jf0eO--_
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" : "_j4Jf0eO--_",
"_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: _j4Jf0fa--_
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" : "_j4Jf0fa--_",
"_id" : "_graphs/social",
"name" : "social"
}
}
Nodes
Create a node
- The body has to be a JSON object you want to store as a node document.
Examples
curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial/social/vertex/male' <<'EOF'
{
"name": "Francis"
}
EOF
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: _j4Jf0gi---
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/71465",
"_key" : "71465",
"_rev" : "_j4Jf0gi---"
}
}
Get a node
404 Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The node does not exist.
This error also occurs if you try to run this operation as part of a Stream Transaction but the transaction ID specified in the
x-arango-trx-id
header is unknown to the server.Response Body application/json object
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: _j4Jf0hW---
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" : "_j4Jf0hW---",
"name" : "Alice"
}
}
Update a node
keepNull boolean (default:
true
)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).
- The body has to be a JSON object containing exactly the attributes
that should be overwritten. All other attributes remain unchanged.
404 Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The node to update does not exist.
This error also occurs if you try to run this operation as part of a Stream Transaction but the transaction ID specified in the
x-arango-trx-id
header is unknown to the server.Response Body application/json object
Examples
curl -X PATCH --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial/social/vertex/female/alice' <<'EOF'
{
"age": 26
}
EOF
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: _j4Jf0i6--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" : "female/alice",
"_key" : "alice",
"_oldRev" : "_j4Jf0iy---",
"_rev" : "_j4Jf0i6--A"
}
}
Replace a node
keepNull boolean (default:
true
)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).
- The body has to be a JSON object you want to replace the existing
node document with.
404 Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The node to replace does not exist.
This error also occurs if you try to run this operation as part of a Stream Transaction but the transaction ID specified in the
x-arango-trx-id
header is unknown to the server.Response Body application/json object
Examples
curl -X PUT --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial/social/vertex/female/alice' <<'EOF'
{
"name": "Alice Cooper",
"age": 26
}
EOF
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: _j4Jf0ky--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" : "female/alice",
"_key" : "alice",
"_oldRev" : "_j4Jf0kq---",
"_rev" : "_j4Jf0ky--A"
}
}
Remove a node
404 Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The node to remove does not exist.
This error also occurs if you try to run this operation as part of a Stream Transaction but the transaction ID specified in the
x-arango-trx-id
header is unknown to the server.Response Body application/json object
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 nodes 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:
- The graph cannot be found.
- The edge collection is not part of the graph.
- The node collection referenced in the
_from
or_to
attribute is not part of the graph. - The node collection is part of the graph, but does not exist.
_from
or_to
node does not exist.
This error also occurs if you try to run this operation as part of a Stream Transaction but the transaction ID specified in the
x-arango-trx-id
header is unknown to the server.Response Body application/json object
Examples
curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial/social/edge/relation' <<'EOF'
{
"type": "friend",
"_from": "female/alice",
"_to": "female/diana"
}
EOF
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: _j4Jf0m6---
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/71810",
"_key" : "71810",
"_rev" : "_j4Jf0m6---"
}
}
Get an edge
404 Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The edge does not exist.
This error also occurs if you try to run this operation as part of a Stream Transaction but the transaction ID specified in the
x-arango-trx-id
header is unknown to the server.Response Body application/json object
Examples
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social/edge/relation/71872'
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: 170
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _j4Jf0n2--_
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" : "71872",
"_id" : "relation/71872",
"_from" : "female/alice",
"_to" : "male/charly",
"_rev" : "_j4Jf0n2--_",
"type" : "friend",
"vertex" : "alice"
}
}
Update an edge
keepNull boolean (default:
true
)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).
- The body has to be a JSON object containing exactly the attributes
that should be overwritten. All other attributes remain unchanged.
200 OK
Returned if the edge can be updated, and
waitForSync
isfalse
.Response Body application/json object202 Accepted
Returned if the request was successful but
waitForSync
isfalse
.Response Body application/json object404 Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The edge to update does not exist.
- Either
_from
or_to
node does not exist (if updated).
This error also occurs if you try to run this operation as part of a Stream Transaction but the transaction ID specified in the
x-arango-trx-id
header is unknown to the server.Response Body application/json object
Examples
curl -X PATCH --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial/social/edge/relation/71939' <<'EOF'
{
"since": "01.01.2001"
}
EOF
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: _j4Jf0pS---
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/71939",
"_key" : "71939",
"_oldRev" : "_j4Jf0pK--_",
"_rev" : "_j4Jf0pS---"
}
}
Replace an edge
keepNull boolean (default:
true
)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).
201 Created
Returned if the request was successful but
waitForSync
istrue
.Response Body application/json object202 Accepted
Returned if the request was successful but
waitForSync
isfalse
.Response Body application/json object404 Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The edge to replace does not exist.
- Either
_from
or_to
node does not exist.
This error also occurs if you try to run this operation as part of a Stream Transaction but the transaction ID specified in the
x-arango-trx-id
header is unknown to the server.Response Body application/json object
Examples
curl -X PUT --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial/social/edge/relation/72008' <<'EOF'
{
"type": "divorced",
"_from": "female/alice",
"_to": "male/bob"
}
EOF
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: _j4Jf0q6---
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/72008",
"_key" : "72008",
"_oldRev" : "_j4Jf0qS--_",
"_rev" : "_j4Jf0q6---"
}
}
Remove an edge
404 Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The edge to remove does not exist.
This error also occurs if you try to run this operation as part of a Stream Transaction but the transaction ID specified in the
x-arango-trx-id
header is unknown to the server.Response Body application/json object
Examples
curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social/edge/relation/72077'
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.001000
x-content-type-options: nosniff
{
"error" : false,
"code" : 202,
"removed" : true
}