HTTP interface for edges
The Edge API lets you retrieve the connected edges of a single vertex, optionally restricted to incoming or outgoing edges
You can use the general Document API to create,
read, modify, and delete edge documents. The only difference to working with
vertex documents is that the _from
and _to
attributes are mandatory and
must contain document identifiers.
The Edge API is useful if you want to look up the inbound and outbound edges of
a vertex with low overhead. You can also retrieve edges with AQL queries, but
queries need to be parsed and planned, and thus have an overhead. On the other
hand, AQL is far more powerful, letting you perform graph traversals, for
instance.
Addresses of edges
Edges are a special variation of documents and you can access them like any
document. See Addresses of documents
for details.
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.
Header Parameters
- x-arango-allow-dirty-read (boolean, optional):
Set this header to
true
to allow the Coordinator to ask any shard replica for
the data, not only the shard leader. This may result in “dirty reads”.
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
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: 606
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
{
"edges" : [
{
"_key" : "5",
"_id" : "edges/5",
"_from" : "vertices/1",
"_to" : "vertices/3",
"_rev" : "_fyvN-yW--_",
"$label" : "v1 -> v3"
},
{
"_key" : "6",
"_id" : "edges/6",
"_from" : "vertices/2",
"_to" : "vertices/1",
"_rev" : "_fyvN-yW--A",
"$label" : "v2 -> v1"
},
{
"_key" : "7",
"_id" : "edges/7",
"_from" : "vertices/4",
"_to" : "vertices/1",
"_rev" : "_fyvN-ya---",
"$label" : "v4 -> v1"
}
],
"error" : false,
"code" : 200,
"stats" : {
"writesExecuted" : 0,
"writesIgnored" : 0,
"scannedFull" : 0,
"scannedIndex" : 3,
"cursorsCreated" : 2,
"cursorsRearmed" : 0,
"cacheHits" : 0,
"cacheMisses" : 0,
"filtered" : 0,
"httpRequests" : 0,
"executionTime" : 0.00041898898780345917,
"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
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: 606
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
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
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: 492
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
{
"edges" : [
{
"_key" : "6",
"_id" : "edges/6",
"_from" : "vertices/2",
"_to" : "vertices/1",
"_rev" : "_fyvN-z---_",
"$label" : "v2 -> v1"
},
{
"_key" : "7",
"_id" : "edges/7",
"_from" : "vertices/4",
"_to" : "vertices/1",
"_rev" : "_fyvN-z---A",
"$label" : "v4 -> v1"
}
],
"error" : false,
"code" : 200,
"stats" : {
"writesExecuted" : 0,
"writesIgnored" : 0,
"scannedFull" : 0,
"scannedIndex" : 2,
"cursorsCreated" : 1,
"cursorsRearmed" : 0,
"cacheHits" : 0,
"cacheMisses" : 0,
"filtered" : 0,
"httpRequests" : 0,
"executionTime" : 0.00016756681725382805,
"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
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: 492
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
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
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: 382
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
{
"edges" : [
{
"_key" : "5",
"_id" : "edges/5",
"_from" : "vertices/1",
"_to" : "vertices/3",
"_rev" : "_fyvN-ze--B",
"$label" : "v1 -> v3"
}
],
"error" : false,
"code" : 200,
"stats" : {
"writesExecuted" : 0,
"writesIgnored" : 0,
"scannedFull" : 0,
"scannedIndex" : 1,
"cursorsCreated" : 1,
"cursorsRearmed" : 0,
"cacheHits" : 0,
"cacheMisses" : 0,
"filtered" : 0,
"httpRequests" : 0,
"executionTime" : 0.00014914898201823235,
"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
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: 382
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
Show response body