Proficy Historian RestAPI - retrieving interpolated data with tags which contain "#"

535 Views Asked by At

I am having trouble accessing interpolated data for tags that contain either "#" or "/" from a proficy historian using the restAPI. I am able to get interpolated data for all other tags.

e.g. accessing interpolated data with tagName: Tag123#Value

oauth.get("https://<server>:8443/historian-rest-api/v1/datapoints/interpolated/Tag123%23Value/<starttime>/<endtime>/0/60000")

returns

error code 400 - request was malformed.

However I am able to the get the current value for Tag123#Value

oauth.get("https://<server>:8443/historian-rest-api/v1/datapoints/currentvalue?tagNames=Tag123%23Value")

note: I am already URI encoding the tag which enables me to retrieve current values - however I suspect the problem is something to do with URI encoding ...

1

There are 1 best solutions below

0
Drahc On

From my experience setting up a Python script to request data via the procincy historian rest api you should be able to translate all backslashes (\) to astrisks (*):

https://<historianservername>:8443/historian-rest-api/v1/datapoints/interpolated/test\tag_with\\weirdcharch/2022-5-9T01:13:00.0Z/2022-5-10T:01:13:00.0Z/0/600000 Gives: 404 error in curl

https://<historianservername>:8443/historian-rest-api/v1/datapoints/interpolated/test%5Ctag_with%5C%5Cweirdcharch/2022-5-9T01:13:00.0Z/2022-5-10T:01:13:00.0Z/0/600000 Gives: tag not found

https://<historianservername>:8443/historian-rest-api/v1/datapoints/interpolated/test*tag_with**weirdcharch/2022-5-9T01:13:00.0Z/2022-5-10T:01:13:00.0Z/0/600000 Gives: queried data I was looking for

Note that: from the debug prints I was able to try, I noticed that in curl, backslashes get translated to front slashes so it tried looking at this directory with the first link as input: https://<historianservername>:8443/historian-rest-api/v1/datapoints/interpolated/test/tag_with//weirdcharch/2022-5-9T01:13:00.0Z/2022-5-10T:01:13:00.0Z/0/600000 Which i think is the cause for the 404 error

Edit: note that this was done in Proficy Historian version 9.0!!