shell> curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/traversal <<EOF
{
"startVertex" : "persons/alice",
"graphName" : "knows_graph",
"expander" : "var connections = [ ];if (vertex.name === \"Alice\") {config.datasource.getInEdges(vertex).forEach(function (e) {connections.push({ vertex: require(\"internal\").db._document(e._from), edge: e});});}if (vertex.name === \"Eve\") {config.datasource.getOutEdges(vertex).forEach(function (e) {connections.push({vertex: require(\"internal\").db._document(e._to), edge: e});});}return connections;"
}
EOF
HTTP/1.1 OK
content-type: application/json; charset=utf-8
x-content-type-options: nosniff
{
"result" : {
"visited" : {
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Y2g63ZK--_",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Y2g63ZO--D",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Y2g63ZK--B",
"name" : "Bob"
}
],
"paths" : [
{
"edges" : [ ],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Y2g63ZK--_",
"name" : "Alice"
}
]
},
{
"edges" : [
{
"_key" : "107557",
"_id" : "knows/107557",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Y2g63ZS--F",
"vertex" : "eve"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Y2g63ZK--_",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Y2g63ZO--D",
"name" : "Eve"
}
]
},
{
"edges" : [
{
"_key" : "107557",
"_id" : "knows/107557",
"_from" : "persons/eve",
"_to" : "persons/alice",
"_rev" : "_Y2g63ZS--F",
"vertex" : "eve"
},
{
"_key" : "107560",
"_id" : "knows/107560",
"_from" : "persons/eve",
"_to" : "persons/bob",
"_rev" : "_Y2g63ZS--H",
"vertex" : "eve"
}
],
"vertices" : [
{
"_key" : "alice",
"_id" : "persons/alice",
"_rev" : "_Y2g63ZK--_",
"name" : "Alice"
},
{
"_key" : "eve",
"_id" : "persons/eve",
"_rev" : "_Y2g63ZO--D",
"name" : "Eve"
},
{
"_key" : "bob",
"_id" : "persons/bob",
"_rev" : "_Y2g63ZK--B",
"name" : "Bob"
}
]
}
]
}
},
"error" : false,
"code" : 200
}