AnsweredAssumed Answered

How to get all elements attibute value in a single/limited query

Question asked by Shanseenu on Apr 5, 2016
Latest reply on Apr 6, 2016 by Shanseenu

Hi

 

How to fetch attribute values of all leaf elements using limited or single REST query.

 

EGs

 

For the given hierarchy structure, how to get the attribute (Attrib1) value for all the elements AAA1 to DDD1 (from all Parents) using single/Limited HTTP request to PI server (using REST qry)

 

Root

-----Segment1

----------Parent1

---------------AAA1 ---> Attrib1=5;Attrib2=10

---------------BBB1 ---> Attrib1=2;Attrib2=43;Attrib3=A

---------------CCC1 ---> Attrib1=32;Attrib3=B

---------------DDD1 ---> Attrib1=2;Attrib2=33

----------Parent2

---------------AAA1 ---> Attrib1=22;Attrib2=20

---------------BBB1 ---> Attrib1=12;Attrib2=2;Attrib3=C

---------------CCC1 ---> Attrib1=21;Attrib3=D

---------------DDD1 ---> Attrib1=233;Attrib2=22

 

https://<ServerHost>/piwebapi/attributes?path=\\<AF DB>\Root\Segment1\Elements[@Name=Parent*]\Elements[@Name=*1]|Attributes[@Name=Attrib1]

 

This rest returns the value for only one instance of indexed element. we need to increment the element index (as shown below) to fetch the next set of values.. If there a way to get the "Attrib1" values for all the elements (AAA1 to DDD1) in both the parents using single REST request.

 

https://<ServerHost>/piwebapi/attributes?path=\\<AF DB>\Root\Segment1\Elements[@Name=Parent*]\Elements[@Name=*1][2]|Attributes[@Name=Attrib1]

https://<ServerHost>/piwebapi/attributes?path=\\<AF DB>\Root\Segment1\Elements[@Name=Parent*]\Elements[@Name=*1][3]|Attributes[@Name=Attrib1]

...

..

 

 

thanks

Outcomes