The general pattern to get relationships is:
GET http://localhost:7474/db/data/node/123/relationships/{dir}/{-list|&|types}
Where dir
is one of all
, in
, out
and types
is an ampersand-separated list of types.
See the examples below for more information.
Example request
POST
http://localhost:7474/db/data/node/3/relationships
Accept:
application/json
Content-Type:
application/json
{"to" : "http://localhost:7474/db/data/node/4", "type" : "LOVES"}
Example response
201:
Created
Content-Type:
application/json
Location:
http://localhost:7474/db/data/relationship/2
{ "start" : "http://localhost:7474/db/data/node/3", "data" : { }, "self" : "http://localhost:7474/db/data/relationship/2", "property" : "http://localhost:7474/db/data/relationship/2/properties/{key}", "properties" : "http://localhost:7474/db/data/relationship/2/properties", "type" : "LOVES", "extensions" : { "FunctionalTestPlugin" : { "methodOnRelationship" : "http://localhost:7474/db/data/ext/FunctionalTestPlugin/relationship/2/methodOnRelationship" } }, "end" : "http://localhost:7474/db/data/node/4" }
Example request
GET
http://localhost:7474/db/data/node/6/relationships/all
Accept:
application/json
Example response
200:
OK
Content-Type:
application/json
[ { "start" : "http://localhost:7474/db/data/node/6", "data" : { }, "self" : "http://localhost:7474/db/data/relationship/3", "property" : "http://localhost:7474/db/data/relationship/3/properties/{key}", "properties" : "http://localhost:7474/db/data/relationship/3/properties", "type" : "LIKES", "extensions" : { "FunctionalTestPlugin" : { "methodOnRelationship" : "http://localhost:7474/db/data/ext/FunctionalTestPlugin/relationship/3/methodOnRelationship" } }, "end" : "http://localhost:7474/db/data/node/7" }, { "start" : "http://localhost:7474/db/data/node/8", "data" : { }, "self" : "http://localhost:7474/db/data/relationship/4", "property" : "http://localhost:7474/db/data/relationship/4/properties/{key}", "properties" : "http://localhost:7474/db/data/relationship/4/properties", "type" : "LIKES", "extensions" : { "FunctionalTestPlugin" : { "methodOnRelationship" : "http://localhost:7474/db/data/ext/FunctionalTestPlugin/relationship/4/methodOnRelationship" } }, "end" : "http://localhost:7474/db/data/node/6" }, { "start" : "http://localhost:7474/db/data/node/6", "data" : { }, "self" : "http://localhost:7474/db/data/relationship/5", "property" : "http://localhost:7474/db/data/relationship/5/properties/{key}", "properties" : "http://localhost:7474/db/data/relationship/5/properties", "type" : "HATES", "extensions" : { "FunctionalTestPlugin" : { "methodOnRelationship" : "http://localhost:7474/db/data/ext/FunctionalTestPlugin/relationship/5/methodOnRelationship" } }, "end" : "http://localhost:7474/db/data/node/9" } ]
Example request
GET
http://localhost:7474/db/data/node/11/relationships/in
Accept:
application/json
Example response
200:
OK
Content-Type:
application/json
[ { "start" : "http://localhost:7474/db/data/node/13", "data" : { }, "self" : "http://localhost:7474/db/data/relationship/7", "property" : "http://localhost:7474/db/data/relationship/7/properties/{key}", "properties" : "http://localhost:7474/db/data/relationship/7/properties", "type" : "LIKES", "extensions" : { "FunctionalTestPlugin" : { "methodOnRelationship" : "http://localhost:7474/db/data/ext/FunctionalTestPlugin/relationship/7/methodOnRelationship" } }, "end" : "http://localhost:7474/db/data/node/11" } ]
Example request
GET
http://localhost:7474/db/data/node/16/relationships/out
Accept:
application/json
Example response
200:
OK
Content-Type:
application/json
[ { "start" : "http://localhost:7474/db/data/node/16", "data" : { }, "self" : "http://localhost:7474/db/data/relationship/9", "property" : "http://localhost:7474/db/data/relationship/9/properties/{key}", "properties" : "http://localhost:7474/db/data/relationship/9/properties", "type" : "LIKES", "extensions" : { "FunctionalTestPlugin" : { "methodOnRelationship" : "http://localhost:7474/db/data/ext/FunctionalTestPlugin/relationship/9/methodOnRelationship" } }, "end" : "http://localhost:7474/db/data/node/17" }, { "start" : "http://localhost:7474/db/data/node/16", "data" : { }, "self" : "http://localhost:7474/db/data/relationship/11", "property" : "http://localhost:7474/db/data/relationship/11/properties/{key}", "properties" : "http://localhost:7474/db/data/relationship/11/properties", "type" : "HATES", "extensions" : { "FunctionalTestPlugin" : { "methodOnRelationship" : "http://localhost:7474/db/data/ext/FunctionalTestPlugin/relationship/11/methodOnRelationship" } }, "end" : "http://localhost:7474/db/data/node/19" } ]
Note that the "&
" needs to be escaped for example when using
cURL from the terminal.
Example request
GET
http://localhost:7474/db/data/node/21/relationships/all/LIKES&HATES
Accept:
application/json
Example response
200:
OK
Content-Type:
application/json
[ { "start" : "http://localhost:7474/db/data/node/21", "data" : { }, "self" : "http://localhost:7474/db/data/relationship/12", "property" : "http://localhost:7474/db/data/relationship/12/properties/{key}", "properties" : "http://localhost:7474/db/data/relationship/12/properties", "type" : "LIKES", "extensions" : { "FunctionalTestPlugin" : { "methodOnRelationship" : "http://localhost:7474/db/data/ext/FunctionalTestPlugin/relationship/12/methodOnRelationship" } }, "end" : "http://localhost:7474/db/data/node/22" }, { "start" : "http://localhost:7474/db/data/node/23", "data" : { }, "self" : "http://localhost:7474/db/data/relationship/13", "property" : "http://localhost:7474/db/data/relationship/13/properties/{key}", "properties" : "http://localhost:7474/db/data/relationship/13/properties", "type" : "LIKES", "extensions" : { "FunctionalTestPlugin" : { "methodOnRelationship" : "http://localhost:7474/db/data/ext/FunctionalTestPlugin/relationship/13/methodOnRelationship" } }, "end" : "http://localhost:7474/db/data/node/21" }, { "start" : "http://localhost:7474/db/data/node/21", "data" : { }, "self" : "http://localhost:7474/db/data/relationship/14", "property" : "http://localhost:7474/db/data/relationship/14/properties/{key}", "properties" : "http://localhost:7474/db/data/relationship/14/properties", "type" : "HATES", "extensions" : { "FunctionalTestPlugin" : { "methodOnRelationship" : "http://localhost:7474/db/data/ext/FunctionalTestPlugin/relationship/14/methodOnRelationship" } }, "end" : "http://localhost:7474/db/data/node/24" } ]
Copyright © 2011 Neo Technology