Example request
POST
http://localhost:7474/db/data/node/100/labels
Accept:
application/json; charset=UTF-8
Content-Type:
application/json
"Person"
Example response
204:
No Content
Example request
POST
http://localhost:7474/db/data/node/111/labels
Accept:
application/json; charset=UTF-8
Content-Type:
application/json
[ "Person", "Actor" ]
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/118/labels
Accept:
application/json; charset=UTF-8
Content-Type:
application/json
""
Example response
400:
Bad Request
Content-Type:
application/json; charset=UTF-8
{ "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:328)", "org.neo4j.server.rest.web.RestfulGraphDatabase.addNodeLabel(RestfulGraphDatabase.java:447)", "java.lang.reflect.Method.invoke(Method.java:606)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)", "java.lang.Thread.run(Thread.java:724)" ], "cause": { "message": "Invalid label name \u0027\u0027.", "cause": { "message": "\u0027\u0027 is not a valid token name. Only non-null, non-empty strings are allowed.", "exception": "IllegalTokenNameException", "stacktrace": [ "org.neo4j.kernel.impl.api.DataIntegrityValidatingStatementOperations.checkValidTokenName(DataIntegrityValidatingStatementOperations.java:171)", "org.neo4j.kernel.impl.api.DataIntegrityValidatingStatementOperations.labelGetOrCreateForName(DataIntegrityValidatingStatementOperations.java:82)", "org.neo4j.kernel.impl.api.OperationsFacade.labelGetOrCreateForName(OperationsFacade.java:390)", "org.neo4j.kernel.impl.core.NodeProxy.addLabel(NodeProxy.java:472)", "org.neo4j.server.rest.web.DatabaseActions.addLabelToNode(DatabaseActions.java:323)", "org.neo4j.server.rest.web.RestfulGraphDatabase.addNodeLabel(RestfulGraphDatabase.java:447)", "java.lang.reflect.Method.invoke(Method.java:606)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)", "java.lang.Thread.run(Thread.java:724)" ], "fullname": "org.neo4j.kernel.api.exceptions.schema.IllegalTokenNameException" }, "exception": "ConstraintViolationException", "stacktrace": [ "org.neo4j.kernel.impl.core.NodeProxy.addLabel(NodeProxy.java:481)", "org.neo4j.server.rest.web.DatabaseActions.addLabelToNode(DatabaseActions.java:323)", "org.neo4j.server.rest.web.RestfulGraphDatabase.addNodeLabel(RestfulGraphDatabase.java:447)", "java.lang.reflect.Method.invoke(Method.java:606)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)", "java.lang.Thread.run(Thread.java:724)" ], "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/101/labels
Accept:
application/json; charset=UTF-8
Content-Type:
application/json
[ "Actor", "Director" ]
Example response
204:
No Content
Example request
DELETE
http://localhost:7474/db/data/node/102/labels/Person
Accept:
application/json; charset=UTF-8
Example response
204:
No Content
Example request
GET
http://localhost:7474/db/data/node/107/labels
Accept:
application/json; charset=UTF-8
Example response
200:
OK
Content-Type:
application/json; charset=UTF-8
[ "Director", "Actor" ]
Example request
GET
http://localhost:7474/db/data/label/Actor/nodes
Accept:
application/json; charset=UTF-8
Example response
200:
OK
Content-Type:
application/json; charset=UTF-8
[ { "labels" : "http://localhost:7474/db/data/node/113/labels", "outgoing_relationships" : "http://localhost:7474/db/data/node/113/relationships/out", "data" : { "name" : "Clint Eastwood" }, "traverse" : "http://localhost:7474/db/data/node/113/traverse/{returnType}", "all_typed_relationships" : "http://localhost:7474/db/data/node/113/relationships/all/{-list|&|types}", "property" : "http://localhost:7474/db/data/node/113/properties/{key}", "self" : "http://localhost:7474/db/data/node/113", "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/113/relationships/out/{-list|&|types}", "properties" : "http://localhost:7474/db/data/node/113/properties", "incoming_relationships" : "http://localhost:7474/db/data/node/113/relationships/in", "extensions" : { }, "create_relationship" : "http://localhost:7474/db/data/node/113/relationships", "paged_traverse" : "http://localhost:7474/db/data/node/113/paged/traverse/{returnType}{?pageSize,leaseTime}", "all_relationships" : "http://localhost:7474/db/data/node/113/relationships/all", "incoming_typed_relationships" : "http://localhost:7474/db/data/node/113/relationships/in/{-list|&|types}" }, { "labels" : "http://localhost:7474/db/data/node/114/labels", "outgoing_relationships" : "http://localhost:7474/db/data/node/114/relationships/out", "data" : { "name" : "Donald Sutherland" }, "traverse" : "http://localhost:7474/db/data/node/114/traverse/{returnType}", "all_typed_relationships" : "http://localhost:7474/db/data/node/114/relationships/all/{-list|&|types}", "property" : "http://localhost:7474/db/data/node/114/properties/{key}", "self" : "http://localhost:7474/db/data/node/114", "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/114/relationships/out/{-list|&|types}", "properties" : "http://localhost:7474/db/data/node/114/properties", "incoming_relationships" : "http://localhost:7474/db/data/node/114/relationships/in", "extensions" : { }, "create_relationship" : "http://localhost:7474/db/data/node/114/relationships", "paged_traverse" : "http://localhost:7474/db/data/node/114/paged/traverse/{returnType}{?pageSize,leaseTime}", "all_relationships" : "http://localhost:7474/db/data/node/114/relationships/all", "incoming_typed_relationships" : "http://localhost:7474/db/data/node/114/relationships/in/{-list|&|types}" } ]
You can retrieve all nodes with a given label and property by passing one property as a query parameter. Notice that the property value is JSON-encoded and then URL-encoded.
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.
Currently, it is not possible to search using multiple properties.
Example request
GET
http://localhost:7474/db/data/label/Person/nodes?name=%22Clint+Eastwood%22
Accept:
application/json; charset=UTF-8
Example response
200:
OK
Content-Type:
application/json; charset=UTF-8
[ { "labels" : "http://localhost:7474/db/data/node/116/labels", "outgoing_relationships" : "http://localhost:7474/db/data/node/116/relationships/out", "data" : { "name" : "Clint Eastwood" }, "traverse" : "http://localhost:7474/db/data/node/116/traverse/{returnType}", "all_typed_relationships" : "http://localhost:7474/db/data/node/116/relationships/all/{-list|&|types}", "property" : "http://localhost:7474/db/data/node/116/properties/{key}", "self" : "http://localhost:7474/db/data/node/116", "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/116/relationships/out/{-list|&|types}", "properties" : "http://localhost:7474/db/data/node/116/properties", "incoming_relationships" : "http://localhost:7474/db/data/node/116/relationships/in", "extensions" : { }, "create_relationship" : "http://localhost:7474/db/data/node/116/relationships", "paged_traverse" : "http://localhost:7474/db/data/node/116/paged/traverse/{returnType}{?pageSize,leaseTime}", "all_relationships" : "http://localhost:7474/db/data/node/116/relationships/all", "incoming_typed_relationships" : "http://localhost:7474/db/data/node/116/relationships/in/{-list|&|types}" } ]
Example request
GET
http://localhost:7474/db/data/labels
Accept:
application/json; charset=UTF-8
Example response
200:
OK
Content-Type:
application/json; charset=UTF-8
[ "person", "expert", "chef", "Person", "Actor", "coder", "user", "mylabel", "Director", "prog", "SomeLabel", "novice" ]
Copyright © 2014 Neo Technology