Dailies ¶
dailies¶
POST /api/v1/dailies/{measure}¶
Upsert Daily
Description
Record one daily value. The scope follows the measure: reproductive_health:write for
the menstrual cycle day, wellness:write for every other measure.
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
HTTPBearer |
header | string | N/A | No | JWT Bearer token |
measure |
path | No | |||
refreshed-token |
header | No | |||
token |
cookie | string | No |
Request body
{
"date": "2022-04-13",
"value": 10.12
}
Schema of the request body
{
"properties": {
"date": {
"type": "string",
"format": "date",
"title": "Date"
},
"value": {
"type": "number",
"title": "Value"
}
},
"type": "object",
"required": [
"date",
"value"
],
"title": "DailyCreate"
}
Responses
{
"date": "2022-04-13",
"value": null,
"status": "stored",
"source": null,
"application_id": null
}
Schema of the response body
{
"properties": {
"date": {
"type": "string",
"format": "date",
"title": "Date"
},
"value": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"title": "Value"
},
"status": {
"$ref": "#/components/schemas/DailyStatus"
},
"source": {
"anyOf": [
{
"$ref": "#/components/schemas/DailySource"
},
{
"type": "null"
}
],
"description": "Who wrote it: `manual` (the athlete), `application` (an app; see `application_id`) or an integration (`garmin_connect`, ...). New values may be added. Set on a stored day only."
},
"application_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Application Id",
"description": "The app that wrote it, with `source` `application`; null when the app was deleted. Set on a stored day only."
}
},
"type": "object",
"required": [
"date",
"value",
"status"
],
"title": "DailyResponse"
}
{
"detail": [
{
"loc": [
null
],
"msg": "string",
"type": "string"
}
]
}
Schema of the response body
{
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}
GET /api/v1/dailies/{measure}¶
List Dailies
Description
The stored values of one measure between two dates. The scope follows the measure:
reproductive_health:read for the menstrual cycle day, wellness:read for every other
measure. History is capped by the app's plan, like activities.
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
HTTPBearer |
header | string | N/A | No | JWT Bearer token |
end |
query | string | No | ||
interpolate |
query | boolean | False | No | |
measure |
path | No | |||
refreshed-token |
header | No | |||
start |
query | string | No | ||
token |
cookie | string | No |
Responses
[
{
"date": "2022-04-13",
"value": null,
"status": "stored",
"source": null,
"application_id": null
}
]
Schema of the response body
{
"type": "array",
"items": {
"$ref": "#/components/schemas/DailyResponse"
},
"title": "Response List Dailies Api V1 Dailies Measure Get"
}
{
"detail": [
{
"loc": [
null
],
"msg": "string",
"type": "string"
}
]
}
Schema of the response body
{
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}
DELETE /api/v1/dailies/{measure}¶
Delete Daily
Description
Delete one daily value. The scope follows the measure, as for recording one.
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
HTTPBearer |
header | string | N/A | No | JWT Bearer token |
date |
query | string | No | ||
measure |
path | No | |||
refreshed-token |
header | No | |||
token |
cookie | string | No |
Responses
{
"detail": [
{
"loc": [
null
],
"msg": "string",
"type": "string"
}
]
}
Schema of the response body
{
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}
POST /api/v1/dailies/{measure}/batch¶
Write Dailies (beta)
Description
Beta. This endpoint is in beta and is subject to breaking changes. If you plan to use it in production, email info@sweatstack.no before you integrate, so we can tell you about changes in advance and help you migrate.
Record up to 1,000 values of one measure in one request, all or nothing: a value out of
the measure's range or a date sent twice is a 422 that lists every such value by its index,
and nothing is written. A stored value is never replaced (existing: keep); each result says
what the day holds afterwards. The scope follows the measure, as for recording one.
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
HTTPBearer |
header | string | N/A | No | JWT Bearer token |
measure |
path | No | |||
refreshed-token |
header | No | |||
token |
cookie | string | No |
Request body
{
"values": [
{
"date": "2022-04-13",
"value": 10.12
}
],
"existing": "string"
}
Schema of the request body
{
"properties": {
"values": {
"items": {
"$ref": "#/components/schemas/DailyValue"
},
"type": "array",
"maxItems": 1000,
"minItems": 1,
"title": "Values",
"description": "1 to 1,000 values, each date once."
},
"existing": {
"type": "string",
"const": "keep",
"title": "Existing",
"description": "What to do with a day that already holds another value. Required. `keep` leaves it as it is, whoever wrote it, including a day older than your app can read."
}
},
"type": "object",
"required": [
"values",
"existing"
],
"title": "DailyBatchCreate",
"description": "Values of one measure, written all or nothing."
}
Responses
{
"results": [
{
"date": "2022-04-13",
"outcome": "written"
}
]
}
Schema of the response body
{
"properties": {
"results": {
"items": {
"$ref": "#/components/schemas/DailyWriteResult"
},
"type": "array",
"title": "Results",
"description": "One per value sent, in the same order."
}
},
"type": "object",
"required": [
"results"
],
"title": "DailyBatchResponse"
}
{
"detail": [
{
"loc": [
null
],
"msg": "string",
"type": "string"
}
]
}
Schema of the response body
{
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}
Schemas¶
DailyBatchCreate¶
| Name | Type | Description |
|---|---|---|
existing |
string | What to do with a day that already holds another value. Required. `keep` leaves it as it is, whoever wrote it, including a day older than your app can read. |
values |
Array<DailyValue> | 1 to 1,000 values, each date once. |
DailyBatchResponse¶
| Name | Type | Description |
|---|---|---|
results |
Array<DailyWriteResult> | One per value sent, in the same order. |
DailyCreate¶
| Name | Type | Description |
|---|---|---|
date |
string(date) | |
value |
number |
DailyMeasure¶
Type: string
DailyResponse¶
| Name | Type | Description |
|---|---|---|
application_id |
The app that wrote it, with `source` `application`; null when the app was deleted. Set on a stored day only. | |
date |
string(date) | |
source |
Who wrote it: `manual` (the athlete), `application` (an app; see `application_id`) or an integration (`garmin_connect`, ...). New values may be added. Set on a stored day only. | |
status |
DailyStatus | |
value |
DailySource¶
Type: string
DailyStatus¶
Type: string
DailyValue¶
| Name | Type | Description |
|---|---|---|
date |
string(date) | |
value |
number |
DailyWriteOutcome¶
Type: string
DailyWriteResult¶
| Name | Type | Description |
|---|---|---|
date |
string(date) | |
outcome |
DailyWriteOutcome | `written`: the day was empty and holds your value now. `unchanged`: it already held this value, so nothing was written. `kept`: it holds another value, which stays. |
HTTPValidationError¶
| Name | Type | Description |
|---|---|---|
detail |
Array<ValidationError> |
ValidationError¶
| Name | Type | Description |
|---|---|---|
loc |
Array<> | |
msg |
string | |
type |
string |
Security schemes¶
| Name | Type | Scheme | Description |
|---|---|---|---|
| HTTPBearer | http | bearer | |
| HTTPBasic | http | basic |