Destination Tasks

A Destination Task is an operation that runs against source data. The most common of these is a data synchronization task.

Listing Destination Tasks

To learn the destinations tasks that exist or to find the id of your desired destination, you will need to issue a list.

GEThttps://api.fitnesssyncer.com/api/providers/destinations/
Scopedestination_read
Example request
curl -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/providers/destinations/"

Request Parameters

None

Response

The response will be a 200 with a JSON body that will contain a List of Destination Tasks. See the Data Types section for a description.

Example JSON

{"items": [{
    "taskType": "Activity",
    "hour": -1,
    "name": "Synchronization Task",
    "id": "1d4c35b9-f006-4f34-acea-2af7bc25161a",
    "type": "sync",
    "enabled": true,
    "providerType": "FitBit"
}]}

Get a Specific Destination Task

If you have an id to a specific destination task, you can easily acquire the configuration of that task easily.

GEThttps://api.fitnesssyncer.com/api/providers/destinations/id
Scopedestination_read
Example request
curl -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/providers/destinations/id"

Request Parameters

None

Response

The response will be a 200 with a JSON body that will contain an Item Destination Task. See the Data Types section for a description.

Example JSON

{"item": {
    "taskType": "Activity",
    "hour": -1,
    "name": "Synchronization Task",
    "id": "1d4c35b9-f006-4f34-acea-2af7bc25161a",
    "type": "sync",
    "enabled": true,
    "providerType": "FitBit"
}}

Creating new Destination Tasks

To create a new Destination Task, one must issue a PUT request with that configuration.

Please see Provider Authentication to configure authentication for your destination.

The user can also change this item using our editor. It is recommended that you only cache this data temporarily.

PUThttps://api.fitnesssyncer.com/api/providers/destinations/
Scopedestination_write
Request bodyDestination Task
Response 200Id

Request Parameters

The Request Body will be a JSON object with the Destination Data. See the Data Types section for that definition. The id in that Destination Data will be ignored.

Response

The Response will be a JSON body with an id field indicating the ID of the new item.

Examples

An E-mail Destination Task that sends the user a weekly summary. It is free, and does not count toward the free plan’s limit on sources and tasks:

{
    "granularity": "WEEK",
    "name": "Weekly E-mail",
    "type": "email",
    "enabled": true
}

A Report PDF Destination Task that sends two reports as PDF files every month. Take the report ids from Listing the Reports a Report PDF Destination Can Send. It is also free; message and otherEmail require Pro:

{
    "reportIds": [
        "00000000-0000-0000-0000-00000000000e",
        "00000000-0000-0000-0000-00000000000b"
    ],
    "granularity": "MONTH",
    "name": "Monthly Reports",
    "type": "reportpdf",
    "enabled": true
}

Updating Destination Tasks

To update a Destination Task, one must issue a POST request with that configuration.

Please see Provider Authentication to configure authentication for your destination.

POSThttps://api.fitnesssyncer.com/api/providers/destinations/id
Scopedestination_write
Request bodyDestination Task
Response 200Id

Request Parameters

The Request Body will be a JSON object with the Destination Data. See the Data Types section for that definition. The id in that Destination Task will be ignored.

Response

The Response will be a JSON body with an id field indicating the ID of the updated item.

Deleting Destination Tasks

When you are finished with a destination task, simply delete it. This operation cannot be undone.

DELETEhttps://api.fitnesssyncer.com/api/providers/destinations/id
Scopedestination_write
Response 200Id
Example request
curl -X DELETE -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/providers/destinations/id"

Request Parameters

None

Response

The Response will be a JSON body with an id field indicating the ID of the deleted item.

Executing Destination Tasks

FitnessSyncer will periodically execute destinations tasks. If your application wishes to run these themselves, you can request an execute.

When this operation completes, the task is enqueued and will execute sometime in the near future. You may check on the status of the task via the Sync Status API.

Note: This is only available on certain accounts. Please contact us if you require it.

POSThttps://api.fitnesssyncer.com/api/providers/destinations/id/execute
Scopedestination_write
Response 200Id

Request Parameters

None

Response

On success, this will return a 202 with a JSON body indicating the id of the item enqueued.

In the event that there is already a pending request for this user, a 409 will be returned to you.

Listing the Reports a Report PDF Destination Can Send

A Report PDF Destination Task e-mails the reports named in its reportIds. This lists the reports the user may choose: the built-in reports their plan includes and, for a Pro user, their own dashboards, with names in the user’s language.

GEThttps://api.fitnesssyncer.com/api/providers/destinations/printable-reports
Scopedestination_read
Example request
curl -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/providers/destinations/printable-reports"

Request Parameters

None

Response

