Releasesv0.1.0
Api referenceEndpointsSelf reports

Record the user's own ratings

POST
/v1/users/{id}/self-reports

1 to 100 self reports: how the person feels, their mood, stress, energy, sleep quality, muscle soreness, the effort of a session or pain, each a whole number on the kind's scale (docs/self-reports.md). Each report is stored as a quantity sample of type reported_<kind> from the source self_report, read back like any other sample (/samples, /samples/stats, FHIR with category survey, exports). Sending a report again with the same id replaces its value, also when start_at moved. The reports go through the same processing as an upload, so the answer is 202. A tenant key records reports for any user of the tenant; a user token with scope upload only for its own user, and another user is a 404. Values are health data: never logged, never quoted in an error. While the user's self reports are being deleted the answer is 409 and nothing is kept.

Authorization

headerAuthorizationBearer <token>

Tenant API key, ohs_sk_ + 43 base62 characters.

Path Parameters

id*string
Formatuuid

Header Parameters

Idempotency-Key?string
Length1 <= length <= 255
Authorization*string

The tenant API key, as a bearer secret.

Request Body

application/json
  1. body
reports*array<>
Items1 <= items <= 100

Response Body

Stored, and queued for processing.

application/json
  1. response
reports*array<>

The reports as stored, in request order, each with its id.

duplicate*boolean

true when these exact reports had already been received.

curl -X POST 'http://localhost:8080/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08/self-reports' \  -H 'Authorization: Bearer ohs_sk_...' \  -H 'Content-Type: application/json' \  -d '{  "reports": [    {      "kind": "feeling",      "value": 0,      "start_at": "2019-08-24T14:15:22Z"    }  ]}'
{  "reports": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "kind": "feeling",      "type": "reported_feeling",      "value": 0,      "start_at": "2019-08-24T14:15:22Z",      "end_at": "2019-08-24T14:15:22Z",      "timezone": "string"    }  ],  "duplicate": true}
Edit on GitHub