Leaderboards API

FitnessSyncer Leaderboards allow for device independent competitions on participant’s data. This API allows for the management of the competitions.

List Leaderboards

This method lists all Leaderboards for a user, ranging from those the user owns, is participating in, and also those that are pending approval.

GEThttps://api.fitnesssyncer.com/api/leaderboards/
Scopeleaderboard_participate
Response 200Leaderboard List
Example request
curl -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/leaderboards/"

Request Parameters

None

Response

The body with the Leaderboard List Result.

Get Leaderboard

This method gets a Leaderboard by id.

GEThttps://api.fitnesssyncer.com/api/leaderboards/id
Scopeleaderboard_participate
Response 200Leaderboard Item
Example request
curl -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/leaderboards/id"

Request Parameters

None

Response

The body of Leaderboard Item Result.

Create Leaderboard

This method creates a Leaderboard.

PUThttps://api.fitnesssyncer.com/api/leaderboards/
Scopeleaderboard_admin
Request bodyLeaderboard
Response 200Id

Request Parameters

A body containing a Leaderboard

How participants are ranked is set here and cannot be changed afterward, because it is what each participant agrees to. A Data Field that adds up, such as steps, is ranked on its total. A measurement, such as weight, is ranked on its average, its best single reading, or its change from the first reading, and the lowerWins property says which direction wins. A scored Leaderboard gives points to each of its scoringFields, which may come from more than one data type.

Response

The body with the Id Result.

Update Leaderboard

This method updates a Leaderboard.

The Data Fields, the scoring and the ranking (rankBy, lowerWins, hideValues and scoringDailyLimit) are kept from the original, whatever is sent. To change them, create a new Leaderboard.

POSThttps://api.fitnesssyncer.com/api/leaderboards/id
Scopeleaderboard_admin
Request bodyLeaderboard
Response 200Id

Request Parameters

A body containing a Leaderboard

Response

The body with the Id Result.

Delete Leaderboard

This method deletes a Leaderboard.

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

Request Parameters

None

Response

The body with the Id Result.

Get Leaderboard Data

This method acquires the data associated with a Leaderboard.

This data can be requested in an easy to consume JSON format by using the Accept Header application/json or as a CSV by using the Accept Header text/csv.

GEThttps://api.fitnesssyncer.com/api/leaderboards/id/data
Scopeleaderboard_participate
Response 200Leaderboard Data
Example request
curl -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/leaderboards/id/data"

Request Parameters

None

Response

If the Accept header is not specified or is application/json, the body with the Leaderboard Data Result.

If the Accept header text/csv, a CSV representation of the data will be returned.

Get Leaderboard Classic Data

This method acquires the participants of a Leaderboard along with their scored values, already sorted into ranking order. It is a flattened, table-shaped alternative to Get Leaderboard Data, intended for simple displays that only need a ranked list of participants and their values.

GEThttps://api.fitnesssyncer.com/api/leaderboards/id/board/classic
Scopeleaderboard_participate
Response 200Object
Fields
JSON ItemData TypeDescription
entriesArray of ObjectThe participants, in ranked order.
Fields of entries
JSON ItemData TypeDescription
participantStringDisplay name of the participant.
Example request
curl -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/leaderboards/id/board/classic"

Request Parameters

None

Response

The body will contain an entries field, which is an array of the participants in ranked order. Each entry has a participant field with the participant’s display name, plus one field per scored series on the Leaderboard, keyed by that series’ label.

If the Leaderboard does not exist or you are not a participant of it, a 404 will be returned.

Get Leaderboard User Preferences

This method acquires the user preferences for Leaderboard.

GEThttps://api.fitnesssyncer.com/api/leaderboards/id/user/preference
Scopeleaderboard_participate
Example request
curl -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/leaderboards/id/user/preference"

Request Parameters

None

Response

The body with the Leaderboard User Preference.

Update Leaderboard User Preferences

This method updates the user preferences for Leaderboard.

PUThttps://api.fitnesssyncer.com/api/leaderboards/id/user/preference
Scopeleaderboard_participate
Response 200Id

Request Parameters

A body containing a Leaderboard User Preference

Response

The body with the Leaderboard User Preference.

Add User to Leaderboard

This method adds a user to a Leaderboard.

PUThttps://api.fitnesssyncer.com/api/leaderboards/id/user
Scopeleaderboard_admin
Request bodyLeaderboard User
Response 200Id

Request Parameters

A body containing a Leaderboard

This also takes an optional sendInvitationEmails query string which if set to false, will not send e-mail notifications to the user.

Response

The body with the Id Result.

Accept a Leaderboard Invitation

This accepts an invitation to a Leaderboard.

Calling this API implies that the user has consented to this action. The user must have been shown all of the information associated with the Leaderboard and told that their information will be visible to all users of the Leaderboard. Furthermore, for absolute data such as weight, the user should be informed not to share this information unless they truly trust the person or organization administering the Leaderboard.

PUThttps://api.fitnesssyncer.com/api/leaderboards/id/accept
Scopeleaderboard_participate
Request bodyLeaderboard
Response 200Id

Request Parameters

A body containing a Leaderboard

This also takes an optional team query string, for a Leaderboard whose participants choose their own team. It must be one of the Leaderboard’s team names.

Response

The body with the Id Result.

Remove the Current User from a Leaderboard

This method deletes the current user from the Leaderboard.

DELETEhttps://api.fitnesssyncer.com/api/leaderboards/id/user
Scopeleaderboard_participate
Response 200Id
Example request
curl -X DELETE -H "Authorization: Bearer AccessToken" "https://api.fitnesssyncer.com/api/leaderboards/id/user"