The response will be a 200 with a JSON body that will contain a List of Printable Reports.

Types

List of Destination Task

JSON ItemData TypeDescription
itemsArray of Destination Task

Destination Task Item

JSON ItemData TypeDescription
itemDestination Task

Destination Task

This structure defines the base Destination Task. Depending on the task type, it is extended by one of the subtypes defined below.

JSON ItemData TypeDescription
typeStringThis is the type of destination task. Not all of the types supported by FitnessSyncer are documented here.
idStringA String identifier for the task. This is used throughout the API for uniquely identifying this item.
nameStringA user description for the destination.
connectionIdStringIdentifies the credentials this source uses. Sources and Destinations sharing a value were authorized with the same credentials. This value is opaque: use it only for comparison within one response. Read-only.
hourIntegerHour for this task to be run (if Pro). The time is specified in PST8PDT. Use localHour for localtime.
localHourIntegerHour converted to the user’s timezone (from their profile). This can also be used to update the hour field.
lastErrorStringThis is a localized description of the last error that this source encountered. Read-only.
errorCodeStringError code for the last error, present only when there is one. Read-only.
dateLongDate of the last synchronization or error.
enabledBooleanIndicates whether this destination is enabled or not.

At this time, filters are not configurable via the API. Other fields may be included in the future and should be ignored.

If you require access to one of the destination tasks which are not documented, simply contact us.

Sample

{
    "taskType": "Activity",
    "hour": -1,
    "name": "Synchronization Task",
    "id": "1d4c35b9-f006-4f34-acea-2af7bc25161a",
    "type": "sync",
    "enabled": true,
    "providerType": "FitBit"
}

Sync Destination Task

This structure defines the Destination Task of type “sync”. This extends Destination Task.

JSON ItemData TypeDescription
taskTypeStringType of the Destination. Must be one of Activity, Allergy, Weight, BloodPressure, BloodPanel, Cholesterol, Condition, CycleTracking, ECG, Glucose, Medication, Nutrition, Oxygen, Sleep, Temperature
providerTypeStringThe Provider Type enumeration value. See Listing Providers for details.
skipDataFieldsArray of StringList of fields to skip over (if applicable)
onlyIfNotOnDestBooleanMode that only places items on the destination IF there is nothing on the destination for the day. Not recommended.
identifierStringIf the authentication for this is a username or identifier, this would be that string to aid in editing. Read-only.
providerConfigProvider Config
Fields from DestinationTask

These are the fields of Destination Task, which every SyncDestination also carries.

JSON ItemData TypeDescription
typeStringThis is the type of destination task. Not all of the types supported by FitnessSyncer are documented here.
idStringA String identifier for the task. This is used throughout the API for uniquely identifying this item.
nameStringA user description for the destination.
connectionIdStringIdentifies the credentials this source uses. Sources and Destinations sharing a value were authorized with the same credentials. This value is opaque: use it only for comparison within one response. Read-only.
hourIntegerHour for this task to be run (if Pro). The time is specified in PST8PDT. Use localHour for localtime.
localHourIntegerHour converted to the user’s timezone (from their profile). This can also be used to update the hour field.
lastErrorStringThis is a localized description of the last error that this source encountered. Read-only.
errorCodeStringError code for the last error, present only when there is one. Read-only.
dateLongDate of the last synchronization or error.
enabledBooleanIndicates whether this destination is enabled or not.

Sample

{
    "taskType": "Activity",
    "hour": -1,
    "name": "Synchronization Task",
    "id": "1d4c35b9-f006-4f34-acea-2af7bc25161a",
    "type": "sync",
    "enabled": true,
    "providerType": "FitBit"
}

Refresh Destination Task

This structure defines the Destination Task of type “refresh”. This extends Destination Task.

JSON ItemData TypeDescription
Fields from DestinationTask

These are the fields of Destination Task, which every RefreshDestination also carries.

JSON ItemData TypeDescription
typeStringThis is the type of destination task. Not all of the types supported by FitnessSyncer are documented here.
idStringA String identifier for the task. This is used throughout the API for uniquely identifying this item.
nameStringA user description for the destination.
connectionIdStringIdentifies the credentials this source uses. Sources and Destinations sharing a value were authorized with the same credentials. This value is opaque: use it only for comparison within one response. Read-only.
hourIntegerHour for this task to be run (if Pro). The time is specified in PST8PDT. Use localHour for localtime.
localHourIntegerHour converted to the user’s timezone (from their profile). This can also be used to update the hour field.
lastErrorStringThis is a localized description of the last error that this source encountered. Read-only.
errorCodeStringError code for the last error, present only when there is one. Read-only.
dateLongDate of the last synchronization or error.
enabledBooleanIndicates whether this destination is enabled or not.

