tests:api: re-factor test to collect common code
api: fix incorrect parsing of observation start time