Skip to main content
1-Visitor
April 26, 2018
Solved

Getting/Retrieving the Alert Configuration

  • April 26, 2018
  • 2 replies
  • 2465 views

Hello,

I have created a Thingtemplate, having certain numeric properties and I have also configured the Alerts for those properties. I would like to know, if I can get the 'Config' of those alerts, in exactly same way as they are shown in Composer. To make my point more understandable about what 'Config' I am talking about, please refer the attached image.

I want to show that aspect just for informative purpose. I mean even if I can get that data as metadata for any alert or by any other means. Other option is I can generate it myself, but that would require many checks and validations and I wanted to avoid that.

Thanks in Advance

Regards

Aditya Mittal

Best answer by amittal-3

Hi Zyuan,

Thanks for your reply. Actually I did find a way to get the information I required using the same service you mentioned.

Just for the benefit of others, I would post the sample of on how to get this information using our own custom method. This can be extended to meet other needs, but I hope it would be a good starter for people who might need this. Pseudo logic attached as a file in this reply.

Regards

Aditya

2 replies

14-Alexandrite
April 27, 2018

Aditya,

 

There is not a standard service to retrieve this information in a simple structure.  You would need to do a rest call to the platform to get the definition of the Thing (what composer does) and parse the xml or Json for that information.  To do this you would use the ContentLoaderFunction resource and do a GetXML call to the localhost.

 

You can also view this in the browser by calling http://localhost/Thingworx/Things/ThingName?method=get&Accept=application/json

(or text/xml)

 

In that output there is an aspect named effectiveAlertConfiguration which is where you will find the information in question.

 

Thanks,

Adam

amittal-31-VisitorAuthor
1-Visitor
April 30, 2018

Thanks Adam for your response, I'll try to have a look through your proposed solution. Meanwhile I was able to get the information I need through the custom service.

Thanks

Aditya

5-Regular Member
April 28, 2018

Hi Aditya,

 

You may need to apply the GetAlertDefinitions service available in Generic service in every entity.

amittal-31-VisitorAuthorAnswer
1-Visitor
April 30, 2018

Hi Zyuan,

Thanks for your reply. Actually I did find a way to get the information I required using the same service you mentioned.

Just for the benefit of others, I would post the sample of on how to get this information using our own custom method. This can be extended to meet other needs, but I hope it would be a good starter for people who might need this. Pseudo logic attached as a file in this reply.

Regards

Aditya