Providers
Each source and certain destinations (such as Sync Destinations), will require some authentication, which differs per ProviderType.
You can learn which providers are available and their authentication support by Listing Providers.
To set the authentication for a source or destination, please review Provider Authentication.
Listing Providers
This method acquires the data providers that are presently available on FitnessSyncer. It should be noted that this method is highly cacheable, especially if you are using a fixed set of providers.
Request Parameters
None
Response
The Response will be a JSON body with Provider List.
Provider Authentication
There are various ways to configure authentication for a provider. The provider list would have provided you with a value for authenticating.
| Name | Description |
|---|---|
| UsernamePassword or UsernamePasswordKey | This indicates that you must provide explicit credentials for this user. |
| Identifier | This indicates that you must provide a single string identifying this user to the provider. Depending on the provider, that is a device serial number or an API key the user generates in the provider’s own settings. |
| AppRequired | This indicates that one of our or a partner app is required to authenticate. If it is a supported app, an appurl will be also included in the body. |
| OAuth | This indicates that you must request an OAuth token flow to be initiated for your user to provide FitnessSyncer with the appropriate authentication. |
| Unsupported | This should not generally be returned, but should it be returned, you should ignore such providers. |
Once you have selected a provider and created a source for it, you need to add authentication for it as follows.
You should build your application such that if there are new values, your application degrades gracefully.
Where id is the id of the Source or Destination you are trying to authenticate.
Request Parameters
The request body will contain a JSON object as described here.
UsernamePassword
This will securely store the authentication on our servers and return a 200 response to you on success.
| Key | Description |
|---|---|
| type | Always UsernamePassword |
| username | The username required for the user’s authentication |
| password | The password required for the user’s authentication |
UsernamePasswordKey
This will securely store the authentication on our servers and return a 200 response to you on success.
| Key | Description |
|---|---|
| type | Always UsernamePasswordKey |
| username | The username required for the user’s authentication |
| password | The password required for the user’s authentication |
| clientId | The client id required for the user’s authentication |
| clientSecret | The client secret required for the user’s authentication |
Identifier
This will securely store the identifier for the service on our servers and return a 200 response to you on success. An identifier may only be registered to one FitnessSyncer account at a time; registering one already claimed by another account returns a 409.
| Key | Description |
|---|---|
| type | Always Identifier |
| identifier | The single string identifying this user to the provider — a device serial number, or an API key the user generates in the provider’s own settings |
OAuth
This will start the redirects required to authenticate an OAuth-like scheme. This will return a 202 to you with a Location header to pass onto your user. Your user will end at the URL provided below on success or failure (except where beyond our control or extreme failures).
See the sequence diagram in Creating new Data Sources to see how this works visually.
If you are creating multiple sources or destinations using the same ProviderType for the same user, you only need to do this once. You can re-use the authentication with OAuthReuse or see Existing Provider Authentication for details.
| Key | Description |
|---|---|
| type | Always OAuth |
| redirect | The URL you wish for FitnessSyncer to redirect the user for either success or failure modes. Leave it off and the user lands on their FitnessSyncer account page, where the source or destination they just authenticated appears. |
OAuthReuse
This re-uses the authentication for another source or destination referenced by the id field. See Provider Authenticate for how to get the id field for this request.
This will store the re-use request and will return a 200 response to you on success.
| Key | Description |
|---|---|
| type | Always OAuthReuse |
| id | id of the item which you wish to re-use the authentication of |
Response
If your request has been stored successfully, the response code will be a 200 without a body.
If your request has been initiated successfully, the response code will be a 202. Such a request will contain a Location header that you must send your user to. That location will be directed back to a FitnessSyncer service that will drive the completion of the request and redirect the user back to your site when the request is successful or has failed.
Existing Provider Authentication
For OAuth-based services, if you are using the same ProviderType for multiple sources and destinations for the same user, you need to use the same authentication for each source. This method will allow you to acquire the authorization summary of what exists already so that you can re-use that authentication.
Once you have the selected value, you can use the OAuthReuse authentication scheme.
Example request
curl -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/providers/authentication/"Request Parameters
None
Response
The Response will be a JSON body with a Providers Authentication.
Example JSON
{"providers": [{
"keys": [{
"name": "Fitbit Sleep Source",
"id": "d8e1eb2e-bf26-4521-8c4b-7d85590e0588"
}],
"name": "Fitbit",
"type": "FitBit"
}]}Cloud Storage File Formats
The Cloud Storage providers (Amazon S3, DropBox, Google Drive, and OneDrive) store your data as individual files in your own cloud storage account, rather than in a third-party service’s own data model. Because there is no fixed schema being synchronized against, you choose the file format that gets written (or read) for each Source or Destination Task that uses one of these providers.
The file format, along with an optional storage path and filename template, is configured via a providerConfig.maps object on the Source Data or Sync Destination Task.
| Key | Description |
|---|---|
| fileFormat | One of TCX, GPX, KML, KMZ, FIT, PWX, CSV, or FitnessSyncerAPI. See the table below for which TaskTypes each format supports. |
| filenameFormat | A template for the generated filename, for example {date}-{name}. Optional; a default is used if omitted. |
| path | The directory within the provider’s storage to read from or write to. Optional; defaults to the root of the account. |
Not every file format supports every TaskType. TCX, GPX, KML, KMZ, PWX, and CSV are GPS track formats and only support Activity. FIT additionally supports Weight and Blood Pressure. FitnessSyncerAPI — FitnessSyncer’s own JSON representation of an Item, the same shape used elsewhere in this API — is the only format that supports every TaskType, and is the recommended choice for any TaskType other than Activity.
| File Format | Supported TaskTypes |
|---|---|
| TCX, GPX, KML, KMZ, PWX, CSV | Activity |
| FIT | Activity, Weight, Blood Pressure |
| FitnessSyncerAPI | All TaskTypes |
If you configure a fileFormat that does not support the TaskType of the Source or Destination Task, your request will be rejected with a 400 response describing the mismatch.
The Uploading Fitness Files endpoint also accepts a .fsapi file using this same JSON format, for any TaskType.
Types
List of Providers
| JSON Item | Data Type | Description |
|---|---|---|
| providers | Array of Provider |
Provider
| JSON Item | Data Type | Description |
|---|---|---|
| providerType | String | This is the value of the providerType to be passed in. This should not be displayed. Read-only. |
| name | String | This is the description of the provider for display purposes. Read-only. |
| authentication | String | This is the type of authentication which this provider requires. Must be one of: UsernamePassword, Identifier, AppRequired, OAuth, UsernamePasswordKey, Unsupported. See the Provider Authentication section in the documentation for information. Read-only. |
| beta | Boolean | If this is true, this implies that this provider type is presently in public beta testing. Read-only. |
| notifications | Boolean | True if this service currently does notifications-based synchronization. Read-only. |
| cloudStorageMapsProvider | Boolean | True if this is a Cloud Storage Map Provider. |
| cloudStorageCsvProvider | Boolean | True if this is a Cloud Storage CSV Provider. |
| reauthenticateAll | Boolean | True if this is a candidate for Reauthenticate All. |
| historicSync | Boolean | True if this type supports Historic Sync. |
| compatibleAuthentication | Array of String | List of providers |
| faq | String | URL to the FAQ |
| notice | String | If applicable, this will include any important notices for this provider. These notices will generally be around deprecation and common issues. |
| noticeurl | String | For items with a notice, there may be an associated web page with additional information. |
| logo | String | URL to the Logo |
| appurl | String | If this represents an app, this represents the URL for that app. |
| ActivityRead | Boolean | True if this provider can read activity data. Read-only. |
| ActivityWrite | Boolean | True if this provider can write activity data. Read-only. |
| AllergyRead | Boolean | True if this provider can read allergy data. Read-only. |
| AllergyWrite | Boolean | True if this provider can write allergy data. Read-only. |
| WeightRead | Boolean | True if this provider can read body composition data. Read-only. |
| WeightWrite | Boolean | True if this provider can write body composition data. Read-only. |
| BloodPressureRead | Boolean | True if this provider can read blood pressure data. Read-only. |
| BloodPressureWrite | Boolean | True if this provider can write blood pressure data. Read-only. |
| CholesterolRead | Boolean | True if this provider can read cholesterol data. Read-only. |
| CholesterolWrite | Boolean | True if this provider can write cholesterol data. Read-only. |
| ConditionRead | Boolean | True if this provider can read condition data. Read-only. |
| ConditionWrite | Boolean | True if this provider can write condition data. Read-only. |
| CycleTrackingRead | Boolean | True if this provider can read cycle tracking data. Read-only. |
| CycleTrackingWrite | Boolean | True if this provider can write cycle tracking data. Read-only. |
| ECGRead | Boolean | True if this provider can read ECG data. Read-only. |
| ECGWrite | Boolean | True if this provider can write ECG data. Read-only. |
| GlucoseRead | Boolean | True if this provider can read glucose data. Read-only. |
| GlucoseWrite | Boolean | True if this provider can write glucose data. Read-only. |
| MedicationRead | Boolean | True if this provider can read medication data. Read-only. |
| MedicationWrite | Boolean | True if this provider can write medication data. Read-only. |
| NutritionRead | Boolean | True if this provider can read nutrition data. Read-only. |
| NutritionWrite | Boolean | True if this provider can write nutrition data. Read-only. |
| OxygenRead | Boolean | True if this provider can read oxygen data. Read-only. |
| OxygenWrite | Boolean | True if this provider can write oxygen data. Read-only. |
| SleepRead | Boolean | True if this provider can read sleep data. Read-only. |
| SleepWrite | Boolean | True if this provider can write sleep data. Read-only. |
| TemperatureRead | Boolean | True if this provider can read temperature data. Read-only. |
| TemperatureWrite | Boolean | True if this provider can write temperature data. Read-only. |