How to invoke microservice from widget on request

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

Hi,

There is a guide related to same topic. Please refer.



Bishan T Prasad

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?

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.

1 Like

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

You can find relevant documentation for Cumulocity UI development in the codex and in the general documentation. Information on how to access a Microservice from a component can be found here. 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