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:
Social Graph:

Knows Graph:

Management
List all graphs
GET
/_db/{database-name}/_api/gharial
Lists all graphs stored in this database.
Path Parameters
database-name*
string
The name of the database.
Responses
200
OK
Is returned if the module is available and the graphs can be listed.
Examples
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial'
Show outputHTTP/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" : "_jJdpG8u--_",
"edgeDefinitions" : [
{
"collection" : "relation",
"from" : [
"female",
"male"
],
"to" : [
"female",
"male"
]
}
],
"orphanCollections" : [ ],
"name" : "social"
},
{
"_id" : "_graphs/routeplanner",
"_key" : "routeplanner",
"_rev" : "_jJdpG9i---",
"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
POST
/_db/{database-name}/_api/gharial
The creation of a graph requires the name of the graph and a
definition of its edges.
Path Parameters
database-name*
string
The name of the database.
Query Parameters
waitForSync
boolean
Define if the request should wait until everything is synced to disk.
Changes the success HTTP response status code.
Request Body application/json object
edgeDefinitions
array of objects
An array of definitions for the relations of the graph.
Each has the following type:
collection*
string
Name of the edge collection, where the edges are stored in.
from*
array of strings
List of vertex collection names.
Edges in collection can only be inserted if their _from is in any of the collections here.
to*
array of strings
List of vertex collection names.
Edges in collection can only be inserted if their _to is in any of the collections here.
isDisjoint
boolean
Whether to create a Disjoint SmartGraph instead of a regular SmartGraph
(Enterprise Edition only).
isSmart
boolean
Define if the created graph should be smart (Enterprise Edition only).
name*
string
options
object
a JSON object to define options for creating collections within this graph.
It can contain the following attributes:
numberOfShards*
integer
The number of shards that is used for every collection within this graph.
Cannot be modified later.
replicationFactor*
integer
The replication factor used when initially creating collections for this graph.
Can be set to "satellite"
to create a SatelliteGraph, which then ignores
numberOfShards
, minReplicationFactor
, and writeConcern
(Enterprise Edition only).
satellites
array of strings
An array of collection names that is used to create SatelliteCollections
for a (Disjoint) SmartGraph using SatelliteCollections (Enterprise Edition only).
Each array element must be a string and a valid collection name.
The collection type cannot be modified later.
smartGraphAttribute
string
Only has effect in Enterprise Edition and it is required if isSmart is true.
The attribute name that is used to smartly shard the vertices of a graph.
Every vertex in this SmartGraph has to have this attribute.
Cannot be modified later.
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 than replicationFactor
.
For SatelliteGraphs, the writeConcern
is automatically controlled to equal the
number of DB-Servers and the attribute is not available. (cluster only)
orphanCollections
array of strings
An array of additional vertex collections.
Documents in these collections do not have edges within this graph.
Responses
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.
202
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.
400
Bad Request
Returned if the request is in a wrong format.
403
Forbidden
Returned if your user has insufficient rights.
In order to create a graph, you need to have at least the following privileges:
Administrate
access on the database.Read Only
access on every collection used within this graph.
409
Conflict
Returned if there is a conflict storing the graph. This can occur
either if a graph with this name already exists, or if there is an
edge definition with the same edge collection but different from
and to
vertex collections in any other graph.
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": [
"startVertices"
],
"to": [
"endVertices"
]
}
]
}
EOF
Show outputHTTP/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: _jJdpH_K---
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" : "_jJdpH_K---",
"_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' <<'EOF'
{
"name": "smartGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
],
"orphanCollections": [
"orphanVertices"
],
"isSmart": true,
"options": {
"replicationFactor": 2,
"numberOfShards": 9,
"smartGraphAttribute": "region"
}
}
EOF
Show outputHTTP/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: 446
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _jJdpH_i--_
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",
"smartGraphAttribute" : "region",
"isDisjoint" : false,
"_rev" : "_jJdpH_i--_",
"_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' <<'EOF'
{
"name": "disjointSmartGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
],
"orphanCollections": [
"orphanVertices"
],
"isSmart": true,
"options": {
"isDisjoint": true,
"replicationFactor": 2,
"numberOfShards": 9,
"smartGraphAttribute": "region"
}
}
EOF
Show outputHTTP/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: 469
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _jJdpHAu--_
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",
"smartGraphAttribute" : "region",
"isDisjoint" : true,
"_rev" : "_jJdpHAu--_",
"_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' <<'EOF'
{
"name": "smartGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
],
"orphanCollections": [
"orphanVertices"
],
"isSmart": true,
"options": {
"replicationFactor": 2,
"numberOfShards": 9,
"smartGraphAttribute": "region",
"satellites": [
"endVertices"
]
}
}
EOF
Show outputHTTP/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: 446
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _jJdpHBu--_
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",
"smartGraphAttribute" : "region",
"isDisjoint" : false,
"_rev" : "_jJdpHBu--_",
"_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' <<'EOF'
{
"name": "enterpriseGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
],
"orphanCollections": [],
"isSmart": true,
"options": {
"replicationFactor": 2,
"numberOfShards": 9
}
}
EOF
Show outputHTTP/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: 414
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _jJdpHCa---
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",
"isDisjoint" : false,
"_rev" : "_jJdpHCa---",
"_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' <<'EOF'
{
"name": "satelliteGraph",
"edgeDefinitions": [
{
"collection": "edges",
"from": [
"startVertices"
],
"to": [
"endVertices"
]
}
],
"orphanCollections": [],
"options": {
"replicationFactor": "satellite"
}
}
EOF
Show outputHTTP/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: 360
content-security-policy: frame-ancestors 'self'; form-action 'self';
etag: _jJdpHDi--_
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",
"_rev" : "_jJdpHDi--_",
"_id" : "_graphs/satelliteGraph",
"name" : "satelliteGraph"
}
}
Get a graph
GET
/_db/{database-name}/_api/gharial/{graph}
Selects information for a given graph.
Returns the edge definitions as well as the orphan collections,
or returns an error if the graph does not exist.
Path Parameters
database-name*
string
The name of the database.
graph*
string
Responses
200
OK
Returns the graph if it can be found.
The result has the following format:
404
Not Found
Returned if no graph with this name can be found.
Examples
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/myGraph'
Show outputHTTP/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" : "_jJdpHEy--_",
"_id" : "_graphs/myGraph",
"name" : "myGraph"
}
}
Drop a graph
DELETE
/_db/{database-name}/_api/gharial/{graph}
Drops an existing graph object by name.
Optionally all collections not used by other graphs
can be dropped as well.
Path Parameters
database-name*
string
The name of the database.
graph*
string
Query Parameters
dropCollections
boolean
Drop the collections of this graph as well. Collections are only
dropped if they are not used in other graphs.
Responses
202
Accepted
Is returned if the graph can be dropped.
403
Forbidden
Returned if your user has insufficient rights.
In order to drop a graph, you need to have at least the following privileges:
Administrate
access on the database.
404
Not Found
Returned if no graph with this name can be found.
Examples
curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social?dropCollections=true'
Show outputHTTP/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
GET
/_db/{database-name}/_api/gharial/{graph}/vertex
Lists all vertex collections within this graph, including orphan collections.
Path Parameters
database-name*
string
The name of the database.
graph*
string
Responses
200
OK
Is returned if the collections can be listed.
404
Not Found
Returned if no graph with this name can be found.
Examples
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social/vertex'
Show outputHTTP/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.
POST
/_db/{database-name}/_api/gharial/{graph}/vertex
Adds a vertex collection to the set of orphan collections of the graph.
If the collection does not exist, it is created.
Path Parameters
database-name*
string
The name of the database.
graph*
string
Request Body application/json object
collection*
string
The name of the vertex collection to add to the graph definition.
options
object
A JSON object to set options for creating vertex collections.
satellites
array of strings
An array of collection names that is used to create SatelliteCollections
for a (Disjoint) SmartGraph using SatelliteCollections (Enterprise Edition only).
Each array element must be a string and a valid collection name.
The collection type cannot be modified later.
Responses
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.
202
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.
400
Bad Request
Returned if the request is in an invalid format.
403
Forbidden
Returned if your user has insufficient rights.
In order to modify a graph, you need to have at least the following privileges:
Administrate
access on the database.Read Only
access on every collection used within this graph.
404
Not Found
Returned if no graph with this name can be found.
Examples
curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial/social/vertex' <<'EOF'
{
"collection": "otherVertices"
}
EOF
Show outputHTTP/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: _jJdpHIG--_
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" : "_jJdpHIG--_",
"_id" : "_graphs/social",
"name" : "social"
}
}
Remove a vertex collection
DELETE
/_db/{database-name}/_api/gharial/{graph}/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.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the vertex collection.
Query Parameters
dropCollection
boolean
Drop the collection in addition to removing it from the graph.
The collection is only dropped if it is not used in other graphs.
Responses
200
OK
Returned if the vertex collection was removed from the graph successfully
and waitForSync
is true
.
202
Accepted
Returned if the request was successful but waitForSync
is false
.
400
Bad Request
Returned if the vertex collection is still used in an edge definition.
In this case it cannot be removed from the graph yet, it has to be
removed from the edge definition first.
403
Forbidden
Returned if your user has insufficient rights.
In order to drop a vertex, you need to have at least the following privileges:
Administrate
access on the database.
404
Not Found
Returned if no graph with this name can be found.
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 outputHTTP/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: _jJdpHK----
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" : "_jJdpHK----",
"_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 outputHTTP/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
GET
/_db/{database-name}/_api/gharial/{graph}/edge
Lists all edge collections within this graph.
Path Parameters
database-name*
string
The name of the database.
graph*
string
Responses
200
OK
Is returned if the edge definitions can be listed.
404
Not Found
Returned if no graph with this name can be found.
Examples
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social/edge'
Show outputHTTP/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
POST
/_db/{database-name}/_api/gharial/{graph}/edge
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.
Path Parameters
database-name*
string
The name of the database.
graph*
string
Request Body application/json object
collection*
string
The name of the edge collection to be used.
from*
array of strings
One or many vertex collections that can contain source vertices.
options
object
A JSON object to set options for creating collections within this
edge definition.
satellites
array of strings
An array of collection names that is used to create SatelliteCollections
for a (Disjoint) SmartGraph using SatelliteCollections (Enterprise Edition only).
Each array element must be a string and a valid collection name.
The collection type cannot be modified later.
to*
array of strings
One or many vertex collections that can contain target vertices.
Responses
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.
202
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.
400
Bad Request
Returned if the edge definition can not be added.
This can be because it is ill-formed, or if there is an
edge definition with the same edge collection but different from
and to
vertex collections in any other graph.
403
Forbidden
Returned if your user has insufficient rights.
In order to modify a graph, you need to have at least the following privileges:
Administrate
access on the database.
404
Not Found
Returned if no graph with this name can be found.
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 outputHTTP/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: _jJdpHNC--_
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" : "_jJdpHNC--_",
"_id" : "_graphs/social",
"name" : "social"
}
}
Replace an edge definition
PUT
/_db/{database-name}/_api/gharial/{graph}/edge/{collection}
Change the vertex collections of one specific edge definition.
This modifies all occurrences of this definition in all graphs known to your database.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the edge collection used in the edge definition.
Query Parameters
waitForSync
boolean
Define if the request should wait until synced to disk.
dropCollections
boolean
Drop the edge collection in addition to removing it from the graph.
The collection is only dropped if it is not used in other graphs.
Request Body application/json object
collection*
string
The name of the edge collection to modify.
from*
array of strings
One or many vertex collections that can contain source vertices.
options
object
A JSON object to set options for modifying collections within this
edge definition.
satellites
array of strings
An array of collection names that is used to create SatelliteCollections
for a (Disjoint) SmartGraph using SatelliteCollections (Enterprise Edition only).
Each array element must be a string and a valid collection name.
The collection type cannot be modified later.
to*
array of strings
One or many vertex collections that can contain target vertices.
Responses
201
Created
Returned if the request was successful and waitForSync
is true
.
202
Accepted
Returned if the request was successful but waitForSync
is false
.
400
Bad Request
Returned if the new edge definition is ill-formed and cannot be used.
403
Forbidden
Returned if your user has insufficient rights.
In order to drop a vertex, you need to have at least the following privileges:
Administrate
access on the database.
404
Not Found
Returned if no graph with this name can be found, or if no edge definition
with this name is found in the graph.
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 outputHTTP/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: _jJdpHOq--_
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" : "_jJdpHOq--_",
"_id" : "_graphs/social",
"name" : "social"
}
}
Remove an edge definition
DELETE
/_db/{database-name}/_api/gharial/{graph}/edge/{collection}
Remove one edge definition from the graph. This only removes the
edge collection from the graph definition. The vertex collections of the
edge definition become orphan collections but otherwise remain untouched
and can still be used in your queries.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the edge collection used in the edge definition.
Query Parameters
waitForSync
boolean
Define if the request should wait until synced to disk.
dropCollections
boolean
Drop the edge collection in addition to removing it from the graph.
The collection is only dropped if it is not used in other graphs.
Responses
201
Created
Returned if the edge definition can be removed from the graph
and waitForSync
is true
.
202
Accepted
Returned if the edge definition can be removed from the graph and
waitForSync
is false
.
403
Forbidden
Returned if your user has insufficient rights.
In order to drop a vertex, you need to have at least the following privileges:
Administrate
access on the database.
404
Not Found
Returned if no graph with this name can be found,
or if no edge definition with this name is found in the graph.
Examples
curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social/edge/relation'
Show outputHTTP/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: _jJdpHPy--_
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" : "_jJdpHPy--_",
"_id" : "_graphs/social",
"name" : "social"
}
}
Vertices
Create a vertex
POST
/_db/{database-name}/_api/gharial/{graph}/vertex/{collection}
Adds a vertex to the given collection.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the vertex collection the vertex should be inserted into.
Query Parameters
waitForSync
boolean
Define if the request should wait until synced to disk.
returnNew
boolean
Define if the response should contain the complete
new version of the document.
Request Body application/json object
vertex*
object
The body has to be the JSON object to be stored.
Responses
201
Created
Returned if the vertex can be added and waitForSync
is true
.
202
Accepted
Returned if the request was successful but waitForSync
is false
.
403
Forbidden
Returned if your user has insufficient rights.
In order to insert vertices into the graph, you need to have at least the following privileges:
Read Only
access on the database.Write
access on the given collection.
404
Not Found
The graph cannot be found or the collection is not part of the graph.
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.
410
Gone
This error occurs if you try to run this operation as part of a
Stream Transaction that has just been canceled or timed out.
Examples
curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial/social/vertex/male' <<'EOF'
{
"name": "Francis"
}
EOF
Show outputHTTP/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: _jJdpHRi---
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/71153",
"_key" : "71153",
"_rev" : "_jJdpHRi---"
}
}
Get a vertex
GET
/_db/{database-name}/_api/gharial/{graph}/vertex/{collection}/{vertex}
Gets a vertex from the given collection.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the vertex collection the vertex belongs to.
vertex*
string
The _key
attribute of the vertex.
Query Parameters
rev
string
Must contain a revision.
If this is set a document is only returned if
it has exactly this revision.
Also see if-match header as an alternative to this.
Responses
200
OK
Returned if the vertex can be found.
304
Not Modified
Returned if the if-none-match header is given and the
currently stored vertex still has this revision value.
So there was no update between the last time the vertex
was fetched by the caller.
403
Forbidden
Returned if your user has insufficient rights.
In order to update vertices in the graph, you need to have at least the following privileges:
Read Only
access on the database.Read Only
access on the given collection.
404
Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The vertex 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.
410
Gone
This error occurs if you try to run this operation as part of a
Stream Transaction that has just been canceled or timed out.
412
Precondition Failed
Returned if if-match header is given, but the stored documents revision is different.
Examples
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social/vertex/female/alice'
Show outputHTTP/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: _jJdpHSi---
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" : "_jJdpHSi---",
"name" : "Alice"
}
}
Update a vertex
PATCH
/_db/{database-name}/_api/gharial/{graph}/vertex/{collection}/{vertex}
Updates the data of the specific vertex in the collection.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the vertex collection the vertex belongs to.
vertex*
string
The _key
attribute of the vertex.
Query Parameters
waitForSync
boolean
Define if the request should wait until synced to disk.
keepNull
boolean
Define if values set to null
should be stored.
By default (true
), the given documents attribute(s) are set to null
.
If this parameter is set to false
, top-level attribute and sub-attributes with
a null
value in the request are removed from the document (but not attributes
of objects that are nested inside of arrays).
returnOld
boolean
Define if a presentation of the deleted document should
be returned within the response object.
returnNew
boolean
Define if a presentation of the new document should
be returned within the response object.
Request Body application/json object
vertex*
object
The body has to contain a JSON object containing exactly the attributes that should be overwritten, all other attributes remain unchanged.
Responses
200
OK
Returned if the vertex can be updated, and waitForSync
is true
.
202
Accepted
Returned if the request was successful, and waitForSync
is false
.
403
Forbidden
Returned if your user has insufficient rights.
In order to update vertices in the graph, you need to have at least the following privileges:
Read Only
access on the database.Write
access on the given collection.
404
Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The vertex 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.
410
Gone
This error occurs if you try to run this operation as part of a
Stream Transaction that has just been canceled or timed out.
412
Precondition Failed
Returned if if-match header is given, but the stored documents revision is different.
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 outputHTTP/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: _jJdpHTu--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" : "_jJdpHTm---",
"_rev" : "_jJdpHTu--A"
}
}
Replace a vertex
PUT
/_db/{database-name}/_api/gharial/{graph}/vertex/{collection}/{vertex}
Replaces the data of a vertex in the collection.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the vertex collection the vertex belongs to.
vertex*
string
The _key
attribute of the vertex.
Query Parameters
waitForSync
boolean
Define if the request should wait until synced to disk.
keepNull
boolean
Define if values set to null
should be stored.
By default (true
), the given documents attribute(s) are set to null
.
If this parameter is set to false
, top-level attribute and sub-attributes with
a null
value in the request are removed from the document (but not attributes
of objects that are nested inside of arrays).
returnOld
boolean
Define if a presentation of the deleted document should
be returned within the response object.
returnNew
boolean
Define if a presentation of the new document should
be returned within the response object.
Request Body application/json object
vertex*
object
The body has to be the JSON object to be stored.
Responses
200
OK
Returned if the vertex can be replaced, and waitForSync
is true
.
202
Accepted
Returned if the vertex can be replaced, and waitForSync
is false
.
403
Forbidden
Returned if your user has insufficient rights.
In order to replace vertices in the graph, you need to have at least the following privileges:
Read Only
access on the database.Write
access on the given collection.
404
Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The vertex 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.
410
Gone
This error occurs if you try to run this operation as part of a
Stream Transaction that has just been canceled or timed out.
412
Precondition Failed
Returned if if-match header is given, but the stored documents revision is different.
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 outputHTTP/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: _jJdpHU2---
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" : "_jJdpHUq---",
"_rev" : "_jJdpHU2---"
}
}
Remove a vertex
DELETE
/_db/{database-name}/_api/gharial/{graph}/vertex/{collection}/{vertex}
Removes a vertex from a collection of the named graph. Additionally removes all
incoming and outgoing edges of the vertex.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the vertex collection the vertex belongs to.
vertex*
string
The _key
attribute of the vertex.
Query Parameters
waitForSync
boolean
Define if the request should wait until synced to disk.
returnOld
boolean
Define if a presentation of the deleted document should
be returned within the response object.
Responses
200
OK
Returned if the vertex can be removed.
202
Accepted
Returned if the request was successful but waitForSync
is false
.
403
Forbidden
Returned if your user has insufficient rights.
In order to delete vertices in the graph, you need to have at least the following privileges:
Read Only
access on the database.Write
access on the given collection.
404
Not Found
Returned in the following cases:
- The graph cannot be found.
- The collection is not part of the graph.
- The vertex 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.
410
Gone
This error occurs if you try to run this operation as part of a
Stream Transaction that has just been canceled or timed out.
412
Precondition Failed
Returned if if-match header is given, but the stored documents revision is different.
Examples
curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social/vertex/female/alice'
Show outputHTTP/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
POST
/_db/{database-name}/_api/gharial/{graph}/edge/{collection}
Creates a new edge in the specified collection.
Within the body the edge has to contain a _from
and _to
value referencing to valid vertices in the graph.
Furthermore, the edge has to be valid according to the edge definitions.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the edge collection the edge belongs to.
Query Parameters
waitForSync
boolean
Define if the request should wait until synced to disk.
returnNew
boolean
Define if the response should contain the complete
new version of the document.
Request Body application/json object
_from*
string
The source vertex of this edge. Has to be valid within
the used edge definition.
_to*
string
The target vertex of this edge. Has to be valid within
the used edge definition.
Responses
201
Created
Returned if the edge can be created and waitForSync
is true
.
202
Accepted
Returned if the request was successful but waitForSync
is false
.
400
Bad Request
Returned if the input document is invalid.
This can for instance be the case if the _from
or _to
attribute is missing
or malformed.
403
Forbidden
Returned if your user has insufficient rights.
In order to insert edges into the graph, you need to have at least the following privileges:
Read Only
access on the database.Write
access on the given collection.
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 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.
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.
410
Gone
This error occurs if you try to run this operation as part of a
Stream Transaction that has just been canceled or timed out.
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 outputHTTP/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: _jJdpHXG---
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/71498",
"_key" : "71498",
"_rev" : "_jJdpHXG---"
}
}
Get an edge
GET
/_db/{database-name}/_api/gharial/{graph}/edge/{collection}/{edge}
Gets an edge from the given collection.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the edge collection the edge belongs to.
edge*
string
The _key
attribute of the edge.
Query Parameters
rev
string
Must contain a revision.
If this is set a document is only returned if
it has exactly this revision.
Also see if-match header as an alternative to this.
Responses
200
OK
Returned if the edge can be found.
304
Not Modified
Returned if the if-none-match header is given and the
currently stored edge still has this revision value.
So there was no update between the last time the edge
was fetched by the caller.
403
Forbidden
Returned if your user has insufficient rights.
In order to update vertices in the graph, you need to have at least the following privileges:
Read Only
access on the database.Read Only
access on the given collection.
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.
410
Gone
This error occurs if you try to run this operation as part of a
Stream Transaction that has just been canceled or timed out.
412
Precondition Failed
Returned if if-match header is given, but the stored documents revision is different.
Examples
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social/edge/relation/71558'
Show outputHTTP/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: _jJdpHYi--_
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" : "71558",
"_id" : "relation/71558",
"_from" : "female/alice",
"_to" : "male/bob",
"_rev" : "_jJdpHYi--_",
"type" : "married",
"vertex" : "alice"
}
}
Update an edge
PATCH
/_db/{database-name}/_api/gharial/{graph}/edge/{collection}/{edge}
Partially modify the data of the specific edge in the collection.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the edge collection the edge belongs to.
edge*
string
The _key
attribute of the vertex.
Query Parameters
waitForSync
boolean
Define if the request should wait until synced to disk.
keepNull
boolean
Define if values set to null
should be stored.
By default (true
), the given documents attribute(s) are set to null
.
If this parameter is set to false
, top-level attribute and sub-attributes with
a null
value in the request are removed from the document (but not attributes
of objects that are nested inside of arrays).
returnOld
boolean
Define if a presentation of the deleted document should
be returned within the response object.
returnNew
boolean
Define if a presentation of the new document should
be returned within the response object.
Request Body application/json object
edge*
object
The body has to contain a JSON object containing exactly the attributes that should be overwritten, all other attributes remain unchanged.
Responses
200
OK
Returned if the edge can be updated, and waitForSync
is false
.
202
Accepted
Returned if the request was successful but waitForSync
is false
.
403
Forbidden
Returned if your user has insufficient rights.
In order to update edges in the graph, you need to have at least the following privileges:
Read Only
access on the database.Write
access on the given collection.
404
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
vertex 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.
410
Gone
This error occurs if you try to run this operation as part of a
Stream Transaction that has just been canceled or timed out.
412
Precondition Failed
Returned if if-match header is given, but the stored documents revision is different.
Examples
curl -X PATCH --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial/social/edge/relation/71627' <<'EOF'
{
"since": "01.01.2001"
}
EOF
Show outputHTTP/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: _jJdpHZ2---
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/71627",
"_key" : "71627",
"_oldRev" : "_jJdpHZy--_",
"_rev" : "_jJdpHZ2---"
}
}
Replace an edge
PUT
/_db/{database-name}/_api/gharial/{graph}/edge/{collection}/{edge}
Replaces the data of an edge in the collection.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the edge collection the edge belongs to.
edge*
string
The _key
attribute of the vertex.
Query Parameters
waitForSync
boolean
Define if the request should wait until synced to disk.
keepNull
boolean
Define if values set to null
should be stored.
By default (true
), the given documents attribute(s) are set to null
.
If this parameter is set to false
, top-level attribute and sub-attributes with
a null
value in the request are removed from the document (but not attributes
of objects that are nested inside of arrays).
returnOld
boolean
Define if a presentation of the deleted document should
be returned within the response object.
returnNew
boolean
Define if a presentation of the new document should
be returned within the response object.
Request Body application/json object
_from*
string
The source vertex of this edge. Has to be valid within
the used edge definition.
_to*
string
The target vertex of this edge. Has to be valid within
the used edge definition.
Responses
201
Created
Returned if the request was successful but waitForSync
is true
.
202
Accepted
Returned if the request was successful but waitForSync
is false
.
403
Forbidden
Returned if your user has insufficient rights.
In order to replace edges in the graph, you need to have at least the following privileges:
Read Only
access on the database.Write
access on the given collection.
404
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
vertex 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.
410
Gone
This error occurs if you try to run this operation as part of a
Stream Transaction that has just been canceled or timed out.
412
Precondition Failed
Returned if if-match header is given, but the stored documents revision is different.
Examples
curl -X PUT --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/gharial/social/edge/relation/71702' <<'EOF'
{
"type": "divorced",
"_from": "female/alice",
"_to": "male/bob"
}
EOF
Show outputHTTP/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: _jJdpHbC---
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/71702",
"_key" : "71702",
"_oldRev" : "_jJdpHb---D",
"_rev" : "_jJdpHbC---"
}
}
Remove an edge
DELETE
/_db/{database-name}/_api/gharial/{graph}/edge/{collection}/{edge}
Removes an edge from an edge collection of the named graph. Any other edges
that directly reference this edge like a vertex are removed, too.
Path Parameters
database-name*
string
The name of the database.
graph*
string
collection*
string
The name of the edge collection the edge belongs to.
edge*
string
The _key
attribute of the edge.
Query Parameters
waitForSync
boolean
Define if the request should wait until synced to disk.
returnOld
boolean
Define if a presentation of the deleted document should
be returned within the response object.
Responses
200
OK
Returned if the edge can be removed.
202
Accepted
Returned if the request was successful but waitForSync
is false
.
403
Forbidden
Returned if your user has insufficient rights.
In order to delete vertices in the graph, you need to have at least the following privileges:
Read Only
access on the database.Write
access on the given collection.
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.
410
Gone
This error occurs if you try to run this operation as part of a
Stream Transaction that has just been canceled or timed out.
412
Precondition Failed
Returned if if-match header is given, but the stored documents revision is different.
Examples
curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/gharial/social/edge/relation/71767'
Show outputHTTP/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
}