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.

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

updateSpecifications #

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.

Signature #

Copied to clipboard!
std::string updateSpecifications(
    const std::string& index,
    const std::string& collection,
    const std::string& specifications);

std::string updateSpecifications(
    const std::string& index,
    const std::string& collection,
    const std::string& specifications,
    const kuzzleio::query_options& options);

Arguments #

Arguments Type Description
index
const std::string&
Index name
collection
const std::string&
Collection name
specifications const std::string& Specification in JSON format
options
kuzzleio::query_options*
Query options

specifications #

A JSON string representing the specifications.

The JSON must follow the Specification Structure:

Copied to clipboard!
{
  "strict": "true",
  "fields": {
    "licence": {
      "mandatory": true,
      "type": "string"
    }
    // ... specification for each field
  }
}

options #

Additional query options

Property Type
(default)
Description
queuable
bool

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

Return #

A JSON string representing the specifications

Usage #

Copied to clipboard!
try {
  std::string specifications = R"({
    "strict": false,
    "fields": {
      "license": {
        "mandatory": true,
        "type": "string"
      }
    }
  })";
  std::string updated_specifications =
    kuzzle->collection->updateSpecifications("nyc-open-data", "yellow-taxi", specifications);
  std::cout << updated_specifications << std::endl;
  // {"strict":false,"fields":{"license":{"mandatory":true,"type":"string"}}}
} catch (kuzzleio::KuzzleException &e) {
  std::cerr << e.what() << std::endl;
}