Publish events

The following endpoint can be used for publishing an event: POST/api/eventing/event

Calling endpoint requires both SAS and jwt token for authentication and authorization. Jwt token must be generated using application registration in the internal tenant. Application must have access to eventing application. For SAS token use platform generated SAS tokens. Please read about that more here.

The following example shows how to publish an event:

{
  "type": "DHI.WaterData.Eventing.Event.Contracts.Samples.SomethingHappenedV1",
  "source": "/someservice/someoperation/v1/", 
  "time": "2021-03-08T12:32:19.0186259Z",
  "subject": "Something happend",
  "dataschema": "https://schemas.mike-cloud.com/platform/something/v1/operation",
  "data": {
    "messageFromService": "Hello"
  },
  "operationid": "bdb9fd2b-a6c6-4d6e-8c4b-c16f8828fb27",
  "resourceid": "fdb9fd2b-a6c6-4d6e-8c4b-c16f8828fb27",
  "istransient": "false"
}

Note

In event contract type and source are required. Parameter time is expected to be Utc time. Parameter dataschema is validated against allowed dataschemas per application registration, istransient is optional field and is meant for flagging events as transient.