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:

1
PUT /subscribers/{id}/versions/{versionId}/topics/{topicId}
1
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:

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

Response example:

1
2
3
{
  "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:

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

Response example:

1
2
3
{
  "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.

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

Response example

1
Status 204 No Content

Publishing message on topic of Interest

Publishing the message

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

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

Request example:

1
2
3
{
  "content": "string"
}

Response example:

1
Status 201 No Content

Any questions left?

Ask the community


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