19.6. Relationship properties

19.6.1. Update relationship properties
19.6.2. Remove property from a relationship
19.6.3. Remove non-existent property from a relationship
19.6.4. Remove properties from a non-existing relationship
19.6.5. Remove property from a non-existing relationship

19.6.1. Update relationship properties

Figure 19.34. Final Graph


Example request

  • PUT http://localhost:7474/db/data/relationship/102/properties
  • Accept: application/json
  • Content-Type: application/json
{
  "jim" : "tobias"
}

Example response

  • 204: No Content

inlcude::remove-properties-from-a-relationship.txt[]

19.6.2. Remove property from a relationship

See the example request below.

Figure 19.35. Starting Graph


Figure 19.36. Final Graph


Example request

  • DELETE http://localhost:7474/db/data/relationship/16/properties/cost
  • Accept: application/json

Example response

  • 204: No Content

19.6.3. Remove non-existent property from a relationship

Attempting to remove a property that doesn’t exist results in an error.

Figure 19.37. Final Graph


Example request

  • DELETE http://localhost:7474/db/data/relationship/17/properties/non-existent
  • Accept: application/json

Example response

  • 404: Not Found
  • Content-Type: application/json
{
  "message" : "Relationship[17] does not have a property \"non-existent\"",
  "exception" : "org.neo4j.server.rest.web.NoSuchPropertyException: Relationship[17] does not have a property \"non-existent\"",
  "stacktrace" : [ "org.neo4j.server.rest.web.DatabaseActions.removeRelationshipProperty(DatabaseActions.java:729)", "org.neo4j.server.rest.web.RestfulGraphDatabase.deleteRelationshipProperty(RestfulGraphDatabase.java:595)", "java.lang.reflect.Method.invoke(Method.java:597)" ]
}

19.6.4. Remove properties from a non-existing relationship

Attempting to remove all properties from a relationship which doesn’t exist results in an error.

Figure 19.38. Final Graph


Example request

  • DELETE http://localhost:7474/db/data/relationship/1234/properties
  • Accept: application/json

Example response

  • 404: Not Found
  • Content-Type: application/json
{
  "exception" : "org.neo4j.server.rest.web.RelationshipNotFoundException",
  "stacktrace" : [ "org.neo4j.server.rest.web.DatabaseActions.relationship(DatabaseActions.java:138)", "org.neo4j.server.rest.web.DatabaseActions.removeAllRelationshipProperties(DatabaseActions.java:707)", "org.neo4j.server.rest.web.RestfulGraphDatabase.deleteAllRelationshipProperties(RestfulGraphDatabase.java:579)", "java.lang.reflect.Method.invoke(Method.java:597)" ]
}

19.6.5. Remove property from a non-existing relationship

Attempting to remove a property from a relationship which doesn’t exist results in an error.

Figure 19.39. Final Graph


Example request

  • DELETE http://localhost:7474/db/data/relationship/1234/properties/cost
  • Accept: application/json

Example response

  • 404: Not Found
  • Content-Type: application/json
{
  "exception" : "org.neo4j.server.rest.web.RelationshipNotFoundException",
  "stacktrace" : [ "org.neo4j.server.rest.web.DatabaseActions.relationship(DatabaseActions.java:138)", "org.neo4j.server.rest.web.DatabaseActions.removeRelationshipProperty(DatabaseActions.java:723)", "org.neo4j.server.rest.web.RestfulGraphDatabase.deleteRelationshipProperty(RestfulGraphDatabase.java:595)", "java.lang.reflect.Method.invoke(Method.java:597)" ]
}