3 Replies Latest reply on Apr 25, 2017 8:49 PM by pmartin

    PI Web API EventFrame Search by Attribute

    halla

      Hey guys, I'm trying to use the PI Web API (2016 R2) to search for Event Frames based off of an attribute value.
      I can successfully get the event frames back with the below query, however, I can't seem to figure out how to specify date ranges?

      It seems like it just returns the event frames within the default *-8h to * time range.

       

      I've tried adding a StartTime and EndTime attribute inside the body (highlighted in Red) but it seems to ignore it.
      I've also tried specifying the times as parameters in the URL with no change in behavior.
      (e.g: ../piwebapi/eventframes/searchbyattribute?startTime=*-10d&endTime=*)

       

      Is this possible with searchbyattribute with event frames?

       

       

      HTTP POST:

      https://server.com/piwebapi/eventframes/searchbyattribute

       

      Body:

                  {

                      "ElementTemplate":"T0kI9ylUHMNECqRsYzS0N1LQvgQXOUbvzU-Y11w1s027EAQVNTRVRTLlVTQVBJLkRWTi5DT01cQ09NUExFVElPTlNcRUxFTUVOVFRFTVBMQVRFU1tFVkVOVCBUQUdd",

                      "ValueQueries":

                      [

                          {

                              "AttributeName":"Business Unit",

                              "AttributeValue":"ANADARKO BASIN",

                              "SearchOperator":"Equal"

                          }

                      ],

                      "startTime":"4/1/2017",

                      "endTime":"*",

                      "selectedFields":"Items.Name"

                  }

       

        • Re: PI Web API EventFrame Search by Attribute
          pmartin

          Hi Amos,

           

          This action produces an endpoint that can be reused at a later date with a start and end time specified.  The endpoint information can be found in the returned "Location" header.

          It should look something like: https://<server>/piwebapi/eventframes/searchbyattribute/<id>

           

          Then to get data for a particular time range you would do

          <your url>?startTime=<st>&endTime=<et>

          2 of 2 people found this helpful