Database Reference
In-Depth Information
Applying unicity constraints with REST
Let's create/retrieve/delete the unique constraints using REST API and use tools such as
SoapUI or extensions to the Chrome / Firefox browser (advanced REST client or REST
easy), which supports testing of REST-based services / representation to execute the JSON
request with the provided configuration.
To create a constraint on
Artist(Age)
, use the following configuration in your REST-
based testing tool:
• The request method type is
POST
• The request URL for creating a constraint is
http://<HOST>:<PORT>/db/
data/schema/constraint/Artist/uniqueness
• The headers are
Accept: application/json; charset=UTF-8
and
Content-Type: application/json
• Put the following JSON request in the box provided for posting the JSON request
and execute it:
{"property_keys" : [ "Age" ]}
The response of the preceding REST request will be similar to the results shown in the fol-
lowing screenshot:
To get all constraints on the
Artist
label, use the following configuration in your REST-
based testing tool and execute the request:
• The request method type is
GET