Skip to content

Event Management – Event Operations

Creating a Standard Event

Create a standard event:

HTTP POST /events

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "timestamp" : "2018-07-29T06:09:29.743Z",
  "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "code" : "123",
  "description" : "Error happened in the engine",
  "severity" : 5,
  "source" : "eventSource",
  "acknowledged" : false
}

The response shows the content and link to the created event:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
  "id" : "ab5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "typeId" : "com.siemens.mindsphere.eventmgmt.event.type.MindSphereStandardEvent",
  "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "timestamp" : "2018-07-29T06:09:29.743Z",
  "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "etag" : 1,
  "_links" : {
    "self" : {
      "href" : "https://eventmanagement.advanced.mindsphere.io/events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a"
    }
  },
  "severity" : 5,
  "code" : "123",
  "acknowledged" : false,
  "description" : "Error happened in the engine",
  "source" : "eventSource"
}

Creating a Custom Event

Create a custom event:

HTTP POST /events

1
2
3
4
5
6
7
{
  "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "timestamp" : "2018-07-29T06:09:29.743Z",
  "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "typeId" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a",
  "additionalField" : "additionalFieldValue"
}

The response shows the content and link to the created event:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  "id" : "ab5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "typeId" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a",
  "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "timestamp" : "2018-07-29T06:09:29.743Z",
  "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "etag" : 1,
  "_links" : {
    "self" : {
      "href" : "https://eventmanagement.advanced.mindsphere.io/events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a"
    }
  },
  "additionalField" : "additionalFieldValue"
}

Creating Multiple Events

Run a job which creates two events:

HTTP POST /createEventsJobs

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "events" : [ {
    "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
    "timestamp" : "2018-07-29T12:17:48.454Z",
    "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
    "typeId" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a"
  }, {
    "correlationId" : "97b33fb8-c536-11e7-abc4-cec278b6b99x",
    "timestamp" : "2018-07-29T12:17:48.454Z",
    "entityId" : "pp9973c4-bd67-11e7-abc4-cec278b6po77",
    "typeId" : "x9x9949a-c9e4-11e7-abc4-cec278b6x99x"
  } ]
}

The response shows the ID and the state of the request:

1
2
3
4
{
  "id" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "state" : "ACCEPTED"
}

The state of the job created above can be checked by the following request:

HTTP GET /createEventsJobs/cd5f73c4-bd67-11e7-abc4-cec278b6b50b

The response shows the current state of the job:

 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
{
  "id" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "state" : "FINISHED_WITH_ERROR",
  "details" : {
    "resultDescription" : [ {
      "event" : {
        "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
        "timestamp" : "2018-07-29T12:17:48.454Z",
        "typeId" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a",
        "customStringField" : "customValue"
      },
      "resultCode" : "400",
      "errorMessage" : "Missing entity id"
    }, {
      "event" : {
        "customStringField" : "CustomStringValue",
        "_links" : {
          "self" : {
            "href" : "https://eventmanagement.advanced.mindsphere.io/events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a"
          }
        },
        "typeId" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a",
        "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
        "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
        "etag" : 0,
        "id" : "ab5f73c4-bd67-11e7-abc4-cec278b6b50a",
        "timestamp" : "2018-07-29T12:17:48.454Z"
      },
      "resultCode" : "201"
    } ]
  }
}

Reading a Standard Event

Request an event by ID:

HTTP GET /events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a

The response shows the content and link to the requested event:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
  "id" : "ab5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "typeId" : "com.siemens.mindsphere.eventmgmt.event.type.MindSphereStandardEvent",
  "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "timestamp" : "2018-07-29T06:09:29.743Z",
  "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "etag" : 1,
  "_links" : {
    "self" : {
      "href" : "https://eventmanagement.advanced.mindsphere.io/events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a"
    }
  },
  "severity" : 5,
  "code" : "123",
  "acknowledged" : false,
  "description" : "Error happened in the engine",
  "source" : "eventSource"
}

Reading a Custom Event

Request an event by ID:

HTTP GET /events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a

The response shows the content and link to the requested event:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  "id" : "ab5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "typeId" : "c3d6749a-c9e4-11e7-abc4-cec278b6b50a",
  "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "timestamp" : "2018-07-29T06:09:29.743Z",
  "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "etag" : 1,
  "_links" : {
    "self" : {
      "href" : "https://eventmanagement.advanced.mindsphere.io/events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a"
    }
  },
  "additionalField" : "additionalFieldValue"
}

Listing Standard Events

List standard events sorted in descending order by the timestamp of their history field:

HTTP GET /events?page=0&size=20&sort=timestamp%2Cdesc&history=true