Sample

{
    "hour": -1,
    "name": "Refresh Sources",
    "id": "94ab6932-4e08-4dae-8261-029d89288d6e",
    "type": "refresh",
    "enabled": true
}

E-mail Destination Task

This structure defines the Destination Task of type “email”, which e-mails the user a summary of their data and goals. It is free and does not count toward the free plan’s limit; a message, other recipients and file attachments require Pro. This extends Destination Task.

JSON ItemData TypeDescription
granularityStringWhat is the granularity you wish for this to run at? Must be one of: DAY, WEEK, or MONTH
granularityFriendlyStringFriendly name of the granularity Read-only.
removeDuplicatesBooleanTrue to remove the duplicates
dataViewStringView for the data. This is not currently used. Must be one of: STANDARD, QUARTER, HALF, YEAR
fileFormatStringFile format for attachments if the user is a Pro. Must be one of: TCX, GPX, KML, KMZ, FIT, PWX, CSV
messageStringMessage to include if the user is a Pro.
otherEmailStringComma Delimited list of e-mail address if the user is a Pro.
Fields from DestinationTask

These are the fields of Destination Task, which every EmailDestination also carries.

JSON ItemData TypeDescription
typeStringThis is the type of destination task. Not all of the types supported by FitnessSyncer are documented here.
idStringA String identifier for the task. This is used throughout the API for uniquely identifying this item.
nameStringA user description for the destination.
connectionIdStringIdentifies the credentials this source uses. Sources and Destinations sharing a value were authorized with the same credentials. This value is opaque: use it only for comparison within one response. Read-only.
hourIntegerHour for this task to be run (if Pro). The time is specified in PST8PDT. Use localHour for localtime.
localHourIntegerHour converted to the user’s timezone (from their profile). This can also be used to update the hour field.
lastErrorStringThis is a localized description of the last error that this source encountered. Read-only.
errorCodeStringError code for the last error, present only when there is one. Read-only.
dateLongDate of the last synchronization or error.
enabledBooleanIndicates whether this destination is enabled or not.

Sample

{
    "removeDuplicates": true,
    "hour": -1,
    "granularityFriendly": "Week",
    "granularity": "WEEK",
    "name": "Weekly E-mail",
    "id": "6b0d2f7e-1c4a-4f83-9e2b-5a7c8d9e0f12",
    "type": "email",
    "dataView": "STANDARD",
    "lastSent": 0,
    "enabled": true
}

Report PDF Destination Task

This structure defines the Destination Task of type “reportpdf”, which e-mails the user’s reports as PDF files, one file for each report. It is free and does not count toward the free plan’s limit; a message and other recipients require Pro. This extends Destination Task.

JSON ItemData TypeDescription
granularityStringHow often the reports are sent. Must be one of: DAY, WEEK, or MONTH
reportIdsArray of StringThe reports to send, at least one. Each must be an id from List the reports a Report PDF destination can send.
messageStringMessage to include if the user is a Pro.
otherEmailStringComma Delimited list of e-mail address to send the reports to if the user is a Pro. The user is copied.
Fields from DestinationTask

These are the fields of Destination Task, which every ReportPDFDestination also carries.

JSON ItemData TypeDescription
typeStringThis is the type of destination task. Not all of the types supported by FitnessSyncer are documented here.
idStringA String identifier for the task. This is used throughout the API for uniquely identifying this item.
nameStringA user description for the destination.
connectionIdStringIdentifies the credentials this source uses. Sources and Destinations sharing a value were authorized with the same credentials. This value is opaque: use it only for comparison within one response. Read-only.
hourIntegerHour for this task to be run (if Pro). The time is specified in PST8PDT. Use localHour for localtime.
localHourIntegerHour converted to the user’s timezone (from their profile). This can also be used to update the hour field.
lastErrorStringThis is a localized description of the last error that this source encountered. Read-only.
errorCodeStringError code for the last error, present only when there is one. Read-only.
dateLongDate of the last synchronization or error.
enabledBooleanIndicates whether this destination is enabled or not.

Sample

{
    "reportIds": [
        "00000000-0000-0000-0000-00000000000e",
        "00000000-0000-0000-0000-00000000000b"
    ],
    "hour": -1,
    "granularity": "WEEK",
    "name": "PDF Reports",
    "id": "3f2a6c1e-8b7d-4e59-a0c4-6d1e2f3a4b5c",
    "type": "reportpdf",
    "lastSent": 0,
    "enabled": true
}

List of Printable Reports

JSON ItemData TypeDescription
itemsArray of Printable Report

Printable Report

JSON ItemData TypeDescription
idStringThe report’s identifier, for reportIds.
nameStringThe report’s name in the user’s language.