Core
API 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.

validate #

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.


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/<index>/<collection>/_validate
Method: POST
Body:
Copied to clipboard!
{
  // Document content to check
}

Other protocols #

Copied to clipboard!
{
  "index": "<index>",
  "collection": "<collection>",
  "controller": "document",
  "action": "validate",
  "body": {
    // document content to check
  }
}

Arguments #

  • collection: collection name
  • index: index name

Body properties #

Document content to validate.


Response #

Returns the document validation status, with the following properties:

  • errorMessages: the exhaustive list of violated validation rules. Present only if valid is false
  • valid: a boolean telling whether the provided pass all validation rules
Copied to clipboard!
{
  "status": 200,
  "error": null,
  "index": "<index>",
  "collection": "<collection>",
  "controller": "document",
  "action": "validate",
  "result": {
    "valid": true
  }
}