Official Plugins (Kuzzle v2.x)
Device Manager v2.x
2

writeMeasure #

Write a measure model.

This action acts like a create or replace

Query Syntax #

HTTP #

URL: http://kuzzle:7512/_/device-manager/models/measures
Method: POST

Other protocols #

{
  "controller": "device-manager/models",
  "action": "writeMeasure",
  "body": {
    "type": "<measure type>",
    "valuesMappings": {
      // Values mappings
    },
      // Optional
    "valuesDetails":{
      // Values details and translation
    },
      // Optional
    "validationSchema": {
      // Valid JSON Schema
    }
  }
}

Body properties #

  • model: Measure model name
  • valuesMappings: Mappings of the measure values in Elasticsearch format
  • valuesDetails: (optional) Measurement translations and units
  • validationSchema: (optional) Measurement validation JSON schema

Response #

{
  "status": 200,
  "error": null,
  "controller": "device-manager/models",
  "action": "writeMeasure",
  "requestId": "<unique request identifier>",
  "result": {
    "_id": "<modelId>",
    "_source": {
      // Measure model content
    },
  }
}

Errors #

Writing a measure with values mappings can cause conflicts, in this case a MappingsConflictsError will be thrown with the HTTP code 409.