Data Types

TaskType

A TaskType is an enumeration that is presently one of:

There may be other values in the future. Your API should ignore any TaskType it does not understand.

List of Source Data Items

JSON ItemData TypeDescription
itemsArray of Source Data List Entry

Sync Item Item

JSON ItemData TypeDescription
itemCommon

Source Data List Entry

JSON ItemData TypeDescription
itemIdStringId of the Item
dateLongTime of the item as milliseconds since the Epoch in UTC
linksSource Item Links Item
JSON ItemData TypeDescription
fitStringURL for the FIT file (if applicable)
pwxStringURL for the PWX file (if applicable)
tcxStringURL for the TCX file (if applicable)
kmlStringURL for the KML file (if applicable)
kmzStringURL for the KMZ file (if applicable)
csvStringURL for the CSV file (if applicable)
gpxStringURL for the GPX file (if applicable)

Id

JSON ItemData TypeDescription
idStringIdentifier of the item created or changed.

Provider Config

Per-provider configuration carried on a Source Data or a Sync Destination Task. Only the providers that need it populate it.

JSON ItemData TypeDescription
mapsMaps Provider Config
csvCSV Provider Config

Maps Provider Config

Configuration for the Cloud Storage providers. See Cloud Storage File Formats for which file formats support which TaskTypes.

JSON ItemData TypeDescription
fileFormatStringThe file format used for this provider. TCX, GPX, KML, KMZ, PWX, and CSV are only supported for Activity. FIT additionally supports Weight and BloodPressure. FitnessSyncerAPI (FitnessSyncer’s own JSON item format) is supported for every type. Must be one of: TCX, GPX, KML, KMZ, FIT, PWX, CSV, FitnessSyncerAPI
filenameFormatStringTemplate for the generated filename.
pathStringRemote directory path within the provider to store/read files.

CSV Provider Config

Configuration for a source or destination whose file format is CSV, including the column mapping. This applies both to a plain CSV provider and to a Cloud Storage provider whose Maps Provider Config file format is CSV.

Ask GET /descriptions/fileFormats which formats need one: an entry with requiresColumnMapping true cannot be used without it. The columns valid for a given task type and direction come from GET /descriptions/csvColumns — there are several hundred and the set grows over time, so read them rather than hard-coding a list.

JSON ItemData TypeDescription
separatorStringField separator. Defaults to a comma.
quoteStringQuote character wrapping a field that contains the separator.
commentStringRows beginning with this string are skipped.
startingRowIntegerNumber of leading rows to skip before the data begins, for a file with a header or preamble.
localeStringIETF BCP 47 language tag deciding how numbers and dates in the file are parsed, for example fr-FR for a file writing one thousand and a half as 1 234,5.
overrideTimezoneStringTreat timestamps in the file as wall-clock time in this zone rather than in the account’s own. An IANA zone id, for example Europe/Paris.
sumStepsPerDayBooleanTotal the step rows within each day rather than treating each row as its own record.
groupByDateBooleanCombine rows sharing a date into a single record.
groupByMealBooleanFor nutrition, combine rows sharing a meal into a single record.
sendSummaryDataBooleanFor a destination, write the summary totals rather than the per-sample detail.
appendToFileBooleanFor a destination, append to the existing file rather than replacing it.
columnsArray of CSV Column MappingThe column mapping. Absent on a write leaves the stored mapping untouched; present, it replaces the stored mapping in full, so a client removing a row must send the whole remaining set.

CSV Column Mapping

One mapped column. An index says which column of the file feeds this field; a defaultValue supplies a constant when the file has no column for it. A row may carry either or both.

Sending a columns array replaces the stored mapping in full rather than merging into it, so a client removing one row sends the whole remaining set. Omitting the array leaves the stored mapping untouched.

JSON ItemData TypeDescription
columnStringThe FitnessSyncer field this row maps. Fetch the values valid for a given task type and direction from GET /descriptions/csvColumns; there are several hundred and the set is extended over time, so treat an unrecognized value as one this client does not know rather than as an error.
indexIntegerWhich column of the file feeds this field, counting the first column as 1 -- the same numbering the web editor and every spreadsheet tool shows. Omit, or send 0, for a row that only supplies a defaultValue.
defaultValueStringConstant to use for this field when the file carries no column for it.

Provider Authentication

JSON ItemData TypeDescription
providersArray of Provider Authentication ItemList of providers

Provider Authentication Item

JSON ItemData TypeDescription
nameStringThis is the description of the provider for display purposes.
providerTypeStringThis is the value of the providerType to be passed in. This should not be displayed.
keysArray of Provider Authentication Key

Provider Authentication Key

JSON ItemData TypeDescription
nameStringName of the source or destination task represented here. If there are tasks with duplicate names, there may be an identifier at the end of the name to help with ordering.
idStringId of the source or destination to be used with the re-use.

Sync Status Results

JSON ItemData TypeDescription
resultsArray of Sync Status

Sync Status

JSON ItemData TypeDescription
successBooleanPresent and true when the last run completed without an error; omitted otherwise.
idStringThe id of the source or destination.
typeStringIndication of the type ranging from SOURCE or DESTINATION. Other types should be ignored.
queueStatusStringWhere this task stands. Must be one of: QUEUED (waiting for a worker), RUNNING (it is in-progress), COMPLETED (the last run finished and reported no error), FAILED (the last run finished and reported an error), NOT_IN_PROGRESS (nothing queued, nothing running, and it has never run), ON_DEVICE (this source synchronizes on the phone and never on the server), DISABLED (the task is switched off), UNKNOWN (a value this client does not recognize). More values may be added, so treat anything unrecognized as UNKNOWN.
stateStringWhich state is this task in; this is not available for all tasks. Must be one of: HISTORIC_SYNC, REFRESHING, COMPARING, SYNCING, UPLOADING, UNKNOWN. More values may be added, so treat anything unrecognized as UNKNOWN.
infoStringIf available, the localized message summarizing the state
upToLongDate about how far this has been processed up-to
updateStringAny recent error messages from this source or destination.
errorCodeStringError code for the last error, present only when the last run failed.

The errorCode is stable across languages and releases, where update is the wording to show a person. More values may be added.

Errors

JSON ItemData TypeDescription
errorStringError code
error_descriptionStringDescription of the error for end-user consumption.
argumentStringIf the error is regarding an argument, this will indicate the argument name.
itemStringIf the error is regarding an item, this will indicate the item value.
idStringIf the error is regarding an id, this will indicate the id value.
request_idStringThis is the unique request id.

Here are some example errors:

{
    "item": "sampleItemId",
    "error_description": "Item was not found.",
    "id": "sampleId",
    "error": "NotFound",
    "request_id": "sampleRequestId"
}
{
    "argument": "argumentName",
    "error_description": "Missing parameter: argument",
    "error": "MissingParameter",
    "request_id": "sampleRequestId"
}

If you are keying off of our codes to make your own error messages, please note that UserRequestError provides a generic error message.