# How to invoke microservice from widget on request

**URL:** <https://community.cumulocity.com/t/how-to-invoke-microservice-from-widget-on-request/4100>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [February 7, 2024, 1:19pm UTC](https://community.cumulocity.com/t/how-to-invoke-microservice-from-widget-on-request/4100 "2024-02-07T13:19:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidelh](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@davidelh](https://community.cumulocity.com/u/davidelh)\
**Post date:** [February 7, 2024, 1:19pm UTC](https://community.cumulocity.com/t/how-to-invoke-microservice-from-widget-on-request/4100/1 "2024-02-07T13:19:40Z")

</div>

#### _ **Product/components** used and **version/fix** level:_

Cumulocity 1018.503.1

#### _Detailed explanation of the problem:_

I’d like to visualize on a widget the output of a custom microservice only after user’s explicit request. Suppose I have developed a custom microservice that computes a KPI based on a series of measurements or that invokes a standard Cumulocity API (for example “create an alarm”). What I want is to have the possibility to manually invoke the microservice from a widget whenever I need it, without using automatic rules (such as Smart Rules or Apama models). Once invoked, I’d also like to view the output on the widget (could be a graph or a table or just a number displayed). Is there some standard component of Cumulocity that allows doing this or it is required a custom implementation?  
Thank you in advance for your help

#### _Question related to a **free trial** , or to a **production (customer)** instance?_

Production

---

<div class="post-metadata">

**Author:** ![Bishan\_T\_Prasad](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Bishan\_T\_Prasad](https://community.cumulocity.com/u/Bishan_T_Prasad)\
**Post date:** [February 12, 2024, 10:32am UTC](https://community.cumulocity.com/t/how-to-invoke-microservice-from-widget-on-request/4100/2 "2024-02-12T10:32:49Z")

</div>

Hi,

There is a [guide](https://cumulocity.com/docs/web/tutorials/#requesting-data-from-a-custom-microservice) related to same topic. Please refer.

  

* * *

Bishan T Prasad

[Software AG Professional Services](https://www.softwareag.com/en_corporate/resources/services/professional-services.html)

[![](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/c/3/c3a93a2618e4708f51be40fe2e142061f7c4edc7.jpeg)](https://www.softwareag.com/en_corporate/resources/services/fast-track-services.html)

---

<div class="post-metadata">

**Author:** ![davidelh](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@davidelh](https://community.cumulocity.com/u/davidelh)\
**Post date:** [February 14, 2024, 10:31am UTC](https://community.cumulocity.com/t/how-to-invoke-microservice-from-widget-on-request/4100/3 "2024-02-14T10:31:37Z")

</div>

Thanks, the guide is absolutely helpful, but it refers to custom widget development. As far as I understand, there is no standard component of Cumulocity that allows to invoke a micorservice on request, correct?

---

<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:** [February 14, 2024, 11:10am UTC](https://community.cumulocity.com/t/how-to-invoke-microservice-from-widget-on-request/4100/4 "2024-02-14T11:10:25Z")

</div>

There is no standard component to do that because all microservice endpoints look totally different from URL and payload perspective. Without an API documentation like Open API it is impossible know which endpoint must be called and the expected response codes & bodies.

---

<div class="post-metadata">

**Author:** ![davidelh](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@davidelh](https://community.cumulocity.com/u/davidelh)\
**Post date:** [March 7, 2024, 10:56am UTC](https://community.cumulocity.com/t/how-to-invoke-microservice-from-widget-on-request/4100/5 "2024-03-07T10:56:40Z")

</div>

Hi Bishan, the link you posted does not work anymore… I found those tutorials useful, but now as far as I understand, the Web SDK has been updated and they are not available anymore. Do you by any chance know if there is an updated version or an alternative to those tutorials? The need is always to understand how to extend an existing widget or to create a new one. Thank you

---

<div class="post-metadata">

**Author:** ![Christian\_Guether1](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/christian_guether1/32/14848_2.png) [@Christian\_Guether1](https://community.cumulocity.com/u/Christian_Guether1)\
**Post date:** [March 7, 2024, 11:10am UTC](https://community.cumulocity.com/t/how-to-invoke-microservice-from-widget-on-request/4100/6 "2024-03-07T11:10:17Z")

</div>

You can find relevant documentation for Cumulocity UI development in the [codex](https://styleguide.cumulocity.com/apps/codex/#/) and in the [general documentation](https://cumulocity.com/docs/section/app_enablement/). Information on how to access a Microservice from a component can be found [here](https://styleguide.cumulocity.com/apps/codex/#/getting-started/guides/data-access/overview). You can also check the tutorial application, if you want to see how components can be used or how to implement certain concepts.

Best regards

  

* * *

Christian Guether

[Software AG Professional Services](https://www.softwareag.com/en_corporate/resources/services/professional-services.html)

[![](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/c/3/c3a93a2618e4708f51be40fe2e142061f7c4edc7.jpeg)](https://www.softwareag.com/en_corporate/resources/services/fast-track-services.html)

---

<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:** [September 3, 2024, 11:11am UTC](https://community.cumulocity.com/t/how-to-invoke-microservice-from-widget-on-request/4100/7 "2024-09-03T11:11:02Z")

</div>

Closed on September 3, 2024, 11:11am UTC

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