Releasesv0.1.0
Api referenceEndpointsAdmin

Fill a user of a tenant with synthetic data (instance admin)

POST
/v1/admin/tenants/{tenant_id}/demo-user

What ohs seed --demo --tenant does: the tenant's user with external_ref is reused, or created, and days days of made-up data from the persona's sources (six for mix), ending yesterday, are written for it. Every record is marked {"synthetic": true}. Running it again adds nothing for the days already there. Takes a few seconds for 90 days. Recorded as data.write in the caller's audit log and in the tenant's. See docs/demo.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

Header Parameters

Authorization*string

The tenant API key, as a bearer secret.

Request Body

application/json
  1. body
external_ref?string

The user to fill, created when the tenant has none with this reference. By default demo-user for mix and demo-<persona> for the others, so each persona fills its own.

Length1 <= length <= 255
days?integer

Days of data, ending yesterday.

Range1 <= value <= 90
Default30
persona?string

The kind of person: mix (one person seen through six sources), runner (polar, whoop, apple_health), sleep (a short, irregular sleeper: oura, apple_health) or weight (someone watching their weight: withings, fitbit). See docs/demo.md.

Default"mix"
Value in"mix""runner""sleep""weight"

Response Body

The user existed; the days it lacked were written.

application/json
  1. response
user*
days*integer
rows_written*integer

Rows this call stored; 0 when every day was already there.

persona*string

The persona written.

Value in"mix""runner""sleep""weight"
curl -X POST 'http://localhost:8080/v1/admin/tenants/497f6eca-6276-4993-bfeb-53cbbbba6f08/demo-user' \  -H 'Authorization: Bearer ohs_sk_...' \  -H 'Content-Type: application/json' \  -d '{}'
{  "user": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "external_ref": "string",    "status": "active",    "created_at": "2019-08-24T14:15:22Z"  },  "days": 0,  "rows_written": 0,  "persona": "mix"}
Edit on GitHub