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.

updateSpecifications #

You can specify validation specifications in order to enforce your own rules over documents and real-time messages. Whenever a document is stored or updated, or a message is published, Kuzzle applies these specifications to check if the new data complies to the defined rules. If not, the document or message will be rejected and the request will return an error message.

The updateSpecifications method allows you to create or update the validation specifications for one or more index/collection pairs.

When the validation specification is not formatted correctly, a detailed error message is returned to help you to debug.

Query Syntax #

Available since 1.8.0

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/<index>/<collection>/_specifications
Method: PUT  
Body:
Copied to clipboard!
{
  "strict": <boolean>,
  "fields": {
    // ... specification for each field
  }
}

Other protocols #

Copied to clipboard!
{
  "controller": "collection",
  "action": "updateSpecifications",
  "index": "myindex",
  "collection": "mycollection",

  "body": {
    "strict": <boolean>,
    "fields": {
      // ... specification for each field
    }
  }
  
}

Deprecated since 1.8.0

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/_specifications
Method: PUT  
Body:
Copied to clipboard!
{
  "myindex": {
    "mycollection": {
      "strict": <boolean>,
      "fields": {
        // ... specification for each field
      }
    }
  }
}

Other protocols #

Copied to clipboard!
{
  "controller": "collection",
  "action": "updateSpecifications",
  "body": {
    "myindex": {
      "mycollection": {
        "strict": <boolean>,
        "fields": {
          // ... specification for each field
        }
      }
    }
  }

}

Body properties #

Available since 1.8.0

The provided body must have the following structure:

Copied to clipboard!
{
  "strict": <boolean>,
  "fields": {
    // field validation rules
  }
}

Deprecated since 1.8.0

The provided body must have the following structure:

Copied to clipboard!
{
  "<index>": {
    "<collection>": {
      "strict": <boolean>,
      "fields": {
        // field validation rules
      }
    }
  }
}

Response #

The returned result contains the updated specification:

Copied to clipboard!
{
  "status": 200,
  "error": null,
  "index": "<index>",
  "collection": "<collection>",
  "action": "updateSpecifications",
  "controller": "collection",
  "result": {
    "myindex": {
      "mycollection": {
        "strict": <boolean>,
        "fields": {
          // ... specification for each field
        }
      }
    }
  }
}

Possible errors #