What is the best way to get the min and max timestamp of a stream thru the rest api ?
thru https://XXX/piwebapi/streams/<webId>/recorded?maxCount=1 for the first point
thru https://XXX/piwebapi/streams/<webId>/end for the last point
or thru a better command ?
And if it used
I will obtain the first record (without any filtering on the "goodness" for example)
I am again referring our public PI Web API endpoint. While there is the option to use query parameters as exercised with Pi Web API, stream number of points, my idea in this case would be reading values and timestamps from the response and to identify oldest and newest timestamp client side.
With GetRecorded, the default query period is one day (starttime=*-1d&endtime=*). Sticking with the PI Point (CDT158) used earlier, you get a good number of events. Please try https://devdata.osisoft.com/piwebapi/streams/P0W6Wlk0_Utku9vWTvxg45oAAwAAAAUElTUlYxXENEVDE1OA/recorded and you will see a response in JSON format which can be understood as a collection of event objects consisting of properties Timestamp, Value, UnitsAbbreviation, Good, Questionable and Substituted. Depending on the programming language you are using parsing the JSON response to an object is more or less effort. However, iterating through the object and reading the required information from the properties, is a good approach.
Please allow me to repeat that all timestamps are UTC.
Retrieving data ...