I’m trying to add a MIPItem (or multiple) to the sourcelist of an existing alarmdefintion from a plug-in in the Management Client.
In the code I set the sourcelist as followed by example:
if(alarmDefinition != null)
{
string sourcelist = alarmDefinition.SourceList;
if (sourcelist == "")
{
sourcelist += "MIPItem\[" + mipitem.FQID.ObjectId.ToString() + "\]";
}
else
{
sourcelist += ";MIPItem\[" + mipitem.FQID.ObjectId.ToString() + "\]";
}
alarmDefinition.SourceList = sourcelist;
ValidateResult validateResult = alarmDefinition.ValidateItem();
if (validateResult.ValidatedOk)
{
alarmDefinition.Save();
}
}
If I run this code I get the error:
PATCH Unexpected statuscode BadRequest in ‘https:///API/rest/v1/alarmDefinitions/57207d22-afae-49cb-8c63-f4a9cb5f8810’ - Bad request: The ‘path’ is not a valid/recognized path:mipItems/d60d3fdc-f582-4193-97e3-296a9973aad2;MIPItem[2c5e153d-0c72-4785-bd4f-5acb377dd497]
Parameter name: path
To be clear, I changed for the purpose of this post, the correct FQDN is shown on my side.
So it seems the validae works but when Save() is called, the path parameter is changed to mipitems/GUID. In the error, the first mipItems/d60d3fdc-f582-4193-97e3-296a9973aad2 is the one that is already in the alarmdef and was added manually, the second MIPItem[2c5e153d-0c72-4785-bd4f-5acb377dd497] was added using this code.
Maybe adding a MIP item to sourcelist not allowed/supported in SDK?
Is there another way to do this?