anybody knows how to construct a web api query to find all the attributes with defined name and their current values within specified root element (the expected attributes are in multi-layer child elements) ?
If you have the webID's of all the attributes, you may look into the StreamSet>GetValuesAdHoc method introduced in PI Web API 2015 R2, which allows you get current values for a list of attributes identified by webID.
To query for the list of attributes in the first place, you can use Attribute>GetAttributes method, which accepts a list of query parameters, so you can find the attribute by name, template, category, etc.
Does these methods meet your requirements? How many attributes are there?
Thanks for reply.
Can you give me an example to do that? I am not a programmer and not quite familiar with PI web api query. Really appreciate your help.
Here is what we wanted.
We have one root element with multi layers of child elements. The lowest level elements are built with the same template and there is one attribute named “The Link” at each element. We want to find out all attributes with the name “the link” and with its value.
Jun Du | Industrial Evolution
10080 Jasper Ave, Suite 1101, Edmonton, AB, T5J 1V9, Canada
Office: +1 (780) 423-9003 | Mobile: +1 (780) 901-8860
Email: <mailto:email@example.com> firstname.lastname@example.org
Hi Jun Du,
You can try using the search crawler as it can crawl the whole database like this:
Take note that this query will only display values for attributes with no DR. To get the values of those with DR, you will still need to use the adhoc method of Streamset after obtaining the webids.
Sure we can provide an example. First, we'd like to know in what programming language and/or platform this functionality will be developed in?
You may be interested in the following examples:
The online doc and the new Getting Started section is helpful: PI Web API
Using PI Web API on HTML5 with jQuery
Learn the Basics of PI Programming - Developing a Web Application With jQuery and PI Web API
General intro (probably best to start here):
Getting started with PI Web API
Learn the Basics of PI Programming - Simple PI Web API Calls
It's a lot of upfront documentation/examples but I think it's helpful to understand the RESTful design of PI Web API in general so additional use cases can be constructed from the basic patterns presented above. I'll try to post a more customized example for this use case later on.
Thanks for the help.
Retrieving data ...