Hi dstoryQuest, welcome to the forum!
Have you checked the bookend option on the existing /rest/v2/point-values endpoints? Most include a "bookend" boolean request parameter that will add one, possibly two data values to the data returned which are,
- Bookend start value - the value the point had at the start millisecond of the period. If there was a sample exactly at that time it is a real value, otherwise it is marked as a bookend and presented as having the same timestamp as the requested period start time.
- Bookend end value - the last value in the period or the start value, presented with the period end timestamp. Because all Mango time queries have an inclusive start time but an exclusive end time, the value presented as the closing bookend is always flagged as a bookend value (as opposed to being a real value at that time, since even if there were one it would be excluded by the end time being exclusive)
So that's slightly different than what you're requesting since the timestamps match the times for the period requested, but I suspect that is nicer behavior for a user requesting a specific time period. There is not a way through the API to query for one additional value on either side of a period, but there is support for that in the NoSQL database (which is what we're using, just possibly fibbing on the timestamps), so it would be easy to add. We chose what we did to not affect the time period covered in the result.