Releasesv0.1.0
Api referenceEndpointsAdmin

Statistics of one quantity type per hour or per local day (instance admin, one tenant)

GET
/v1/admin/tenants/{tenant_id}/users/{id}/samples/stats

GET /v1/users/{id}/samples/stats (sampleStats) for the tenant of tenant_id, read with an instance admin key: the same parameters and the same answer as the tenant's own key gets. Read only. Recorded in the caller's audit log and, actor admin, in the tenant's. See docs/admin-api.md.

Authorization

tenantKey
headerAuthorizationBearer <token>

Tenant API key, ohs_sk_ + 43 base62 characters.

Path Parameters

tenant_id*string

The id of a tenant; any other value is a 404.

Formatuuid
id*string
Formatuuid

Query Parameters

type*string

Canonical quantity type, as for listSamples.

interval?string

Width of the intervals.

Default"day"
Value in"hour""day"
tz?string

IANA time zone of the intervals; a day runs from local midnight to local midnight.

Default"UTC"
start*|

Inclusive lower bound, RFC 3339 or YYYY-MM-DD (midnight in tz). Widened to a whole interval.

end*|

Exclusive upper bound, RFC 3339 or YYYY-MM-DD (midnight in tz). Widened to a whole interval; at most 10000 intervals after start.

provider?string

Keep one provider.

view?string

merged (the default): when several sources recorded the same thing (a ring and a watch the same night, a phone and a watch the same steps, one sample directly and through an aggregator), only the best ranked source's record is listed, so nothing counts twice. The order of sources is the user's (see source-priorities). all: every stored record of every source.

Default"merged"
Value in"merged""all"

Header Parameters

Authorization*string

The tenant API key, as a bearer secret.

Response Body

The intervals that hold samples, by start, provider, source and unit.

application/json
  1. response
type*string
interval*string
Value in"hour""day"
tz*string
view*string
Value in"merged""all"
start*string

Start of the range after widening, with the offset of tz.

Formatdate-time
end*string
Formatdate-time
truncated*boolean

True when more than 50000 rows matched; buckets holds the earliest.

buckets*array<>
curl -X GET 'http://localhost:8080/v1/admin/tenants/497f6eca-6276-4993-bfeb-53cbbbba6f08/users/497f6eca-6276-4993-bfeb-53cbbbba6f08/samples/stats?type=string&start=2019-08-24T14%3A15%3A22Z&end=2019-08-24T14%3A15%3A22Z' \  -H 'Authorization: Bearer ohs_sk_...'
{  "type": "string",  "interval": "hour",  "tz": "string",  "view": "merged",  "start": "2019-08-24T14:15:22Z",  "end": "2019-08-24T14:15:22Z",  "truncated": true,  "buckets": [    {      "start": "2019-08-24T14:15:22Z",      "provider": "string",      "source": "string",      "unit": "string",      "count": 0,      "sum": 0,      "avg": 0,      "min": 0,      "max": 0    }  ]}
Edit on GitHub