Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello Adam,
I met a trouble when i tried to create an alert on a property. I found the service "AddOrUpdateAlert" and wrote an example in below.
// test example var table = attributes.alertAttributes; var params = { alertType: "Above" /* STRING */, alertName: "h_above" /* STRING /, property: "humidity" / STRING /, description: "humidity above threshold value" / STRING /, attributes: ???? / INFOTABLE /, priority: 1 / INTEGER /, persistent: true / BOOLEAN /, enabled: true / BOOLEAN */ }; me.AddOrUpdateAlert(params);
But there is a parameter that called "attributes" and type is INFOTABLE. I want to know what is mean about this parameter. Can you give me some advice/hint about how to create/modify an alert ? Thank you so much for your always support.
Hi Hirotaka,
The attributes parameter is where you specify the value or values for the alert. This needs to be documented, but since you provided a code sample for the alert you want to create, I can provide the following snippet which will create an
InfoTable
that will work for your particular use case.var alertAttributes = Resources["InfoTableFunctions"].CreateInfoTable();
alertAttributes.AddField();
alertAttributes.AddField();
alertAttributes.AddRow();</div></div></p>
Hi Adam,
Hi
Actaully I am new thingworx.Can you please share the Alert code, I tried alert but not work
Hi Adam,
Do you know how can I do the same thing with REST API calls, imagine a web site using thingworx only with its REST calls, so in my case, I dont know what would replace the snippet you gave.
Anyway, So, What I would like to do is to make a POST request to add an alert and I would like to send the following JSON like Hirotaka:
{alertType: "Above",
alertName: "h_above",
property: "humidity",
description: "humidity above threshold value",
attributes: ????
}
any ideas?
Thanks