SDK
SDK C# 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.

ValidateAsync #

Validates data against existing validation rules.

Documents are always valid if no validation rules are defined on the provided index and collection.

This request does not store the document.

Arguments #

public async Task<bool> ValidateAsync(
  string index, 
  string collection, 
  JObject content);

ArgumentTypeDescription
index
string
Index name
collection
string
Collection name
content
JObject
JObject representing the document

Return #

A bool set to true if the document is valid and false otherwise.

Exceptions #

Throws a KuzzleException if there is an error. See how to handle errors.

Usage #

try {
  bool valid = await kuzzle.Document.ValidateAsync(
    "nyc-open-data",
    "yellow-taxi",
    JObject.Parse(@"{
      ""capacity"": 4
    }"));
  if (valid) {
    Console.WriteLine("The document is valid");
  }
} catch (KuzzleException e) {
  Console.Error.WriteLine(e);
}