26.13. Constraints

26.13.1. Create property uniqueness constraint
26.13.2. Get label uniqueness property constraint
26.13.3. Get label uniqueness property constraints
26.13.4. Get label property constraints
26.13.5. Get constraints
26.13.6. Drop constraint

26.13.1. Create property uniqueness constraint

Figure 26.59. Final Graph


Example request

  • POST http://localhost:7474/db/data/schema/constraint/person/uniqueness/
  • Accept: application/json; charset=UTF-8
  • Content-Type: application/json
{
  "property_keys" : [ "name" ]
}

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
{
  "label" : "person",
  "type" : "UNIQUENESS",
  "property-keys" : [ "name" ]
}

26.13.2. Get label uniqueness property constraint

Get a specific uniqueness constraints for a label and a property

Figure 26.60. Final Graph


Example request

  • GET http://localhost:7474/db/data/schema/constraint/user/uniqueness/name
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "label" : "user",
  "property-keys" : [ "name" ],
  "type" : "UNIQUENESS"
} ]

26.13.3. Get label uniqueness property constraints

Get all uniqueness constraints for a label

Figure 26.61. Final Graph


Example request

  • GET http://localhost:7474/db/data/schema/constraint/user/uniqueness/
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "label" : "user",
  "property-keys" : [ "name1" ],
  "type" : "UNIQUENESS"
}, {
  "label" : "user",
  "property-keys" : [ "name2" ],
  "type" : "UNIQUENESS"
} ]

26.13.4. Get label property constraints

Get all constraints for a label

Figure 26.62. Final Graph


Example request

  • GET http://localhost:7474/db/data/schema/constraint/user
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "label" : "user",
  "property-keys" : [ "name1" ],
  "type" : "UNIQUENESS"
}, {
  "label" : "user",
  "property-keys" : [ "name2" ],
  "type" : "UNIQUENESS"
} ]

26.13.5. Get constraints

Get all constraints

Figure 26.63. Final Graph


Example request

  • GET http://localhost:7474/db/data/schema/constraint/
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "label" : "user",
  "property-keys" : [ "name1" ],
  "type" : "UNIQUENESS"
}, {
  "label" : "prog",
  "property-keys" : [ "name2" ],
  "type" : "UNIQUENESS"
} ]

26.13.6. Drop constraint

Drop uniqueness constraint for a label and a property

Figure 26.64. Final Graph


Example request

  • DELETE http://localhost:7474/db/data/schema/constraint/SomeLabel/uniqueness/name
  • Accept: application/json; charset=UTF-8

Example response

  • 204: No Content