SDK
SDK C# v2.x
2

updateSpecifications #

Creates or updates the validation specifications for one or more index/collection pairs.

When the validation specifications are not correctly formatted, a detailed error message is returned to help with debugging.

Arguments #

public async Task<JObject> UpdateSpecificationsAsync(
        string index,
        string collection,
        JObject specifications);
ArgumentTypeDescription
index
string
Index name
collection
string
Collection name
specifications
JObject
Specifications in JSON format

specifications #

A JObject representing the specifications.

The JSON must follow the Specifications structure:

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

Return #

A JObject representing the specifications.

Usage #

try {
  JObject specifications = JObject.Parse(@"{
    strict: false,
    fields: {
      license: {
        mandatory: true,
        type: 'string'
      }
    }
  }");
  JObject updatedSpecifications =
    await kuzzle.Collection.UpdateSpecificationsAsync(
      "nyc-open-data",
      "yellow-taxi",
      specifications
    );
  Console.WriteLine(updatedSpecifications.ToString(Formatting.None));
  /*
  {
    "strict": false,
    "fields": {
      "license": {
        "mandatory": true,
        "type": "string"
      }
    }
  }
  */
} catch (Exception e) {
  Console.WriteLine(e);
}