using the rest api to query multiple XID pointValues versus single XID
-
Hello-
Using the swagger REST API, is there a way to pass an array of XID to the point-values or the /v1/realtime api and the output would return a JSON set of results? Passing one XID per REST call seems like it would be too intensive. For example, I'd like to get the values of the points in a specific hierarchy. I can scrape the XID from the pointHierarchy and then iterate for each XID but that doesn't seem optimal. Any idea for improvement?
Thanks,
Dan
-
Dan,
There is no way to currently get a list of realtime values for multiple points by filtering by data point XID. The next release of Mango will have some RQL endpoints. I can see if I can put it in for the realtime endpoint, this would allow you to perform SQL-like queries via the URL such as:
http://localhost:8080/rest/v1/realtime.json?in(xid,(DP_1,DP_1))&limit(100)
More on RQL here: https://github.com/persvr/rql
For now you could just request ALL the realtime data and filter it by XID on the client side. See this:
http://localhost:8080/rest/v1/realtime.json?limit=100
Where the limit is greater than or equal to the number of points in your Point Hierarchy.
-
any follow up on this feature?
-
This has been implemented in Mango 2.6.x and above when you have the mangoApi module installed.
Using RQL:
http://mangohost:mangoport/rest/v1/realtime?xid=DP_xxx0|xid=DP_xxx1
There is no explain endpoint on this controller yet so you will have to play around with what you can and cannot achieve via RQL.
-
I've tried this and I'm getting
url: "/rest/v1/realtime?xid=DP_353314|xid=DP_369714|xid=DP_154277"
Request Method:GET
Status Code:406 Not Acceptable -
I'm having mangoApi 1.1.0 - *** unlicensed *** installed
-
I've tested it on the 1.1.1 module that is about to be released with Mango 2.7.0 this week and it works fine with that version. You may have to wait as I'm not 100% sure when that feature was added.