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
{
"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:
{
"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:
{
"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:
{
"_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
{
"op" : "add",
"path" : "/fields",
"value" : {
"name" : "newField",
"updatable" : false,
"type" : "INTEGER"
}
}
The response shows the content and link to the updated event type:
{
"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
{
"op" : "replace",
"path" : "/fields/originalField/required",
"value" : false
}
The response shows the content and link to the updated event type:
{
"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.
Sharing of Event Type¶
Event Type with "LOCAL" scope is by default available to tenants who had established collaborations between them. Param "includeShared" is needed to query shared Event Types.
HTTP GET /eventTypes?includeShared=true