How to call rest API and subscribe for notification/event from custom widget

We are working on application builder where we need to integrate the custom widget inside it. We have referred cumulocity-runtime-widget on git to create the custom widget and we are good in terms of creation of custom widget.

Now as a next phase we required to integrate the REST over MQTT inside the custom widget to fetch the dynamic data from gateway/IOT device.
We are facing issues to integrate the REST API. We have gone through multiple thread but we are unable to find the working example with Angular.

Product/components used and version/fix level are you on:

Detailed explanation of the problem:

We are already sending and receiving data from device to cloud and vice versa under device management. Now Looking for REST over MQTT implementation inside custom widget to display dynamic data.
It would be great if we also get the alarm subscription example inside custom widget.

Error messages / full error message screenshot / log fileL

Is your question related to the free trial, or to a production (customer) instance?

Have you installed all the latest fixes for the products and systems you are using?

Hi @sudarshan.karande

there is not REST API over MQTT just the REST API which you might use in your widget.

I would urge you to read either the documentation or the following knowledge base articles:
https://cumulocity.com/guides/web/libraries/#client

http://resources.cumulocity.com/documentation/websdk/client/classes/alarmservice.html
http://resources.cumulocity.com/documentation/websdk/client/classes/eventservice.html

It is pretty simple to use the @c8y/client to read alarms (even on real-time) and visualize them in any widget / ui component.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.