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

**URL:** <https://community.cumulocity.com/t/how-to-call-rest-api-and-subscribe-for-notification-event-from-custom-widget/7774>\
**Category:** Forum\
**Tags:** Angular, cumulocity-edge, mqtt, cumulocity\
**Created:** [April 18, 2023, 12:13pm UTC](https://community.cumulocity.com/t/how-to-call-rest-api-and-subscribe-for-notification-event-from-custom-widget/7774 "2023-04-18T12:13:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sudarshan.karande](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@sudarshan.karande](https://community.cumulocity.com/u/sudarshan.karande)\
**Post date:** [April 18, 2023, 12:13pm UTC](https://community.cumulocity.com/t/how-to-call-rest-api-and-subscribe-for-notification-event-from-custom-widget/7774/1 "2023-04-18T12:13:55Z")

</div>

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?_

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [April 18, 2023, 12:42pm UTC](https://community.cumulocity.com/t/how-to-call-rest-api-and-subscribe-for-notification-event-from-custom-widget/7774/2 "2023-04-18T12:42:16Z")

</div>

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:

> **[Cumulocity documentation](https://cumulocity.com/docs/)**
>
> This documentation offers comprehensive information on the Cumulocity platform both from a user and from a developer perspective. It reflects the latest state of the Cumulocity platform and is continuously updated to align with recent software...

> [@Cumulocity IoT Web Development Tutorial - Part 3: Query data from Cumulocity IoT](https://community.cumulocity.com/t/cumulocity-iot-web-development-tutorial-part-3-query-data-from-cumulocity-iot/7678):
>
> [Cumulocity IoT Web Development Tutorial - Part 1: Start your journey](https://community.cumulocity.com/t/cumulocity-iot-web-development-tutorial-part-1-start-your-journey/4124)[Cumulocity IoT Web Development Tutorial - Part 2: Create your first component](https://community.cumulocity.com/t/cumulocity-iot-web-development-tutorial-part-2-create-your-first-component/5569) Cumulocity IoT Web Development Tutorial - Part 3: Query data from Cumulocity IoT [Cumulocity IoT Web Development Tutorial - Part 4: Convert component into a widget](https://community.cumulocity.com/t/cumulocity-iot-web-development-tutorial-part-4-convert-component-into-a-widget/2873)[Cumulocity IoT Web Development Tutorial - Part 5: Provide widget as a UI Plugin](https://community.cumulocity.com/t/cumulocity-iot-web-development-tutorial-part-5-provide-widget-as-a-ui-plugin/3926)Part 3 has finally arrived! [about-time] In the [last part](https://community.cumulocity.com/t/cumulocity-web-development-tutorial-part-2-create-your-first-component/5569) you have implemented your first componen…

[http://resources.cumulocity.com/documentation/websdk/client/classes/alarmservice.html](http://resources.cumulocity.com/documentation/websdk/client/classes/alarmservice.html)  
[http://resources.cumulocity.com/documentation/websdk/client/classes/eventservice.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.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [October 15, 2023, 12:42pm UTC](https://community.cumulocity.com/t/how-to-call-rest-api-and-subscribe-for-notification-event-from-custom-widget/7774/3 "2023-10-15T12:42:19Z")

</div>

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