Request Parameters

None

Response

The body with the Id Result.

Remove Users from a Leaderboard (Administrator)

This method deletes the specified user(s) from the Leaderboard.

POSThttps://api.fitnesssyncer.com/api/leaderboards/id/user/admin
Scopeleaderboard_admin
Request bodyLeaderboard User
Response 200Id

Request Parameters

Body of Leaderboard User

Response

The body with the Id Result.

Types

Leaderboard

JSON ItemData TypeDescription
idStringThis is the unique id for this leaderboard.
nameStringThis is the name of the Leaderboard. This must be unique.
descriptionStringDescription of the Leaderboard
granularityStringWhat is the granularity you wish for this to run at? Must be one of: DAY, WEEK, or MONTH
userLimitLongThis is the user limit for this leaderboard.
emailBooleanShould we send periodic e-mail notifications?
anyoneCanSignUpBooleanBy default, the Leaderboard will only allow users who have been explicitly invited. With this option enabled, anyone with a FitnessSyncer account can sign up up-to the limit.
chartLineGranularityBooleanShould the Leaderboard include the Line Chart per Granularity?
chartTableGranularityBooleanShould the Leaderboard include the Table per Granularity?
chartClassicLeaderboardBooleanShould the leaderboard include the Classic Leaderboard View?
relativeBooleanTrue if the graphs should be relative progress; this disables Group Goals and Classic Leaderboards. This can only be set on creation and cannot be toggled. Not applicable to scoring boards.
groupGoalDoubleFitnessSyncer Leaderboards can be configured to be both a challenge for individuals or for a group. If set to a non-negative value, this setting enables group challenges and this is the value for which the primary data field must exceed. Not applicable to scoring boards.
scoringFieldStringThis is the scoring field type. If this is null, this is a standard metric-based leaderboard. If this is set to a value, this is a custom Leaderboard. See the Descriptions API.
scoringWeightsAnyIf scoringField is specified, these are the scoring weights for each of the DataFields.
dataFieldArray of StringData Field for this Leaderboard. The first element is the primary comparison value whereas the others are used for tabular visualization.
startDateLongStart Date of the Leaderboard in milliseconds since Epoch
endDateLongEnd Date of the Leaderboard in milliseconds since Epoch
publicLeaderboardBooleanTrue if this Leaderboard is publicly visible. If true, you can access it at https://www.fitnesssyncer.com/leaderboards?board={id} without logging in.
scoringFieldsArray of StringThe scored Data Fields in the order they are shown. With a scoringField preset these are the fields of the preset; without one, any Data Fields that add up, from one or more data types, each with its points in scoringWeights. This can only be set on creation.
scoringDailyLimitDoubleThe most points one participant can earn in a day on a scored Leaderboard. Omit for no limit. This can only be set on creation.
rankByStringWhat participants are ranked on. Must be one of: Total, Average, Best, Change, PercentChange, Score. Total is the only value allowed for a Data Field that adds up, such as steps; it is not allowed for a measurement, such as weight. Score is set for a scored Leaderboard. When omitted, it is derived from the Data Field and from relative. This can only be set on creation.
lowerWinsBooleanTrue if the lowest value wins, which applies to a Leaderboard ranked on a measurement. A participant with no data is never ranked, whichever direction wins. This can only be set on creation.
hideValuesBooleanTrue if actual values are never shown to other participants. A Leaderboard ranked on Change or PercentChange shows the change only; any other shows the ranking only. This can only be set on creation.
teamsBooleanTrue if participants are grouped into teams that are ranked against each other.
teamNamesArray of StringThe names of the teams.
participantsChooseTeamBooleanTrue if each participant chooses a team when accepting; false if the organizer assigns them.
teamSumBooleanTrue if a team is counted as the sum of its members; false, the default, if it is counted as the average of its members.
displayArray of StringThe representations shown for this Leaderboard, in display order. Each must be one of: Standings, Teams, Trend, Table. When present, it takes precedence over chartLineGranularity, chartTableGranularity and chartClassicLeaderboard.

Leaderboard Item

JSON ItemData TypeDescription
itemLeaderboard

Leaderboard List

JSON ItemData TypeDescription
ownArray of LeaderboardList of the Leaderboards this user owns.
pendingArray of LeaderboardList of the Leaderboards this user has not yet accepted.
acceptedArray of LeaderboardList of the Leaderboards this user has accepted.

Leaderboard User

JSON ItemData TypeDescription
userStringAdd a single user
usersArray of StringAdd a set of users.
teamsAnyThe team of each participant, keyed by e-mail address, for a Leaderboard with teams. A value that is not one of the Leaderboard’s teamNames, or is empty, removes the participant from their team. This may be sent with or without new users.

Leaderboard Data

JSON ItemData TypeDescription
dataLeaderboard Data Data

Leaderboard User Preferences

JSON ItemData TypeDescription
emailUpdateBooleanWhether this user receives the periodic e-mail summary for this Leaderboard.

Leaderboard Data Data

JSON ItemData TypeDescription
categoriesArray of StringCategories of the chart, in increasing order
entriesArray of Leaderboard Data Data EntriesParticipants

Leaderboard Data Data Entries

JSON ItemData TypeDescription
participantStringDisplay name of the participant.
valuesArray of Leaderboard Data Data ValuesValues of the Participant

Leaderboard Data Data Values

JSON ItemData TypeDescription
categoryStringCategory name
valueDoubleCategory value