Skip to content

Message Broker Service– Samples

Subscribing Events

Note

This is applicable only for Early access customers.

You can choose to be notified for events of your Interest. It is also possible to subscribe for event notifications generated based on event changes. Multiple subscriptions for the same event can be created for each version of the application.

Subscribe to the event notification

Creating or updating Event Subscription:

Use the following endpoint:

PUT /subscribers/{id}/versions/{versionId}/topics/{topicId}
Content-Type: application/json

After successful subscription, the subscriber can receive messages from the given topic over the webhook uri. Webhook uri should provide support for http post operation only.

Request example:

{
  "uri": "https://gateway.eu1.mindsphere.io/api/thirdpartyapp-tenantname/v1/mywebhookURL"
}

Response example:

{
  "uri": "https://gateway.eu1.mindsphere.io/api/thirdpartyapp-tenantname/v1/mywebhookURL"
}

Getting the details of events subscribed

You can get the details of the subscription to which you are already subscribed. Use the following endpoint:

GET /subscribers/{id}/versions/{versionId}/topics/{topicId}

Response example:

{
  "uri": "https://gateway.eu1.mindsphere.io/api/thirdpartyapp-tenantname/v1/mywebhookURL"
}

Deleting the subscription

If you do not want to receive any further notifications, you can delete the created subscription.

DELETE /subscribers/{id}/versions/{versionId}/topics/{topicId}

Response example

Status 204 No Content

Publishing message on topic of Interest

Publishing the message:

Publishes new messages to the given topic. Use the following endpoint:

POST /topics/{id}/sendmessage
Content-Type: application/json

Request example:

{
  "content": "string"
}

Response example:

Status 201 No Content

Last update: June 15, 2023

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