Example request
POST
http://localhost:7474/db/data/node/65/labels
Accept:
application/json
Content-Type:
application/json
"MyLabel"
Example response
204:
No Content
Example request
POST
http://localhost:7474/db/data/node/70/labels
Accept:
application/json
Content-Type:
application/json
[ "MyLabel", "MyOtherLabel" ]
Example response
204:
No Content
Labels with empty names are not allowed, however, all other valid strings are accepted as label names. Adding an invalid label to a node will lead to a HTTP 400 response.
Example request
POST
http://localhost:7474/db/data/node/77/labels
Accept:
application/json
Content-Type:
application/json
""
Example response
400:
Bad Request
Content-Type:
application/json
{ "message": "Unable to add label, see nested exception.", "exception": "BadInputException", "fullname": "org.neo4j.server.rest.repr.BadInputException", "stacktrace": [ "org.neo4j.server.rest.web.DatabaseActions.addLabelToNode(DatabaseActions.java:343)", "org.neo4j.server.rest.web.RestfulGraphDatabase.addNodeLabel(RestfulGraphDatabase.java:427)", "java.lang.reflect.Method.invoke(Method.java:597)" ], "cause": { "message": "Unable to add label.", "cause": { "message": "\u0027\u0027 is not a valid label name. Only non-empty strings are allowed.", "exception": "ConstraintViolationKernelException", "stacktrace": [ "org.neo4j.kernel.impl.api.ConstraintEvaluatingStatementContext.getOrCreateLabelId(ConstraintEvaluatingStatementContext.java:44)", "org.neo4j.kernel.impl.api.CompositeStatementContext.getOrCreateLabelId(CompositeStatementContext.java:384)", "org.neo4j.kernel.impl.api.CompositeStatementContext.getOrCreateLabelId(CompositeStatementContext.java:384)", "org.neo4j.kernel.impl.core.NodeProxy.addLabel(NodeProxy.java:325)", "org.neo4j.server.rest.web.DatabaseActions.addLabelToNode(DatabaseActions.java:337)", "org.neo4j.server.rest.web.RestfulGraphDatabase.addNodeLabel(RestfulGraphDatabase.java:427)", "java.lang.reflect.Method.invoke(Method.java:597)" ], "fullname": "org.neo4j.kernel.api.ConstraintViolationKernelException" }, "exception": "ConstraintViolationException", "stacktrace": [ "org.neo4j.kernel.impl.core.NodeProxy.addLabel(NodeProxy.java:329)", "org.neo4j.server.rest.web.DatabaseActions.addLabelToNode(DatabaseActions.java:337)", "org.neo4j.server.rest.web.RestfulGraphDatabase.addNodeLabel(RestfulGraphDatabase.java:427)", "java.lang.reflect.Method.invoke(Method.java:597)" ], "fullname": "org.neo4j.graphdb.ConstraintViolationException" } }
This removes any labels currently on a node, and replaces them with the labels passed in as the request body.
Example request
PUT
http://localhost:7474/db/data/node/66/labels
Accept:
application/json
Content-Type:
application/json
[ "MyOtherLabel", "MyThirdLabel" ]
Example response
204:
No Content
Example request
DELETE
http://localhost:7474/db/data/node/67/labels/MyLabel
Accept:
application/json
Example response
204:
No Content
Example request
GET
http://localhost:7474/db/data/node/69/labels
Accept:
application/json
Example response
200:
OK
Content-Type:
application/json
[ "Me", "You" ]
Example request
GET
http://localhost:7474/db/data/label/first/nodes
Accept:
application/json
Example response
200:
OK
Content-Type:
application/json
[ { "outgoing_relationships" : "http://localhost:7474/db/data/node/71/relationships/out", "labels" : "http://localhost:7474/db/data/node/71/labels", "data" : { "name" : "b" }, "all_typed_relationships" : "http://localhost:7474/db/data/node/71/relationships/all/{-list|&|types}", "traverse" : "http://localhost:7474/db/data/node/71/traverse/{returnType}", "self" : "http://localhost:7474/db/data/node/71", "property" : "http://localhost:7474/db/data/node/71/properties/{key}", "properties" : "http://localhost:7474/db/data/node/71/properties", "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/71/relationships/out/{-list|&|types}", "incoming_relationships" : "http://localhost:7474/db/data/node/71/relationships/in", "extensions" : { }, "create_relationship" : "http://localhost:7474/db/data/node/71/relationships", "paged_traverse" : "http://localhost:7474/db/data/node/71/paged/traverse/{returnType}{?pageSize,leaseTime}", "all_relationships" : "http://localhost:7474/db/data/node/71/relationships/all", "incoming_typed_relationships" : "http://localhost:7474/db/data/node/71/relationships/in/{-list|&|types}" }, { "outgoing_relationships" : "http://localhost:7474/db/data/node/73/relationships/out", "labels" : "http://localhost:7474/db/data/node/73/labels", "data" : { "name" : "a" }, "all_typed_relationships" : "http://localhost:7474/db/data/node/73/relationships/all/{-list|&|types}", "traverse" : "http://localhost:7474/db/data/node/73/traverse/{returnType}", "self" : "http://localhost:7474/db/data/node/73", "property" : "http://localhost:7474/db/data/node/73/properties/{key}", "properties" : "http://localhost:7474/db/data/node/73/properties", "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/73/relationships/out/{-list|&|types}", "incoming_relationships" : "http://localhost:7474/db/data/node/73/relationships/in", "extensions" : { }, "create_relationship" : "http://localhost:7474/db/data/node/73/relationships", "paged_traverse" : "http://localhost:7474/db/data/node/73/paged/traverse/{returnType}{?pageSize,leaseTime}", "all_relationships" : "http://localhost:7474/db/data/node/73/relationships/all", "incoming_typed_relationships" : "http://localhost:7474/db/data/node/73/relationships/in/{-list|&|types}" } ]
You can retrieve all nodes with a given label and property by passing one property as a query parameter. Currently, it is not possible to specify multiple properties to search by.
If there is an index available on the label/property combination you send, that index will be used. If no index is available, all nodes with the given label will be filtered through to find matching nodes.
Example request
GET
http://localhost:7474/db/data/label/Person/nodes?name=%22bob+ross%22
Accept:
application/json
Example response
200:
OK
Content-Type:
application/json
[ { "outgoing_relationships" : "http://localhost:7474/db/data/node/74/relationships/out", "labels" : "http://localhost:7474/db/data/node/74/labels", "data" : { "name" : "bob ross" }, "all_typed_relationships" : "http://localhost:7474/db/data/node/74/relationships/all/{-list|&|types}", "traverse" : "http://localhost:7474/db/data/node/74/traverse/{returnType}", "self" : "http://localhost:7474/db/data/node/74", "property" : "http://localhost:7474/db/data/node/74/properties/{key}", "properties" : "http://localhost:7474/db/data/node/74/properties", "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/74/relationships/out/{-list|&|types}", "incoming_relationships" : "http://localhost:7474/db/data/node/74/relationships/in", "extensions" : { }, "create_relationship" : "http://localhost:7474/db/data/node/74/relationships", "paged_traverse" : "http://localhost:7474/db/data/node/74/paged/traverse/{returnType}{?pageSize,leaseTime}", "all_relationships" : "http://localhost:7474/db/data/node/74/relationships/all", "incoming_typed_relationships" : "http://localhost:7474/db/data/node/74/relationships/in/{-list|&|types}" } ]
Copyright © 2013 Neo Technology