Product/components used and version/fix level are you on:
Backend: 1015.0.278
UI: 1011.0.38
Detailed explanation of the problem:
Hi ,
I have created custom widget using run time widget on top of application builder and i am able to see my modified custom widget take look of screen shot below how my widget is look like
here I have just passed hardcoded values which we are able to see in custom widget screenshot now, I want to show alarms field values in this custom widget same as i am showing in my web application which is looks like
here all the alarm values i am fetching from Alarm rest API (http://10.5.1.120:8090/rest-api/getEventNotificationList) now i want same thing to do in my custom widget so that i can show my alarm rest API data i don’t know how to start where to start for this i just want alarms in my custom widget code my IDE is look like
For me this is not a widget issue but an agent issue.
You need to have a device agent which retrieves the alarms from the “internal” REST API and publish it to C8Y. This should run on the device in a scheduled job or, even better, web hook endpoint to get informed about new alarms. You cannot and should not solve that by just using a widget which somehow tries to fetch any data from any internal API on request… this is really bad design.
If you want to stick to that pattern of requesting alarms (for any reason) you can send an operation to the device agent which receives the operation, fetches the alarms from the internal API and update/create the alarms in C8Y.
So again: Use an agent (running in the same network as the internal API) that retrieves the alarms, map them to c8y domain model and store them in c8y. In that agent you need some sync logic to make sure alarms are not duplicated each time you retrieve them. You can do that by get the alarms from internal API and c8y and check if there are any differences… Use alarm default widget (or adapt them to your needs).
Update: If the alarm REST API is public you can implement a microservice with the same logic described above. Still, no widget implementing the API directly because this could lead to CORS issues.