ArangoDB v3.8 reached End of Life (EOL) and is no longer supported.
This documentation is outdated. Please see the most recent version at docs.arangodb.com
Working with Edges using REST
This is documentation to ArangoDB’s
REST interface for edges.
Edges are documents with two additional attributes: _from and _to.
These attributes are mandatory and must contain the document-handle
of the from and to vertices of an edge.
Use the general document
REST api
for create/read/update/delete.
Read in- or outbound edges
get edges
GET /_api/edges/{collection-id}
Path Parameters
- collection-id (string, required):
The id of the collection.
Query Parameters
-
vertex (string, required):
The id of the start vertex.
-
direction (string, optional):
Selects in or out direction for edges. If not set, any edges are
returned.
Returns an array of edges starting or ending in the vertex identified by
vertex.
Responses
HTTP 200: is returned if the edge collection was found and edges were retrieved.
HTTP 400: is returned if the request contains invalid parameters.
HTTP 404: is returned if the edge collection was not found.
Examples
Any direction
shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1
HTTP/1.1 200 OK
content-type: application/json
connection: Keep-Alive
content-length: 538
server: ArangoDB
x-content-type-options: nosniff
{
"edges" : [
{
"_key" : "5",
"_id" : "edges/5",
"_from" : "vertices/1",
"_to" : "vertices/3",
"_rev" : "_fw2YvMa--D",
"$label" : "v1 -> v3"
},
{
"_key" : "6",
"_id" : "edges/6",
"_from" : "vertices/2",
"_to" : "vertices/1",
"_rev" : "_fw2YvMa--E",
"$label" : "v2 -> v1"
},
{
"_key" : "7",
"_id" : "edges/7",
"_from" : "vertices/4",
"_to" : "vertices/1",
"_rev" : "_fw2YvMa--F",
"$label" : "v4 -> v1"
}
],
"error" : false,
"code" : 200,
"stats" : {
"writesExecuted" : 0,
"writesIgnored" : 0,
"scannedFull" : 0,
"scannedIndex" : 3,
"filtered" : 0,
"httpRequests" : 0,
"executionTime" : 0.00024189200030377833,
"peakMemoryUsage" : 32768
}
}
Hide response body
shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1
HTTP/1.1 200 OK
content-type: application/json
connection: Keep-Alive
content-length: 538
server: ArangoDB
x-content-type-options: nosniff
Show response body
In edges
shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=in
HTTP/1.1 200 OK
content-type: application/json
connection: Keep-Alive
content-length: 423
server: ArangoDB
x-content-type-options: nosniff
{
"edges" : [
{
"_key" : "6",
"_id" : "edges/6",
"_from" : "vertices/2",
"_to" : "vertices/1",
"_rev" : "_fw2YvMu---",
"$label" : "v2 -> v1"
},
{
"_key" : "7",
"_id" : "edges/7",
"_from" : "vertices/4",
"_to" : "vertices/1",
"_rev" : "_fw2YvMu--_",
"$label" : "v4 -> v1"
}
],
"error" : false,
"code" : 200,
"stats" : {
"writesExecuted" : 0,
"writesIgnored" : 0,
"scannedFull" : 0,
"scannedIndex" : 2,
"filtered" : 0,
"httpRequests" : 0,
"executionTime" : 0.0001371770003970596,
"peakMemoryUsage" : 0
}
}
Hide response body
shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=in
HTTP/1.1 200 OK
content-type: application/json
connection: Keep-Alive
content-length: 423
server: ArangoDB
x-content-type-options: nosniff
Show response body
Out edges
shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=out
HTTP/1.1 200 OK
content-type: application/json
connection: Keep-Alive
content-length: 314
server: ArangoDB
x-content-type-options: nosniff
{
"edges" : [
{
"_key" : "5",
"_id" : "edges/5",
"_from" : "vertices/1",
"_to" : "vertices/3",
"_rev" : "_fw2YvM6--E",
"$label" : "v1 -> v3"
}
],
"error" : false,
"code" : 200,
"stats" : {
"writesExecuted" : 0,
"writesIgnored" : 0,
"scannedFull" : 0,
"scannedIndex" : 1,
"filtered" : 0,
"httpRequests" : 0,
"executionTime" : 0.00010410000049887458,
"peakMemoryUsage" : 0
}
}
Hide response body
shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/edges/edges?vertex=vertices/1&direction=out
HTTP/1.1 200 OK
content-type: application/json
connection: Keep-Alive
content-length: 314
server: ArangoDB
x-content-type-options: nosniff
Show response body