Event Management – Event Type Operations¶
Creating a Custom Event Type¶
Create an event type with temperature
field, derived from the event type 385aafd8-c919-11e7-abc4-cec278b6b50a
:
HTTP POST /eventTypes
1 2 3 4 5 6 7 8 9 10 11 12 13 | { "name" : "MyMotorEventType", "ttl" : 500, "scope" : "LOCAL", "parentId" : "385aafd8-c919-11e7-abc4-cec278b6b50a", "fields" : [ { "name" : "temperature", "filterable" : false, "required" : false, "updatable" : true, "type" : "STRING" } ] } |
The response shows the content and link to the created event type:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | { "id" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a", "name" : "MyMotorEventType", "ttl" : 500, "etag" : 0, "owner" : "phoenix-tenant", "scope" : "LOCAL", "parentId" : "385aafd8-c919-11e7-abc4-cec278b6b50a", "fields" : [ { "name" : "temperature", "filterable" : false, "required" : false, "updatable" : true, "type" : "STRING" } ], "_links" : { "self" : { "href" : "https://eventmanagement.advanced.mindsphere.io/eventTypes/c3d6749a-c9e4-11e7-abc4-cec278b6b50a" }, "events" : { "href" : "https://eventmanagement.advanced.mindsphere.io/events?filter=%7B%22typeId%22:%22c3d6749a-c9e4-11e7-abc4-cec278b6b50a%22%7D" } } } |
Reading a Custom Event Type¶
Read an event type by id:
HTTP GET /eventTypes/c3d6749a-c9e4-11e7-abc4-cec278b6b50a
The response shows the content and link to the requested event type:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | { "id" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a", "name" : "MyMotorEventType", "ttl" : 500, "etag" : 0, "owner" : "phoenix-tenant", "scope" : "LOCAL", "parentId" : "385aafd8-c919-11e7-abc4-cec278b6b50a", "fields" : [ { "name" : "temperature", "filterable" : false, "required" : false, "updatable" : true, "type" : "STRING" } ], "_links" : { "self" : { "href" : "https://eventmanagement.advanced.mindsphere.io/eventTypes/c3d6749a-c9e4-11e7-abc4-cec278b6b50a" }, "events" : { "href" : "https://eventmanagement.advanced.mindsphere.io/events?filter=%7B%22typeId%22:%22c3d6749a-c9e4-11e7-abc4-cec278b6b50a%22%7D" } } } |
Listing Custom Event Types¶
Get a list of all event types sorted in alphabetically
ascending
order of their name
field:
HTTP GET /eventTypes?page=0&size=20&sort=name%2Casc
The response shows the list of event types according to provided filter information:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | { "_embedded" : { "eventTypes" : [ { "id" : "x9x9949a-c9e4-11e7-abc4-cec278b6x99x", "name" : "ACompletelyDifferentMotorEventType", "ttl" : 500, "etag" : 0, "owner" : "phoenix-tenant", "scope" : "LOCAL", "parentId" : "385aafd8-c919-11e7-abc4-cec278b6b50a", "fields" : [ { "name" : "pressure", "filterable" : false, "required" : false, "updatable" : true, "type" : "STRING" } ], "_links" : { "self" : { "href" : "https://eventmanagement.advanced.mindsphere.io/eventTypes/c3d6749a-c9e4-11e7-abc4-cec278b6b50a" }, "events" : { "href" : "https://eventmanagement.advanced.mindsphere.io/events?filter=%7B%22typeId%22:%22c3d6749a-c9e4-11e7-abc4-cec278b6b50a%22%7D" } } }, { "id" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a", "name" : "MyMotorEventType", "ttl" : 500, "etag" : 0, "owner" : "phoenix-tenant", "scope" : "LOCAL", "parentId" : "385aafd8-c919-11e7-abc4-cec278b6b50a", "fields" : [ { "name" : "temperature", "filterable" : false, "required" : false, "updatable" : true, "type" : "STRING" } ], "_links" : { "self" : { "href" : "https://eventmanagement.advanced.mindsphere.io/eventTypes/x9x9949a-c9e4-11e7-abc4-cec278b6x99x" }, "events" : { "href" : "https://eventmanagement.advanced.mindsphere.io/events?filter=%7B%22typeId%22:%22x9x9949a-c9e4-11e7-abc4-cec278b6x99x%22%7D" } } } ] }, "_links" : { "self" : { "href" : "https://eventmanagement.advanced.mindsphere.io/eventTypes{?filter}", "templated" : true } }, "page" : { "size" : 20, "totalElements" : 2, "totalPages" : 1, "number" : 0 } } |
Updating a Custom Event Type¶
Add a new field to an existing event type:
HTTP PATCH /eventTypes/c3d6749a-c9e4-11e7-abc4-cec278b6b50a
1 2 3 4 5 6 7 8 9 | { "op" : "add", "path" : "/fields", "value" : { "name" : "newField", "updatable" : false, "type" : "INTEGER" } } |
The response shows the content and link to the updated event type:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | { "id" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a", "name" : "MyMotorEventType", "ttl" : 500, "etag" : 1, "owner" : "phoenix-tenant", "scope" : "LOCAL", "parentId" : "385aafd8-c919-11e7-abc4-cec278b6b50a", "fields" : [ { "name" : "originalField", "filterable" : false, "required" : true, "updatable" : false, "type" : "STRING" }, { "name" : "newField", "filterable" : false, "required" : false, "updatable" : false, "type" : "INTEGER" } ], "_links" : { "self" : { "href" : "https://eventmanagement.advanced.mindsphere.io/eventTypes/c3d6749a-c9e4-11e7-abc4-cec278b6b50a" }, "events" : { "href" : "https://eventmanagement.advanced.mindsphere.io/events?filter=%7B%22typeId%22:%22c3d6749a-c9e4-11e7-abc4-cec278b6b50a%22%7D" } } } |
Modify an existing field of an existing event type:
HTTP PATCH /eventTypes/c3d6749a-c9e4-11e7-abc4-cec278b6b50a
1 2 3 4 5 | { "op" : "replace", "path" : "/fields/originalField/required", "value" : false } |
The response shows the content and link to the updated event type:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | { "id" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a", "name" : "MyMotorEventType", "ttl" : 500, "etag" : 1, "owner" : "phoenix-tenant", "scope" : "LOCAL", "parentId" : "385aafd8-c919-11e7-abc4-cec278b6b50a", "fields" : [ { "name" : "originalField", "filterable" : false, "required" : false, "updatable" : true, "type" : "INTEGER" } ], "_links" : { "self" : { "href" : "https://eventmanagement.advanced.mindsphere.io/eventTypes/c3d6749a-c9e4-11e7-abc4-cec278b6b50a" }, "events" : { "href" : "https://eventmanagement.advanced.mindsphere.io/events?filter=%7B%22typeId%22:%22c3d6749a-c9e4-11e7-abc4-cec278b6b50a%22%7D" } } } |
Deleting a Custom Event Type¶
Delete an existing event type by id:
HTTP DELETE /eventTypes/c3d6749a-c9e4-11e7-abc4-cec278b6b50a
No content is returned.
Any questions left?
Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.