SDK
SDK Java v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

validate #

Validates data against existing validation rules.

Note that if no validation specifications are set for the <index>/<collection>, the document will always be valid.

This request does not store or publish the document.

Arguments #

boolean validate(String index, String collection, String document)

boolean validate(
  String index,
  String collection,
  String document,
  io.kuzzle.sdk.QueryOptions options
)

ArgumentTypeDescription
index
String
Index name
collection
String
Collection name
body
String
A JSON string containing the body of the document
options
io.kuzzle.sdk.QueryOptions
Query options

options #

Additional query options

OptionType
(default)
Description
queuable
boolean

(true)
If true, queues the request during downtime, until connected to Kuzzle again

Return #

Returns a boolean value set to true if the document is valid and false otherwise.

Exceptions #

Throws a io.kuzzle.sdk.KuzzleException if there is an error. See how to handle error.

Usage #

String doc = "{\"capacity\": 4}";
try {
  boolean valid = kuzzle.getDocument().validate("nyc-open-data", "yellow-taxi", doc);
    if (valid) {
      System.out.println("Success");
    }
} catch (KuzzleException e) {
  System.err.println(e.getMessage());
}