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 #
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:
{
"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 #
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;
}
Edit this page on Github(opens new window)