Setting different properties will retain the existing ones for this node. Note that a single value are submitted not as a map but just as a value (which is valid JSON) like in the example below.
Example request
PUT
http://localhost:7474/db/data/node/12/properties/foo
Accept:
application/json; charset=UTF-8
Content-Type:
application/json
"bar"
Example response
204:
No Content
This will replace all existing properties on the node with the new set of attributes.
Example request
PUT
http://localhost:7474/db/data/node/10/properties
Accept:
application/json; charset=UTF-8
Content-Type:
application/json
{ "age" : "18" }
Example response
204:
No Content
Example request
GET
http://localhost:7474/db/data/node/2/properties
Accept:
application/json; charset=UTF-8
Example response
200:
OK
Content-Type:
application/json; charset=UTF-8
{ "foo" : "bar" }
This example shows the response you get when trying to set a property to
null
.
Example request
POST
http://localhost:7474/db/data/node
Accept:
application/json; charset=UTF-8
Content-Type:
application/json
{ "foo" : null }
Example response
400:
Bad Request
Content-Type:
application/json; charset=UTF-8
{ "message": "Could not set property \"foo\", unsupported type: null", "exception": "PropertyValueException", "fullname": "org.neo4j.server.rest.web.PropertyValueException", "stacktrace": [ "org.neo4j.server.rest.domain.PropertySettingStrategy.setProperty(PropertySettingStrategy.java:151)", "org.neo4j.server.rest.domain.PropertySettingStrategy.setProperties(PropertySettingStrategy.java:92)", "org.neo4j.server.rest.web.DatabaseActions.createNode(DatabaseActions.java:191)", "org.neo4j.server.rest.web.RestfulGraphDatabase.createNode(RestfulGraphDatabase.java:207)", "java.lang.reflect.Method.invoke(Method.java:597)" ] }
Nesting properties is not supported. You could for example store the nested JSON as a string instead.
Example request
POST
http://localhost:7474/db/data/node/
Accept:
application/json; charset=UTF-8
Content-Type:
application/json
{ "foo" : { "bar" : "baz" } }
Example response
400:
Bad Request
Content-Type:
application/json; charset=UTF-8
{ "message": "Could not set property \"foo\", unsupported type: {bar\u003dbaz}", "exception": "PropertyValueException", "fullname": "org.neo4j.server.rest.web.PropertyValueException", "stacktrace": [ "org.neo4j.server.rest.domain.PropertySettingStrategy.setProperty(PropertySettingStrategy.java:151)", "org.neo4j.server.rest.domain.PropertySettingStrategy.setProperties(PropertySettingStrategy.java:92)", "org.neo4j.server.rest.web.DatabaseActions.createNode(DatabaseActions.java:191)", "org.neo4j.server.rest.web.RestfulGraphDatabase.createNode(RestfulGraphDatabase.java:207)", "java.lang.reflect.Method.invoke(Method.java:597)" ] }
Example request
DELETE
http://localhost:7474/db/data/node/42/properties
Accept:
application/json; charset=UTF-8
Example response
204:
No Content
To delete a single property from a node, see the example below.
Example request
DELETE
http://localhost:7474/db/data/node/41/properties/name
Accept:
application/json; charset=UTF-8
Example response
204:
No Content
Copyright © 2014 Neo Technology