{
"basePath": "/",
"swaggerVersion": "1.1",
"apiVersion": "0.1",
"apis": [
{
"operations": [
{
"errorResponses": [
{
"reason": "is returned if the edge was created successfully and waitForSync was true.
",
"code": "201"
},
{
"reason": "is returned if the edge was created successfully and waitForSync was false.
",
"code": "202"
},
{
"reason": "is returned if the body does not contain a valid JSON representation of an edge, or if the collection specified is not an edge collection. The response body contains an error document in this case.
",
"code": "400"
},
{
"reason": "is returned if the collection specified by collection is unknown. The response body contains an error document in this case.
",
"code": "404"
}
],
"parameters": [
{
"dataType": "Json",
"paramType": "body",
"required": true,
"name": "edge-document",
"description": "A JSON representation of the edge document must be passed as the body of the POST request. This JSON object may contain the edge's document key in the _key attribute if needed.
"
},
{
"dataType": "String",
"paramType": "query",
"required": true,
"name": "collection",
"description": "Creates a new edge in the collection identified by collection name.
"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": false,
"name": "createCollection",
"description": "If this parameter has a value of true or yes, then the collection is created if it does not yet exist. Other values will be ignored so the collection must be present for the operation to succeed.
Note: This flag is not supported in a cluster. Using it will result in an error.
"
},
{
"dataType": "Boolean",
"paramType": "query",
"required": false,
"name": "waitForSync",
"description": "Wait until the edge document has been synced to disk.
"
},
{
"dataType": "String",
"paramType": "query",
"required": true,
"name": "from",
"description": "The document handle of the start point must be passed in from handle.
"
},
{
"dataType": "String",
"paramType": "query",
"required": true,
"name": "to",
"description": "The document handle of the end point must be passed in to handle.
"
}
],
"notes": "Creates a new edge document in the collection named collection. A JSON representation of the document must be passed as the body of the POST request.
The from and to handles are immutable once the edge has been created.
In all other respects the method works like POST /document.
",
"summary": "Create edge",
"httpMethod": "POST",
"examples": "
Create an edge and read it back:
shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/edge/?collection=edges&from=vertices/1&to=vertices/2 <<EOF\n{ \n \"name\" : \"Emil\" \n}\nEOF\n\nHTTP/1.1 202 Accepted\ncontent-type: application/json; charset=utf-8\netag: \"1641882677\"\nlocation: /_db/_system/_api/document/edges/1641882677\n\n{ \n \"error\" : false, \n \"_id\" : \"edges/1641882677\", \n \"_rev\" : \"1641882677\", \n \"_key\" : \"1641882677\" \n}\nshell> curl --dump - http://localhost:8529/_api/edge/edges/1641882677\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\netag: \"1641882677\"\n\n{ \n \"name\" : \"Emil\", \n \"_id\" : \"edges/1641882677\", \n \"_rev\" : \"1641882677\", \n \"_key\" : \"1641882677\", \n \"_from\" : \"vertices/1\", \n \"_to\" : \"vertices/2\" \n}\n