BioStar 2 API has an API to retrieve event logs : /api/events/search


Refer to the following article for guidance on  how to use the API : BioStar 2 New Local API Quick Start Guide(5) - Retrieve Log Data


When you call the /api/events/search API, you'll get a response that looks like the following : 



'server_datetime' field is the time that the DB was synchronized to the server. 

It is not the time that the event actually occurred on the device. 

This is in the timezone that is set in BioStar 2 settings. 


'datetime' field is the time that the event actually occurred on the device. 

This is in UTC-0


It might seem inconvenient that the datetime is in UTC-0 instead of the time that is set on the device. 

Unfortunately, the integrating party will have to do the calculation themselves if they want to translate it into device's timezone setting. 


If you intend to do this calculation, 'timezone' field from the API response will be helpful. 

This field indicates which timezone the device that the event occurred on is set to.



How to interpret 'timezone' field

 

Under 'timezone' field, 

'half' 

    -> if minutes offset % 60 == 0, 'half' value will be 0 

   -> if minutes offset % 60 != 0, 'half' value will be 1

'hour'

   -> hours offset

'negative'

   -> if timezone is behind UTC-0, 'negative' value will be 1 

   -> if timezone is ahead UTC-0, 'negative' value will be 0


For example : 

if UTC+9 was set on a device and you observe an event log that occurred on this device, 

the 'timezone' field of the API response will show, 

 

"timezone" : {

   "half" : "0",

   "hour" : "9", 

   "negative" : "0"

},