I can imagine. Sorry about that.
I have a couple of HTTP methods defined for CRUD of tags. See below the resource tag
. This works as expected. This is what we talked about earlier. Like e.g. when I update a tag I provide the paths and values. When I read the tag I only provide the paths. And so on…
What I would like to do is to add a resource to update the tag quality. In the example below the resource is called setTagQuality
. I believe that I only need to (and can) provide the paths and qualities.
Suppose a tag is updated every 30 seconds and the latest value is 4. If the tag is not updated for let’s say 60 seconds I want to set the quality to Uncertain
and keep the latest value of 4. Note that I do not have this value ready anymore so I cannot send it in the body of the API call. It is stored in the tag value itself. So I think I need to retrieve it using system.tag.read*
and afterwards write it using system.tag.write*
.
setTagQuality
Update
def doPut(request, session):
from com.inductiveautomation.ignition.common.model.values import BasicQualifiedValue, QualityCode
paths = request['data']['paths']
values = system.tag.readBlocking(paths)
qualities = request['data']['qualities']
qvals = [qv.derive(getattr(QualityCode, quality, 'Uncertain')) for qv, quality in zip(values, qualities)]
result = system.tag.writeBlocking(paths, qvals)
return {'json': result}
tag
Create
def doPost(request, session):
basePath = request['data']['basePath']
tags = request['data']['tags']
collisionPolicy = request['data']['collisionPolicy']
result = system.tag.configure(basePath, tags, collisionPolicy)
return {'json': result}
Details about system.tag.configure can be found here.
Read
def doGet(request, session):
values = system.tag.readBlocking(request['data']['paths'])
return {'json': values}
Details about system.tag.readBlocking can be found here.
Update
def doPut(request, session):
paths = request['data']['paths']
values = request['data']['values']
result = system.tag.writeBlocking(paths, values)
return {'json': result}
Details about system.tag.writeBlocking can be found here.
Delete
def doDelete(request, session):
paths = request['data']['paths']
result = system.tag.deleteTags(paths)
return {'json': result}
Details about system.tag.deleteTags can be found here.