The response shows the list of events 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
{
  "_embedded" : {
    "events" : [ {
      "id" : "ab5f73c4-bd67-11e7-abc4-cec278b6b50a",
      "typeId" : "com.siemens.mindsphere.eventmgmt.event.type.MindSphereStandardEvent",
      "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
      "timestamp" : "2018-07-29T06:09:29.743Z",
      "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
      "etag" : 1,
      "_links" : {
        "self" : {
          "href" : "https://eventmanagement.advanced.mindsphere.io/events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a"
        }
      },
      "severity" : 5,
      "code" : "123",
      "acknowledged" : false,
      "description" : "Error happened in the engine",
      "source" : "eventSource"
    }, {
      "id" : "xy5f73c4-bd67-11e7-abc4-cec278b6b50a",
      "typeId" : "com.siemens.mindsphere.eventmgmt.event.type.MindSphereStandardEvent",
      "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
      "timestamp" : "2018-07-28T06:09:29.745Z",
      "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
      "etag" : 1,
      "_links" : {
        "self" : {
          "href" : "https://eventmanagement.advanced.mindsphere.io/events/xy5f73c4-bd67-11e7-abc4-cec278b6b50a"
        }
      },
      "severity" : 3,
      "code" : "123",
      "acknowledged" : false,
      "description" : "Error happened in the engine",
      "source" : "eventSource"
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://eventmanagement.advanced.mindsphere.io/events?history=true{&filter}",
      "templated" : true
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 2,
    "totalPages" : 1,
    "number" : 0
  }
}

Listing Custom Events

List custom events sorted in descending order by the timestamp of their history field:

HTTP GET /events?filter=%7B%22typeId%22%3A%22dud6749a-c9e4-11e7-abc4-cec278b6b50a%22%7D&page=0&size=20&sort=timestamp%2Cdesc&history=true

The response shows the list of events 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
{
  "_embedded" : {
    "events" : [ {
      "id" : "ab5f73c4-bd67-11e7-abc4-cec278b6b50a",
      "typeId" : "dud6749a-c9e4-11e7-abc4-cec278b6b50a",
      "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
      "timestamp" : "2018-07-29T06:09:29.743Z",
      "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
      "etag" : 1,
      "_links" : {
        "self" : {
          "href" : "https://eventmanagement.advanced.mindsphere.io/events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a"
        }
      },
      "additionalField" : "additionalFieldValue"
    }, {
      "id" : "zu5f73c4-bd67-11e7-abc4-cec278b6b50a",
      "typeId" : "dud6749a-c9e4-11e7-abc4-cec278b6b50a",
      "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
      "timestamp" : "2018-07-28T06:09:29.745Z",
      "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
      "etag" : 2,
      "_links" : {
        "self" : {
          "href" : "https://eventmanagement.advanced.mindsphere.io/events/zu5f73c4-bd67-11e7-abc4-cec278b6b50a"
        }
      },
      "additionalField" : "additionalFieldValue"
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://eventmanagement.advanced.mindsphere.io/events?filter=%7B%22typeId%22:%22dud6749a-c9e4-11e7-abc4-cec278b6b50a%22%7D&history=true"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 2,
    "totalPages" : 1,
    "number" : 0
  }
}

Updating an Event

Update an event by ID:

HTTP PUT /events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a

1
2
3
4
5
6
{
  "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "timestamp" : "2018-07-29T06:09:29.743Z",
  "entityId" : "ef5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "description" : "Error happened in the engine"
}

The response shows the content and link to the updated event:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
  "id" : "ab5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "typeId" : "com.siemens.mindsphere.eventmgmt.event.type.MindSphereStandardEvent",
  "correlationId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50a",
  "timestamp" : "2018-07-29T06:09:29.743Z",
  "entityId" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "etag" : 2,
  "_links" : {
    "self" : {
      "href" : "https://eventmanagement.advanced.mindsphere.io/events/ab5f73c4-bd67-11e7-abc4-cec278b6b50a"
    }
  },
  "severity" : 5,
  "code" : "123",
  "acknowledged" : false,
  "description" : "Error happened in the engine",
  "source" : "eventSource"
}

Deleting Events

Delete events by filter:

HTTP POST /deleteEventsJobs

1
2
3
4
5
{
  "filter" : {
    "typeId" : "anyTypeId"
  }
}

The response shows the ID and the state of the request:

1
2
3
4
{
  "id" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "state" : "ACCEPTED"
}

The status of the job created above can be checked by the following request:

HTTP GET /deleteEventsJobs/cd5f73c4-bd67-11e7-abc4-cec278b6b50b

The response shows the current state of the job:

1
2
3
4
{
  "id" : "cd5f73c4-bd67-11e7-abc4-cec278b6b50b",
  "state" : "IN_PROGRESS"
}

This response shows a successfully finished delete:

1
2
3
4
5
6
7
8
{
  "id": "a3a35ea8-5893-4aac-af98-8fac29148386",
  "state": "FINISHED",
  "details": {
    "resultCode": "200",
    "resultDescription": "1 events deleted."
  }
}

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.