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.
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.
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.
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.
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.
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.
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.
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 Item | Data Type | Description |
|---|---|---|
| items | Array of Destination Task |
Destination Task Item
| JSON Item | Data Type | Description |
|---|---|---|
| item | Destination 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 Item | Data Type | Description |
|---|---|---|
| type | String | This is the type of destination task. Not all of the types supported by FitnessSyncer are documented here. |
| id | String | A String identifier for the task. This is used throughout the API for uniquely identifying this item. |
| name | String | A user description for the destination. |
| connectionId | String | Identifies 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. |
| hour | Integer | Hour for this task to be run (if Pro). The time is specified in PST8PDT. Use localHour for localtime. |
| localHour | Integer | Hour converted to the user’s timezone (from their profile). This can also be used to update the hour field. |
| lastError | String | This is a localized description of the last error that this source encountered. Read-only. |
| errorCode | String | Error code for the last error, present only when there is one. Read-only. |
| date | Long | Date of the last synchronization or error. |
| enabled | Boolean | Indicates 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 Item | Data Type | Description |
|---|---|---|
| taskType | String | Type of the Destination. Must be one of Activity, Allergy, Weight, BloodPressure, BloodPanel, Cholesterol, Condition, CycleTracking, ECG, Glucose, Medication, Nutrition, Oxygen, Sleep, Temperature |
| providerType | String | The Provider Type enumeration value. See Listing Providers for details. |
| skipDataFields | Array of String | List of fields to skip over (if applicable) |
| onlyIfNotOnDest | Boolean | Mode that only places items on the destination IF there is nothing on the destination for the day. Not recommended. |
| identifier | String | If the authentication for this is a username or identifier, this would be that string to aid in editing. Read-only. |
| providerConfig | Provider Config |
Fields from DestinationTask
These are the fields of Destination Task, which every SyncDestination also carries.
| JSON Item | Data Type | Description |
|---|---|---|
| type | String | This is the type of destination task. Not all of the types supported by FitnessSyncer are documented here. |
| id | String | A String identifier for the task. This is used throughout the API for uniquely identifying this item. |
| name | String | A user description for the destination. |
| connectionId | String | Identifies 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. |
| hour | Integer | Hour for this task to be run (if Pro). The time is specified in PST8PDT. Use localHour for localtime. |
| localHour | Integer | Hour converted to the user’s timezone (from their profile). This can also be used to update the hour field. |
| lastError | String | This is a localized description of the last error that this source encountered. Read-only. |
| errorCode | String | Error code for the last error, present only when there is one. Read-only. |
| date | Long | Date of the last synchronization or error. |
| enabled | Boolean | Indicates 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 Item | Data Type | Description |
|---|
Fields from DestinationTask
These are the fields of Destination Task, which every RefreshDestination also carries.
| JSON Item | Data Type | Description |
|---|---|---|
| type | String | This is the type of destination task. Not all of the types supported by FitnessSyncer are documented here. |
| id | String | A String identifier for the task. This is used throughout the API for uniquely identifying this item. |
| name | String | A user description for the destination. |
| connectionId | String | Identifies 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. |
| hour | Integer | Hour for this task to be run (if Pro). The time is specified in PST8PDT. Use localHour for localtime. |
| localHour | Integer | Hour converted to the user’s timezone (from their profile). This can also be used to update the hour field. |
| lastError | String | This is a localized description of the last error that this source encountered. Read-only. |
| errorCode | String | Error code for the last error, present only when there is one. Read-only. |
| date | Long | Date of the last synchronization or error. |
| enabled | Boolean | Indicates 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 Item | Data Type | Description |
|---|---|---|
| granularity | String | What is the granularity you wish for this to run at? Must be one of: DAY, WEEK, or MONTH |
| granularityFriendly | String | Friendly name of the granularity Read-only. |
| removeDuplicates | Boolean | True to remove the duplicates |
| dataView | String | View for the data. This is not currently used. Must be one of: STANDARD, QUARTER, HALF, YEAR |
| fileFormat | String | File format for attachments if the user is a Pro. Must be one of: TCX, GPX, KML, KMZ, FIT, PWX, CSV |
| message | String | Message to include if the user is a Pro. |
| otherEmail | String | Comma 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 Item | Data Type | Description |
|---|---|---|
| type | String | This is the type of destination task. Not all of the types supported by FitnessSyncer are documented here. |
| id | String | A String identifier for the task. This is used throughout the API for uniquely identifying this item. |
| name | String | A user description for the destination. |
| connectionId | String | Identifies 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. |
| hour | Integer | Hour for this task to be run (if Pro). The time is specified in PST8PDT. Use localHour for localtime. |
| localHour | Integer | Hour converted to the user’s timezone (from their profile). This can also be used to update the hour field. |
| lastError | String | This is a localized description of the last error that this source encountered. Read-only. |
| errorCode | String | Error code for the last error, present only when there is one. Read-only. |
| date | Long | Date of the last synchronization or error. |
| enabled | Boolean | Indicates 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 Item | Data Type | Description |
|---|---|---|
| granularity | String | How often the reports are sent. Must be one of: DAY, WEEK, or MONTH |
| reportIds | Array of String | The reports to send, at least one. Each must be an id from List the reports a Report PDF destination can send. |
| message | String | Message to include if the user is a Pro. |
| otherEmail | String | Comma 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 Item | Data Type | Description |
|---|---|---|
| type | String | This is the type of destination task. Not all of the types supported by FitnessSyncer are documented here. |
| id | String | A String identifier for the task. This is used throughout the API for uniquely identifying this item. |
| name | String | A user description for the destination. |
| connectionId | String | Identifies 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. |
| hour | Integer | Hour for this task to be run (if Pro). The time is specified in PST8PDT. Use localHour for localtime. |
| localHour | Integer | Hour converted to the user’s timezone (from their profile). This can also be used to update the hour field. |
| lastError | String | This is a localized description of the last error that this source encountered. Read-only. |
| errorCode | String | Error code for the last error, present only when there is one. Read-only. |
| date | Long | Date of the last synchronization or error. |
| enabled | Boolean | Indicates 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 Item | Data Type | Description |
|---|---|---|
| items | Array of Printable Report |
Printable Report
| JSON Item | Data Type | Description |
|---|---|---|
| id | String | The report’s identifier, for reportIds. |
| name | String | The report’s name in the user’s language. |