Create a Polling Monitor

The following example shows how to create a polling monitor.

Request

POST /ws/v1/monitors/inventory

Request

{
  "type": "polling",
  "description": "DataPoint with schema conversion",
  "topics": [
    "DataPoint/*/cl1/cval",
    "DataPoint/*/ts1/bat"
  ],
  "schema_type": "handlebars",
  "schema" : "[{{#eachFiltered this}}{{#if @index}},{{/if}}\n  {\n    \"timestamp\": \"{{formatTime DataPoint.timestamp}}\",\n    \"stream\": \"{{DataPoint.streamId}}\",\n    \"value\": \"{{DataPoint.data}}\",\n    \"device\": \"{{firstPathComponent DataPoint.streamId}}\"\n  }{{/eachFiltered}}\n]",
}

Response

The monitor is initially created with an inactive status. The system activates it in short order.

{
    "customer_id": 42,
    "description": "DataPoint with schema conversion",
    "id": 24797,
    "persistent": true,
    "schema": "[{{#eachFiltered this}}{{#if @index}},{{/if}}\n  {\n    \"timestamp\": \"{{formatTime DataPoint.timestamp}}\",\n    \"stream\": \"{{DataPoint.streamId}}\",\n    \"value\": \"{{DataPoint.data}}\",\n    \"device\": \"{{firstPathComponent DataPoint.streamId}}\"\n  }{{/eachFiltered}}\n]",
    "schema_type": "handlebars",
    "status": "inactive",
    "topics": [
        "DataPoint/*/cl1/cval",
        "DataPoint/*/ts1/bat"
    ],
    "type": "polling"
}