API Description
An API to serve 4 key concepts for quantified self
- Sport activity tracking
- Body measures
- Personal statistics
- Equipments

Main benefits
- A Framework to structure sport activities
- Algorithm to calculate Kcal, elevation
- The sport data consolidated around you
- The flexibility to manage many sports (running to tennis...)
- Persistence of your data
Global vision
- Opening to the world the connected sport
- Embracing diversity
- Nurturing the sport practice ecosystem
Get started
API for quantified self and connected products : Sport activities, statistics , body measures & equipments
API Registration
You want to use our API ? First filled this form :
If we validate your request, you will receive :
- an api key
- a client ID and secret for login
Swagger
You can find a Swagger UI here.
Endpoints and stacks
We have two major stacks, one in Europe (the default) and one in China (dedicated to the Chinese users). The default endpoint is : https://api.decathlon.net/sportstrackingdata/v2/ You can also specify the Europe stack by adding a prefix "eu2" : https://api.decathlon.net/sportstrackingdata/eu2/v2/sports.json
To reach the Chinese stack, add the prefix cn1 : https://api.decathlon.net/sportstrackingdata/cn1/v2/
API conventions
All data is sent and received as JSONLD
Date format : 2013-03-09T16:39:53+00:00
Date filter : ?property[after|before|strictly_after|strictly_before]=value Example : createdAt[after]=2018-03-19
Country codes follow the is norme ISO 3166 with 2 char ( ex : FR)
Language codes follow the norme ISO 639-1 with 2 char ( ex : NL)
Quota and rate-limiting
By default, we apply : * 100k api calls per day * 1k maximum burst calls/minute
Authentification
Sports Tracking Data is a ressource server, the identification and authorization role is assumed by Decathlon Login. Full documentation about Decathlon Login available here.
Flow supported :
- Authorization code
Login flow Authorization Code
Create a login button with this link:
https://api.decathlon.net/connect/oauth/authorize?client_id=YOUR_CLIENT_ID&locale=fr_FR&redirect_uri=YOUR_REDIRCT_URI&response_type=code&state=123454&scope=profile+openid+email+sports_tracking_data
To be able to log-in you will need to create an application to use Decathlon Login : https://dktunited.github.io/dktconnect-login-doc/
If you want to be able to write data you will need to add the scope : sports_tracking_data:write
After the user login, the user will be redirected to :
https://YOUR_REDIRECT_URL?code=XXXXXXXXXX
Collect the code on your server side and validate it. You will receive bearer in return :
curl -X POST \
'https://api.decathlon.net/connect/oauth/token?client_id=YOUR_CLIENT_ID&client_secret=CLIENT_ID_SECRET&grant_type=authorization_code&code=THE_USER_CODE&redirect_uri=https://YOUR_REDIRECT_URL' \
Answer
{
"access_token": "your_acces_token",
"token_type": "bearer",
"refresh_token": "XXX",
"expires_in": 899,
"scope": "XXX",
"jti": "XXX"
}
Main operations
The main API operations are :
- Get activities .
- Post activity
The first call
GET https://api.decathlon.net//sportstrackingdata/v2/me/
Curl
curl -X GET \
https://api.decathlon.net//sportstrackingdata/v2/me/ \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
Sample answer
{
"@context": "/v2/contexts/User",
"@id": "/v2/users/YOUR_LDID",
"@type": "User",
"id": "YOUR_LDID
"personId": "YOUR_PERSON_ID",
"gender": 1,
"roles": [
"ROLE_USER"
],
"language": "fr",
"country": "fr",
"imageUrl": null,
"birthDate": "1990-10-24",
"scheduleDelete": null,
"createdAt": "2019-03-18T13:07:02+00:00",
"updatedAt": "2020-02-26T10:11:58+00:00",
"monthlyActivityMail": true,
"unit": "metric"
}
Congratulations ! You executed your first request to know your basic settings of you user account. Now you will be able to add sport activities and get them by API.
Referentials
Sports Tracking Data supports many sports, many units to analyse sport activities and user's measures. To allow this, Sports Tracking Data uses a lot of abstraction. It permits to add a new sport or a new unit in a referential, then the new item is usable for everyone.
This is the list of the referentials :
Main referentials
- Datatype
- Sport
Each time you refer to a sport, you have to indicate the ressource id which refers to the referential. Example, if you create a new sport activity for an user, you will indicate the sport "/v2/sports/121" which refers to the Running. In same manner, Datatype is the referential of each units and measures of Sports Data. Example : Distance, Duration, Speed Current, Speed average, Speed max, elevation, body weight, body height...
Main datatypes
Here we provide a top 25 extract from datatypes referencial used to give you a preview of the list.
Id | unit | label | cumulable | recordWay |
---|---|---|---|---|
99 | Ons | Points earned | 1 | 1 |
24 | s | Duration | 1 | 1 |
5 | m | Distance | 1 | 1 |
23 | kcal | Calories burnt | 1 | 1 |
9 | m/h | Speed avg | 1 | |
6 | m/h | Speed current | 0 | |
18 | m | Ascent | 1 | 1 |
19 | m | Descent | 1 | 1 |
16 | m | Elevation min | 0 | |
15 | m | Elevation max | 1 | |
14 | m | Elevation current | 0 | |
36 | Mode | 0 | ||
4 | bpm | HR avg | 0 | |
7 | m/h | Speed max | 1 | |
3 | bpm | HR max | 1 | |
1 | bpm | HR current | 0 | |
20 | bool | Lap | 0 | |
17 | m | Elevation avg | 0 | |
10 | steps/min | Cadence current | 0 | |
177 | Bike trainer resistance | 0 | ||
207 | Avg Bike Trainer Resistance | 0 | ||
206 | Avg Bike Trainer Resistance | 1 | ||
103 | rpm | RPM avg | 1 | |
101 | rpm | RPM max | 0 | |
100 | rpm | RPM current | 0 |
Example with Sport referential
A referential is read only. If you have a request to add a new item please contact the support.
GET https://api.decathlon.net/sportstrackingdata/v2/sports
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/sports?active=1&page=1 \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
Response
status 200 : OK
{
"@context": "/v2/contexts/Sport",
"@id": "/v2/sports",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/v2/sports/7",
"@type": "Sport",
"id": 7,
"translatedNames": {
"de": "Gleitschirmfliegen",
"en": "Paragliding",
"es": "Parapente",
"fr": "Parapente",
"hu": "Siklóernyős",
"it": "Parapendio",
"nl": "Paragliding",
"pl": "Paralotniarstwo",
"pt": "Parapente",
"ru": "Параплан",
"zh": "滑翔伞"
},
"universe": "/v2/universes/1",
"active": true,
"createdAt": "2018-03-14T13:09:00+00:00",
"updatedAt": "2018-08-10T04:00:07+00:00"
},
{
"@id": "/v2/sports/10",
"@type": "Sport",
"id": 10,
"translatedNames": {
"de": "Basketball",
"en": "Basketball",
"es": "Baloncesto",
"fr": "Basketball",
"hu": "Kosárlabda",
"it": "Basket",
"nl": "Basketbal",
"pl": "Koszykówka",
"pt": "Basquetebol",
"ru": "Баскетбол",
"zh": "篮球"
},
"universe": "/v2/universes/2",
"active": true,
"createdAt": "2018-03-14T13:09:00+00:00",
"updatedAt": "2018-08-10T04:00:07+00:00"
},
{
"@id": "/v2/sports/13",
"@type": "Sport",
"id": 13,
"translatedNames": {
"de": "Fußball",
"en": "Football",
"es": "Fútbol",
"fr": "Football",
"hu": "Labdarúgás",
"it": "Calcio",
"nl": "Voetbal",
"pl": "Piłka nożna",
"pt": "Futebol",
"ru": "Футбол",
"zh": "足球"
},
"universe": "/v2/universes/2",
"active": true,
"createdAt": "2018-03-14T13:09:00+00:00",
"updatedAt": "2018-08-10T04:00:08+00:00"
},
{
"@id": "/v2/sports/18",
"@type": "Sport",
"id": 18,
"translatedNames": {
"de": "Handball",
"en": "Handball",
"es": "Balonmano",
"fr": "Handball",
"hu": "Kézilabda",
"it": "Pallamano",
"nl": "Handbal",
"pl": "Piłka ręczna",
"pt": "Andebol",
"ru": "Гандбол",
"zh": "手球"
},
"universe": "/v2/universes/2",
"active": true,
"createdAt": "2018-03-14T13:09:00+00:00",
"updatedAt": "2018-08-10T04:00:08+00:00"
},
{
"@id": "/v2/sports/20",
"@type": "Sport",
"id": 20,
"translatedNames": {
"de": "Hockey",
"en": "Hockey",
"es": "Hockey",
"fr": "Hockey",
"hu": "Jéghoki",
"it": "Hockey",
"nl": "Hockey",
"pl": "Hokej",
"pt": "Hóquei",
"ru": "Хоккей",
"zh": "曲棍球"
},
"universe": "/v2/universes/2",
"active": true,
"createdAt": "2018-03-14T13:09:00+00:00",
"updatedAt": "2018-08-10T04:00:08+00:00"
},
...
],
"hydra:view": {
"@id": "/v2/sports?active=1&page=1",
"@type": "hydra:PartialCollectionView",
"hydra:next": "/v2/sports?active=1&page=2"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/v2/sports{?active}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
"@type": "IriTemplateMapping",
"variable": "active",
"property": "active",
"required": false
}
]
}
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Main sports list
Here we provide an extract from the sport referencial to give you a preview of the sports and their IDs.
Id | Sport name |
---|---|
176 | Alpine skiing |
183 | Alternative Nordic skiing |
260 | Aqua gym sessions |
326 | Archery |
177 | Back country skiing |
335 | Badminton |
10 | Basketball |
381 | Bicycle |
360 | BMX |
264 | Bodyboarding |
35 | Boxing |
265 | Canoeing and kayaking |
161 | Climbing |
397 | Cross trainer |
404 | Cross training |
402 | Daily activity |
79 | Dancing |
91 | Fitness |
13 | Football |
320 | Golf |
18 | Handball |
168 | Hiking |
20 | Hockey |
401 | Home Trainer |
200 | Horse riding |
110 | Indoor fitness bike |
98 | Indoor weight training |
367 | Inline skating |
405 | Jumping rope |
273 | Kite surfing |
366 | Land sailing |
45 | Martial arts |
388 | Mountain biking |
153 | Mountaineering |
184 | Nordic skating |
114 | Nordic walking |
127 | Orientation racing |
340 | Padel |
7 | Paragliding |
109 | Pilates |
385 | Road cycling |
263 | Rowing |
398 | Rowing machine |
27 | Rugby |
399 | Run & Bike |
121 | Running |
301 | Sailing |
380 | Scooter |
374 | Skateboarding |
174 | Skiing |
173 | Snow-shoeing |
185 | Snowboarding |
354 | Squash |
400 | Stand up paddle boarding |
296 | Surfing |
274 | Swimming |
358 | Table tennis |
357 | Tennis |
126 | Trail |
395 | Treadmill |
77 | Triathlon |
284 | Underwater diving |
32 | Volleyball |
113 | Walking |
280 | Wind surfing |
105 | Yoga |
403 | Zumba |
Connected products referentials
- Brand
- DeviceModel
- Firmware
- Connector
These referentials are linked to the Decathlon connected products. They allow to manage the devices and get a traceability of the model and the firmwares used.
Other referentials
- PoiCategory : list the different categories to classify a Point of Interest
- StorageKey : list the different key allowed to store some data
- Universe : list the universes to classify the different sports
Create a device
To create a sport activity, you have two manners to declare it :
- manual creation : useful for an activity created by a form or a third app.
- With a device and a connector : Useful for an activity created by a Decathlon product to allow the traceability
This page shows you how to create a new device for an user.
Request
POST https://api.decathlon.net/sportstrackingdata/v2/user_devices
Request body
{
"serial": "serialnumber123456",
"model": "/v2/device_models/1",
"firmware": "/v2/firmware/1",
"user": "/v2/users/{{user_id}}",
"ownership": 0,
"lastConnectedAt": "2018-04-16T16:05:11.896Z"
}
You will need to indicated some URI ressources to create a new device :
- model refers to an URI of the DeviceModel Referential
- firmware refers to an URI of the Firmware Referential
- user refers to the URI of your user
Curl
curl -X POST \
https://api.decathlon.net/sportstrackingdata/v2/user_devices \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-d '{
"serial": "serialnumber123456",
"model": "/v2/device_models/1",
"firmware": "/v2/firmware/1",
"user": "/v2/users/{{user_id}}",
"ownership": 0,
"lastConnectedAt": "2018-04-16T16:05:11.896Z"
}'
Response
status 201 : Created
{
"@context": "/v2/contexts/UserDevice",
"@id": "/v2/user_devices/eu271ed863164e25fb3d",
"@type": "UserDevice",
"id": "eu271ed863164e25fb3d",
"serial": "serialnumber123456",
"model": "/v2/device_models/1",
"firmware": "/v2/firmware/1",
"user": "/v2/users/820d0XXXXXa7013969",
"ownership": 0,
"lastConnectedAt": "2018-04-16T16:05:11+00:00",
"createdAt": "2018-08-17T09:35:13+00:00",
"updatedAt": "2018-08-17T09:35:13+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Thank to the new device URI : "/v2/user_devices/eu271ed863164e25fb3d" you will be able to create a new sport activity linked to this device.
Please refer to the swagger to see how to list all devices for an user, how to update a device for example if the firmware is updated.
Serial number of the device
Generally, the serial come from :
- the real serial number of the product (ex: 1CD2071D-1440-4E5F-8C23-446D3B9B )
- on the smartphones , a string composed by the os and the user id (ex : androidapp-e615fb7b-839a-4e65-98)
We recommend these characters : a-z A-Z 0-9 -
Memo : why the device management is important
- each device is unique with its serial number
- each device could have specific configuration and settings (with user_device_setting)
- each device is linked to a model id (=> check the product of the user)
- each device is linked to a firmware (=> check the software of the product)
=> So it is important for troubleshooting when a problem occurs.
Retreive activities
Get the collection of activities.
Request
GET https://api.decathlon.net/sportstrackingdata/v2/activities
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/activities \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
Response
status 200 : Ok
{
"@context": "/v2/contexts/Activity",
"@id": "/v2/activities",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/v2/activities/eu205bc29d9975f27cfb",
"@type": "Activity",
"id": "eu205bc29d9975f27cfb",
"name": "Test V2 - Android - 21 juin 2018",
"user": "/v2/users/ed3a20dfabaf09ae73f6",
"sport": "/v2/sports/381",
"userDevice": null,
"startdate": "2018-06-21T09:36:03+02:00",
"duration": 753,
"latitude": null,
"longitude": null,
"elevation": null,
"manual": true,
"comment": null,
"connector": null,
"userSession": null,
"correctedElevation": true,
"images": [],
"thumbnail": "https://linkdata-ressources-eu2.geonaute.com/prod/ed3a20dfabaf09ae73f6/maps/eu205bc29d9975f27cfb.png",
"dataSummaries": {
"5": 4127,
"9": 19731,
"15": 42,
"16": 25,
"18": 17,
"19": 1,
"23": 117,
"24": 753,
"97": 70,
"99": 70
},
"tags": [],
"trackFlag": true,
"datastreamFlag": true,
"globalChallenge": null,
"availableDatatypes": [
5,
9,
23,
24,
97,
99,
6,
14
],
"createdAt": "2018-06-21T08:35:36+00:00",
"updatedAt": "2018-06-21T08:35:38+00:00"
}
],
"hydra:view": {
"@id": "/v2/activities?limit=2&page=1",
"@type": "hydra:PartialCollectionView",
"hydra:next": "/v2/activities?limit=2&page=2"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/v2/activities{?user,user[]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
"@type": "IriTemplateMapping",
"variable": "user",
"property": "user",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "user[]",
"property": "user",
"required": false
}
]
}
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Filters
You could apply many filter on this request, for example an interval of date, a sport id, ...
Add an activity
Add a sport activity to your account
Request
POST https://api.decathlon.net/sportstrackingdata/v2/activities
Request Body
To construct the body of our activity, you will need to describe the activity, name, startdate and furnhish some nodes of data :
- dataSummaries : The consolidated values of your activity like the average speed, the length, the distance... (required)
- datastream : The curves of values (speed, heartrate, ...) (optional)
- locations : the GPS track (optional)
{
"name":"My workout",
"startdate":"2018-04-19T08:28:49+02:00",
"duration":954,
"user":"/v2/users/{{user_id}}",
"sport":"/v2/sports/381",
"connector":"/v2/connectors/702",
"location":{
"elapsed_time":0,
"latitude":50.638437762,
"longitude":3.125975041,
"elevation":0,
"device":{
"firmware":59,
"model":17,
"serial":"androidapp-f72c681e8442049956db",
"user":"/v2/users/{{user_id}}"
},
"manual":"false"
},
"dataSummaries":{
"6":86927,
"9":19227,
"5":5095,
"24":954
},
"datastream":{
"0":{
"5":0,
"6":0,
"36":0
},
"1":{
"5":0,
"6":20135,
"36":0
},
"2":{
"5":24,
"6":86927,
"36":0
},
"3":{
"5":24,
"6":86927,
"36":0
},
"4":{
"5":32,
"6":15752,
"36":0
},
"5":{
"5":32,
"6":15752,
"36":0
},
"6":{
"5":42,
"6":35303,
"36":0
},
"7":{
"5":42,
"6":35303,
"36":0
},
"8":{
"5":52,
"6":17334,
"36":0
},
"9":{
"5":52,
"6":17334,
"36":0
},
"10":{
"5":65,
"6":23206,
"36":0
},
"11":{
"5":65,
"6":23206,
"36":0
}
},
"locations":{
"0":{
"latitude":50.638437762,
"longitude":3.125975041,
"elevation":0
},
"5":{
"latitude":50.63821090457489,
"longitude":3.125491838207934,
"elevation":0
},
"11":{
"latitude":50.63806783149301,
"longitude":3.125056386784151,
"elevation":0
}
}
}
Curl
curl -X POST \
https://api.decathlon.net/sportstrackingdata/v2/activities \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-d '{ {
"name":"My workout",
"startdate":"2018-04-19T08:28:49+02:00",
"duration":954,
"user":"/v2/users/{{user_id}}" ... }'
Response
status 201 : Created
{
"@context": "/v2/contexts/Activity",
"@id": "/v2/activities/eu2a8ff4b670340f5144",
"@type": "Activity",
"id": "eu2a8ff4b670340f5144",
"name": "My workout",
"user": "/v2/users/ed3a20dfabaf09ae73f6",
"sport": "/v2/sports/381",
"userDevice": null,
"startdate": "2018-04-19T08:28:49+02:00",
"duration": 954,
"latitude": null,
"longitude": null,
"elevation": null,
"manual": false,
"comment": null,
"connector": "/v2/connectors/702",
"userSession": null,
"correctedElevation": false,
"images": [],
"thumbnail": "https://linkdata-ressources.geonaute.com/sports/381_h.jpg",
"dataSummaries": {
"5": 5095,
"6": 86927,
"9": 19227,
"23": 148,
"24": 954,
"99": 88
},
"tags": [],
"trackFlag": true,
"datastreamFlag": true,
"globalChallenge": null,
"availableDatatypes": [
6,
9,
5,
24,
23,
99,
36
],
"createdAt": "2018-06-25T08:28:18+00:00",
"updatedAt": "2018-06-25T08:28:18+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Some abstraction with referentials
- Each sport has an ID ...91 = fitness ...121 = running ...Etc.
- Each data has a data_type id. ...Ex : speed, distance, duration, speed max, speed min, speed average, steps, elevation ... ...24 = duration ...5 = distance ...Etc.
These abstractions allow to manipulate any sports with any data. (Tennis, running, swimming, golf, etc.)
Limitations
- You can not POST an activity with a payload size bigger than 3 Mo.
Anatomy of an activity
In this part we describe the components of an activity.
Request
GET https://api.decathlon.net/sportstrackingdata/v2/activities/{{ACTIVITY_TOKEN}}
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/activities/{{ACTIVITY_TOKEN}} \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}'
Response
status 200 : OK
{
"@context": "/v2/contexts/Activity",
"@id": "/v2/activities/eu2cbe4bbb24082fd9ad",
"@type": "Activity",
"id": "eu2cbe4bbb24082fd9ad",
"name": "Biking 2019-02-12 14:07",
"user": "/v2/users/820d0XXXXXa7013969",
"sport": "/v2/sports/381",
"userDevice": null,
"startdate": "2019-02-12T14:07:33+00:00",
"duration": 8311,
"latitude": 50.741407871246,
"longitude": 3.2376379240304,
"elevation": 35,
"manual": true,
"comment": null,
"connector": null,
"userSession": null,
"correctedElevation": true,
"images": [],
"thumbnail": "https://linkdata-ressources-eu2.geonaute.com/prod/820d0XXXXXa7013969/maps/eu2cbe4bbb24082fd9ad.png",
"dataSummaries": {
"3": 159,
"4": 122,
"5": 18375,
"7": 31554,
"9": 12798,
"11": 53,
"13": 81,
"15": 65,
"16": 15,
"18": 114,
"19": 119,
"23": 680,
"24": 8311,
"97": 435,
"99": 435
},
"trackFlag": true,
"datastreamFlag": true,
"globalChallenge": null,
"availableDatatypes": [
3,
4,
5,
7,
9,
11,
13,
23,
24,
97,
99,
18,
19,
16,
15,
20,
1,
10,
6,
14
],
"createdAt": "2019-02-28T14:01:37+00:00",
"updatedAt": "2019-02-28T14:01:40+00:00",
"datastream": {
"18": {
"1": 117,
"5": 0,
"6": 4705,
"10": 0,
"14": 35,
"20": 1
},
"19": {
"1": 117,
"5": 1.90784933,
"6": 5684,
"10": 0,
"14": 35
},
"21": {
"1": 117,
"5": 6.143301449999999,
"6": 7416,
"10": 0,
"14": 34.600586
},
// .... //
"8308": {
"1": 129,
"5": 18375.077684660002,
"6": 6152,
"10": 0,
"14": 30.799805
},
"8311": {
"1": 130,
"5": 18375.148398160003,
"6": 0,
"10": 0,
"14": 30.799805
}
},
"locations": {
"18": {
"latitude": 50.74140787124634,
"longitude": 3.237637924030423,
"elevation": 35
},
"19": {
"latitude": 50.74142279103398,
"longitude": 3.237651251256466,
"elevation": 35
},
"21": {
"latitude": 50.74145246297121,
"longitude": 3.237688886001706,
"elevation": 34.600586
},
// .... //
"8308": {
"latitude": 50.74317938648164,
"longitude": 3.2363532297313213,
"elevation": 30.799805
},
"8311": {
"latitude": 50.7431798055768,
"longitude": 3.2363539841026068,
"elevation": 30.799805
}
},
"tags": []
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Zoom on descriptive fields
We find here all the field to basically describe the activity.
{
"@context": "/v2/contexts/Activity",
"@id": "/v2/activities/eu2a32c58982e074eb4a",
"@type": "Activity",
"id": "eu2a32c58982e074eb4a",
"name": "Course à pied - 02/01/2020",
"user": "/v2/users/dfdc03c5bcddd459f170", // sport of the activity
"sport": "/v2/sports/121", // sport of the activity
"userDevice": null, // Decathlon user device id, required if the activity is not manual
"startdate": "2020-01-02T12:29:46+01:00", // datetime of the start of the activity
"duration": 4008, // total duration in seconds
"latitude": 50.6292217, //first GPS points if exists
"longitude": 3.06597,
"elevation": 28.600586,
"manual": false, // the activity is considered as manual when there is no Decathlon device declared
"comment": null, // user comment on his activity
"connector": "/v2/connectors/801", // Decathlon Connector id, required if the activity is not manual
"userSession": null, // Id of an userSession when the activity is linked to coaching content
"correctedElevation": true, // internal flag when the elevation is corrected by satelite data
"images": [], //collection of url images added to the activity
"thumbnail": "https://XXXXXX", // thumbnail generated
"trackFlag": true, // is the activity has a GPS track
"datastreamFlag": true, // is the activity has a dataStream
"globalChallenges": [], // if linked to a Decathlon global challenge
"equipments": [], // equipments used during the activity
"tags": [], // collection of user tag attached to the activity
"createdAt": "2020-01-06T09:15:31+00:00",
"updatedAt": "2020-01-06T09:15:33+00:00"
}
Zoom on dataSummaries
The dataSummaries are the data consolidated for the activity. You can store here for the whole activity different type of datatype :
- total (duration, distance, kcal...)
- average (speed average, Heart rate ...)
- minimum (altitude, ...)
- maximum (altitude, speed...)
{
"dataSummaries": {
"3": 159,
"4": 122,
"5": 18375, // total distance 18375 meters
"7": 31554,
"9": 12798, // average speed of 12.798 km/h
"11": 53,
"13": 81,
"15": 65,
"16": 15,
"18": 114,
"19": 119,
"23": 680, // total kcal 680
"24": 8311,
"97": 435,
"99": 435
}
}
Zoom on availableDatatypes
This node declares all the datatypes used in the dataSummary or in the datastream.
{
"availableDatatypes": [
3,
4,
5,
7,
9,
11,
13,
23,
24,
97,
99,
18,
19,
16,
15,
20,
1,
10,
6,
14
]
}
Zoom on datastream
The datastream is a vector depending to the elapsed_time (t0 = 0sec) with all the values which can be displayed as curves or timestamped event during the activity.
In the datastream we support all the datatypes supported (please refer to /v2/datatypes).
{
"datastream": {
"18": { //first measure at 18 seconds
"1": 117, // current heart rate
"5": 0, // 0 meters achieved
"6": 4705, // 4,705 Km/h of current speed
"10": 0,
"14": 35,
"20": 1 // a lap is declared here (as a boolean)
},
"19": {
"1": 117,
"5": 1.90784933,
"6": 5684,
"10": 0,
"14": 35
},
"21": {
"1": 117,
"5": 6.143301449999999,
"6": 7416,
"10": 0,
"14": 34.600586
},
// .... //
"8308": {
"1": 129,
"5": 18375.077684660002,
"6": 6152,
"10": 0,
"14": 30.799805
},
"8311": {
"1": 130,
"5": 18375.148398160003,
"6": 0,
"10": 0,
"14": 30.799805
}
}
}
Zoom on locations
The locations stream is a vector depending to the elapsed_time (t0 = 0sec) with all the GPS coordinates to display the track of the user.
If the activity is stationary the node should be empty ("locations": {})
{
"locations": {
"18": {// first GPS point at 18 sec
"latitude": 50.74140787124634,
"longitude": 3.237637924030423,
"elevation": 35
},
"19": {
"latitude": 50.74142279103398,
"longitude": 3.237651251256466,
"elevation": 35
},
"21": {
"latitude": 50.74145246297121,
"longitude": 3.237688886001706,
"elevation": 34.600586
},
// .... //
"8308": {
"latitude": 50.74317938648164,
"longitude": 3.2363532297313213,
"elevation": 30.799805
},
"8311": {
"latitude": 50.7431798055768,
"longitude": 3.2363539841026068,
"elevation": 30.799805
}
}
}
GPX and TCX compatibility
You can also get an activity in GPX or TCX format.
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/activities/{{ACTIVITY_TOKEN}} \
-H 'Authorization: Bearer {your bearer}' \
-H 'Accept: application/gpx+xml' \
-H 'x-api-key: {your api key}'
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/activities/{{ACTIVITY_TOKEN}} \
-H 'Authorization: Bearer {your bearer}' \
-H 'Accept: application/tcx+xml' \
-H 'x-api-key: {your api key}'
Header accept for GPX
Accept: application/gpx+xml
Header accept for TPX
Accept: application/tcx+xml
User Records
All
These records concern the best activities on global value (datasummary)
- Distance (5)
- Average speed (9)
- Duration (24)
- Kcal (23)
- ON points (99)
- Ascent : Elevation gain (18)
- Descent : Elevation loss (19)
Inside activity
These records are calculated inside the activity. You could do a slow 10 km but with the best 200m of your life. We grab it and store it here. All these records are with datatype duration (24) in seconds (aka the time to complete the distance).
- distance.200m
- distance.400m
- distance.804m
- distance.1000m
- distance.1609m
- distance.3218m
- distance.5000m
- distance.10000m
- distance.21097m
- distance.42195m
- distance.80000m
- distance.100000m
Retreive user's records
Get the collection of records.
Request
GET https://api.decathlon.net/sportstrackingdata/v2/user_records
Here we get all records for an user and specify the sport 121 (aka Running cf /v2/sports)
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/user_records?sport=121 \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
Response
status 200 : Ok
{
"@context": "/v2/contexts/UserRecord",
"@id": "/v2/user_records",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/v2/user_records/1558821",
"@type": "UserRecord",
"id": "1558821",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/5",
"activity": "/v2/activities/eu21ec7ac76128fa6151",
"sport": "/v2/sports/121",
"type": "all",
"value": 7651,
"createdAt": "2019-01-30T20:19:53+00:00",
"updatedAt": "2019-01-30T20:19:53+00:00",
"date": "2018-11-18T12:00:00+00:00"
},
{
"@id": "/v2/user_records/1558827",
"@type": "UserRecord",
"id": "1558827",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/99",
"activity": "/v2/activities/eu21ec7ac76128fa6151",
"sport": "/v2/sports/121",
"type": "all",
"value": 353,
"createdAt": "2019-01-30T20:19:53+00:00",
"updatedAt": "2019-01-30T20:19:53+00:00",
"date": "2018-11-18T12:00:00+00:00"
},
{
"@id": "/v2/user_records/1558826",
"@type": "UserRecord",
"id": "1558826",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/24",
"activity": "/v2/activities/eu21ec7ac76128fa6151",
"sport": "/v2/sports/121",
"type": "all",
"value": 2561,
"createdAt": "2019-01-30T20:19:53+00:00",
"updatedAt": "2019-01-30T20:19:53+00:00",
"date": "2018-11-18T12:00:00+00:00"
},
{
"@id": "/v2/user_records/1558825",
"@type": "UserRecord",
"id": "1558825",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/23",
"activity": "/v2/activities/eu21ec7ac76128fa6151",
"sport": "/v2/sports/121",
"type": "all",
"value": 538,
"createdAt": "2019-01-30T20:19:53+00:00",
"updatedAt": "2019-01-30T20:19:53+00:00",
"date": "2018-11-18T12:00:00+00:00"
},
{
"@id": "/v2/user_records/1558824",
"@type": "UserRecord",
"id": "1558824",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/19",
"activity": "/v2/activities/eu21ec7ac76128fa6151",
"sport": "/v2/sports/121",
"type": "all",
"value": 39,
"createdAt": "2019-01-30T20:19:53+00:00",
"updatedAt": "2019-01-30T20:19:53+00:00",
"date": "2018-11-18T12:00:00+00:00"
},
{
"@id": "/v2/user_records/1558823",
"@type": "UserRecord",
"id": "1558823",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/18",
"activity": "/v2/activities/eu21ec7ac76128fa6151",
"sport": "/v2/sports/121",
"type": "all",
"value": 40,
"createdAt": "2019-01-30T20:19:53+00:00",
"updatedAt": "2019-01-30T20:19:53+00:00",
"date": "2018-11-18T12:00:00+00:00"
},
{
"@id": "/v2/user_records/1558822",
"@type": "UserRecord",
"id": "1558822",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/9",
"activity": "/v2/activities/eu21ec7ac76128fa6151",
"sport": "/v2/sports/121",
"type": "all",
"value": 10755,
"createdAt": "2019-01-30T20:19:53+00:00",
"updatedAt": "2019-01-30T20:19:53+00:00",
"date": "2018-11-18T12:00:00+00:00"
},
{
"@id": "/v2/user_records/1558801",
"@type": "UserRecord",
"id": "1558801",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/24",
"activity": "/v2/activities/eu2511d65eadf35f5083",
"sport": "/v2/sports/121",
"type": "distance.804m",
"value": 491,
"createdAt": "2019-01-30T20:18:53+00:00",
"updatedAt": "2019-01-30T20:18:53+00:00",
"date": "2019-01-30T12:00:00+00:00"
}
],
"hydra:view": {
"@id": "/v2/user_records?sport=121&page=1",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/v2/user_records{?activity,activity[],sport,sport[],type,type[],order[id],order[type],order[value],order[createdAt],order[updatedAt]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
"@type": "IriTemplateMapping",
"variable": "activity",
"property": "activity",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "activity[]",
"property": "activity",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "sport",
"property": "sport",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "sport[]",
"property": "sport",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "type",
"property": "type",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "type[]",
"property": "type",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[id]",
"property": "id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[type]",
"property": "type",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[value]",
"property": "value",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[createdAt]",
"property": "createdAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[updatedAt]",
"property": "updatedAt",
"required": false
}
]
}
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Focus on record element
{
"@id": "/v2/user_records/1558822",
"@type": "UserRecord",
"id": "1558822",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/9",
"activity": "/v2/activities/eu21ec7ac76128fa6151",
"sport": "/v2/sports/121",
"type": "all",
"value": 10755,
"createdAt": "2019-01-30T20:19:53+00:00",
"updatedAt": "2019-01-30T20:19:53+00:00",
"date": "2018-11-18T12:00:00+00:00"
}
We can distinguish, five major fields :
- datatype : it is the type of record : max time, max elevation gain, max average speed (cf /v2/datatypes)
- activity : it is the ressource id of the activity which owns this record
- sport : the sport record : running, walking...
- type : All represent a record on the entire activity, the others represent a part of the activity, for example "distance.5000m" it is your best 5K
- value : it is the value of your record for example 15000 m/h for average speed in running
A record type all
- datatype : 9 (average speed)
- sport : 121 (running)
- type : all
- value : 10755 (10,755 km/h)
- activity : eu21ec7ac76128fa6151
A record type distance.x
A record type distance.5000m
{
"@id": "/v2/user_records/1558820",
"@type": "UserRecord",
"id": "1558820",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/24",
"activity": "/v2/activities/eu21ec7ac76128fa6151",
"sport": "/v2/sports/121",
"type": "distance.5000m",
"value": 1654,
"createdAt": "2019-01-30T20:19:52+00:00",
"updatedAt": "2019-01-30T20:19:52+00:00",
"date": "2018-11-18T12:00:00+00:00"
}
- datatype : 24 (duration seconds)
- sport : 121 (running)
- type : distance.5000m
- value : 1654 (27min)
- activity : eu21ec7ac76128fa6151
Calculation of records
The records are calculated automatically after the import of an activity. To delete a record, you have to modify or delete the activity attached to the record.
Share an activity
It is possible to activate public sharing of an activity. Everyone will be able to access to the activity by API without any user security.
When you share an activity, you create a public token that you can repudiate.
Create the public share token
Firstly, you need the URI of the activity that you want to share, example :
- "/v2/activities/eu2511d65eadf35f5083"
Request
GET https://api.decathlon.net/sportstrackingdata/v2/share_activities
Request Body
{
"user": "/v2/users/eu23d736c047075def68",
"activity": "/v2/activities/eu2511d65eadf35f5083"
}
Curl
curl -X POST \
https://api.decathlon.net/sportstrackingdata/v2/share_activities \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-d '{
"user": "/v2/users/eu23d736c047075def68",
"activity": "/v2/activities/eu2511d65eadf35f5083"
}'
Response
status 201 : Created
{
"@context": "/v2/contexts/ShareActivity",
"@id": "/v2/share_activities/eu244e2e987f749dbde5",
"@type": "ShareActivity",
"id": "eu244e2e987f749dbde5",
"user": "/v2/users/eu23d736c047075def68",
"activity": {
"@id": "/v2/activities/eu2511d65eadf35f5083",
"@type": "Activity",
"id": "eu2511d65eadf35f5083",
"name": "Test V2 - Android - 30 janvier 2019",
"user": "/v2/users/eu23d736c047075def68",
"sport": "/v2/sports/121",
"userDevice": null,
"startdate": "2019-01-30T12:00:00+00:00",
"duration": 580,
"latitude": 50.6445,
"longitude": 3.14039,
"elevation": 28,
"manual": true,
"comment": null,
"connector": null,
"userSession": null,
"images": [],
"thumbnail": "https://linkdata-ressources-eu2.geonaute.com/preprod/eu23d736c047075def68/maps/eu2511d65eadf35f5083.png",
"dataSummaries": {
"5": 934,
"7": 9000,
"9": 5797,
"15": 37,
"16": 27,
"18": 9,
"19": 10,
"23": 37,
"24": 580,
"97": 24,
"99": 24
},
"globalChallenge": null,
"availableDatatypes": [
5,
7,
9,
15,
16,
18,
19,
23,
24,
97,
99,
14,
6
],
"createdAt": "2019-01-30T20:18:51+00:00",
"updatedAt": "2019-01-30T20:18:54+00:00",
"datastream": {
"0": {
"5": 0,
"6": 4680,
"14": 28.40039
},
"4": {
"5": 5,
"6": 4400,
"14": 28.299805
},
"5": {
"5": 6,
"6": 4320,
"14": 28.299805
},
"9": {
"5": 11,
"6": 5400,
"14": 28.299805
},
"10": {
"5": 13,
"6": 5400,
"14": 28.299805
},
...
},
"locations": {
"0": {
"latitude": 50.6445,
"longitude": 3.14039,
"elevation": 28.40039
},
"4": {
"latitude": 50.64447,
"longitude": 3.14033,
"elevation": 28.299805
},
"5": {
"latitude": 50.64446,
"longitude": 3.14032,
"elevation": 28.299805
},
...
},
"tags": null
}
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Thank to the new share URI : "/v2/share_activities/eu244e2e987f749dbde5" you will be able to get this activity.
GET the activity
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/share_activities/eu244e2e987f749dbde5 \
-H 'Accept: application/ld+json, application/json, text/html'
-H 'x-api-key: {your api key}' \
Once the share public token generated, you can GET the activity without any user security.
GET "/v2/share_activities/eu244e2e987f749dbde5"
Photos and Thumbnails
By default, for each sport activity the API generates a thumbnail (a map or a picture of the sport practiced). You could change this thumbnail url and add many url photos to your activity. To facilitate the use of url, we provide an API to store pictures online.
Content | Level | Limitation |
---|---|---|
Thumbnail | Recommandation | less than 300Ko |
Photo | Mandatory | less than 3Mo |
Upload a photo
Request
POST https://api.decathlon.net/sportstrackingdata/v2/upload
Curl
curl -X POST \
https://api.decathlon.net/sportstrackingdata/v2/upload \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-F 'file=@/path/myphoto.jpg'
Response
status 200 : Ok
{
"url":"https:\/\/example.com/2caf4b77b497b64bef1c3ba2b1d0744f25db3ce3"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Add photo to an activity
Request
PUT https://api.decathlon.net/sportstrackingdata/v2/activities/TOKEN
Curl
curl -X PUT \
https://api.decathlon.net/sportstrackingdata/v2/activities/TOKEN \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-d '{
"images":["https://example.com/2caf4b77b497b64bef1c3ba2b1d0744f25db3ce3"]
}'
Change the thumbnail
Curl
curl -X PUT \
https://api.decathlon.net/sportstrackingdata/v2/activities/TOKEN \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-d '{
"thumbnail":"https://example.com/2caf4b77b497b64bef1c3ba2b1d0744f25db3ce3"
}'
Before changing the thumbnail, it could be useful to save the actual thumbnail as an image to not lose the url generated by the API.
Request
PUT https://api.decathlon.net/sportstrackingdata/v2/activities/TOKEN
User equipments
User equipments allows you to create your own connected locker . Thanks to this, you will be able to know the usage of your equipments on 3 elements :
- Distance
- Duration
- Number of session
We provide 4 categories (shoes, bike, racquet, other).
You can link an equipment to a single or multiple sports. A sport can only have 1 equipment by category linked (1 pair of shoes, 1 bike, or 1 racket). For example if you're linking an new shoes to Running, who already had a default shoes, your new one will replace the previous one.
After doing a sport activity, your activity's sum-up (Distance, Duration, Number of session) will be added to your equipment(s).
Create a new user equipment
Request
POST https://api.decathlon.net/sportstrackingdata/v2/user_equipments
Request Body
{
"user": "/v2/users/{userId}",
"category": "shoes",
"brand": "Kalenji",
"name": "KIPRUN KS LIGHT 2",
"startDate": "2020-06-12T09:18:00+00:00",
"sportsAutoAssigned": [
"/v2/sports/{sportId}"
]
}
You will need to indicated some URI ressources to create a new user equipment :
- sportsAutoAssigned refers to the URI of the sport
- user refers to the URI of your user
Curl
curl -X POST \
https://api.decathlon.net/sportstrackingdata/v2/user_equipments \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-d '{
"user": "/v2/users/{userId}",
"category": "shoes",
"brand": "Kalenji",
"name": "KIPRUN KS LIGHT 2",
"startDate": "2020-06-12T09:18:00+00:00",
"sportsAutoAssigned": [
"/v2/sports/{sportId}"
]
}'
By giving a sport auto assigned, that means that your equipment will be automatically incremented with this sport's activities.
Response
status 201 : Created
{
"@context": "\/v2\/contexts\/UserEquipment",
"@id": "\/v2\/user_equipments\/{equipmentId}",
"@type": "UserEquipment",
"id": "{equipmentId}",
"user": "\/v2\/users\/{userId}",
"category": "shoes",
"brand": "KALENJI",
"name": "KIPRUN KS LIGHT 2",
"startDate": "2020-06-12T09:18:00+00:00",
"sumups": [],
"sportsAutoAssigned": [
{
"@id": "\/v2\/sports\/{sportId}",
"@type": "Sport",
"translatedNames": {
"de": "Laufsport",
"en": "Running",
"es": "Carrera",
"fr": "Course à pied",
"hu": "Futás",
"it": "Corsa a piedi",
"nl": "Hardlopen",
"pl": "Bieg",
"pt": "Corrida",
"ru": "Бег",
"zh": "赛跑"
}
}
],
"createdAt": "2019-07-19T08:44:27+00:00",
"updatedAt": "2019-07-19T08:44:27+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Autocomplete
To simplify equipment's creation we propose an autocompletion API. You can use parameters on URL to optimize the result :
/autocomplete/name/air?brand=NIKE
/autocomplete/brand/KALE?type=shoes
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/user_equipments/autocomplete/brand/KAL \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}'
Response
[
"KALENJI"
]
It will propose, according to what user wrote, an existing products list (for brand and product name).
Request
POST https://api.decathlon.net/sportstrackingdata/autocomplete/brand/{caracters}
POST https://api.decathlon.net/sportstrackingdata/autocomplete/name/{caracters}
Get user equipments
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/user_equipments?user={userId} \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}'
Response
status 200 : Ok
{
"@context": "\/v2\/contexts\/UserEquipment",
"@id": "\/v2\/user_equipments",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "\/v2\/user_equipments\/{equipmentId}",
"@type": "UserEquipment",
"id": "{equipmentId}",
"user": "\/v2\/users\/{userId}",
"category": "shoes",
"brand": "Kalenji",
"name": "KIPRUN KS LIGHT",
"sumups": {
"5": 47820,
"24": 5778,
"98": 1
},
"sportsAutoAssigned": [
{
"@id": "\/v2\/sports\/{sportId}",
"@type": "Sport",
"translatedNames": {
"de": "Laufsport",
"en": "Running",
"es": "Carrera",
"fr": "Course à pied",
"hu": "Futás",
"it": "Corsa a piedi",
"nl": "Hardlopen",
"pl": "Bieg",
"pt": "Corrida",
"ru": "Бег",
"zh": "赛跑"
}
}
],
"createdAt": "2019-07-11T12:44:12+00:00",
"updatedAt": "2019-07-11T13:31:36+00:00"
},
{
"@id": "\/v2\/user_equipments\/{equipmentId}",
"@type": "UserEquipment",
"id": "{equipmentId}",
"user": "\/v2\/users\/{userId}",
"category": "shoes",
"brand": "Kalenji",
"name": "KIPRUN KS LIGHT",
"sumups": {
"5": 20000,
"24": 95778,
"98": 2
},
"sportsAutoAssigned": [
{
"@id": "\/v2\/sports\/{sportId}",
"@type": "Sport",
"translatedNames": {
"de": "Walking",
"en": "Walking",
"es": "Caminata",
"fr": "Marche",
"hu": "Gyaloglás",
"it": "Marcia",
"nl": "Wandelen",
"pl": "Chód",
"pt": "Marcha",
"ru": "Ходьба",
"zh": "步行"
}
}
],
"createdAt": "2019-07-11T14:29:18+00:00",
"updatedAt": "2019-07-11T15:49:40+00:00"
}
],
"hydra:view": {
"@id": "\/v2\/user_equipments?user={userId}&page=1",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "\/v2\/user_equipments{?user,user[],sportsAutoAssigned,sportsAutoAssigned[]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
"@type": "IriTemplateMapping",
"variable": "user",
"property": "user",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "user[]",
"property": "user",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "sportsAutoAssigned",
"property": "sportsAutoAssigned",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "sportsAutoAssigned[]",
"property": "sportsAutoAssigned",
"required": false
}
]
}
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Modify user equipment
You can modify an equipment. For exemple if you want to change or add an auto assigned sport, or rename your equipment.
Request
PUT https://api.decathlon.net/sportstrackingdata/v2/user_equipments/{equipmentId}
Request Body
{
"sportsAutoAssigned": [
"/v2/sports/{sportId}"
]
}
Curl
curl -X PUT \
https://api.decathlon.net/sportstrackingdata/v2/user_equipments/{equipmentId} \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}'
-d '{ "sportsAutoAssigned": [
"/v2/sports/10"
]}'
Changing a auto assigned sport will not reset the equipment's sum-up. New auto assigned sport activities sum-up will be added to the previous.
Response
status 200: OK
{
"@context": "\/v2\/contexts\/UserEquipment",
"@id": "\/v2\/user_equipments\/{equipmentId}",
"@type": "UserEquipment",
"id": "{equipmentId}",
"user": "\/v2\/users\/{userId}",
"category": "shoes",
"brand": "KALENJI",
"name": "KIPRUN KS LIGHT 2",
"sumups": [],
"sportsAutoAssigned": [
{
"@id": "\/v2\/sports\/{sportId}",
"@type": "Sport",
"translatedNames": {
"de": "Gewichtheben",
"en": "Weightlifting",
"es": "Halterofilia",
"fr": "Haltérophilie",
"hu": "Súlyemelés",
"it": "Sollevamento pesi",
"nl": "Gewichtheffen",
"pl": "Podnoszenie ciężarów",
"pt": "Halterofilia",
"ru": "Тяжелая атлетика",
"zh": "举重"
}
}
],
"createdAt": "2019-07-19T09:07:47+00:00",
"updatedAt": "2019-07-19T09:08:42+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
You will need to indicated some URI ressources to modify an equipment :
- sportsAutoAssigned refers to the URI of the sport
Delete a user equipment
You can delete an equipment. Every informations, and link with activities will be dropped.
Curl
curl -X DELETE \
https://api.decathlon.net/sportstrackingdata/v2/user_equipments/{equipmentId} \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}'
Response
status 204: No Content
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Request
DELETE https://api.decathlon.net/sportstrackingdata/v2/user_equipments/{equipmentId}
Link an activity with an equipment
You can link (or unlink) an activity with an equipment. To do that, you have to edit an existing activity. Here is an exemple of an activity (who is not link to an equipment), and I want to link it to my shoes.
Request Body
{
"equipments": [
"/v2/user_equipments/{equipmentId}"
]
}
Request
PUT https://api.decathlon.net/sportstrackingdata/activities/{activityId}
Curl
curl -X PUT \
https://api.decathlon.net/sportstrackingdata/v2/activities/{activityId} \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}'
-d '{
"equipments": [
"/v2/user_equipments/{equipmentId}"
]
}'
Response
status 200: OK
{
"@context": "\/v2\/contexts\/Activity",
"@id": "\/v2\/activities\/{activityId}",
"@type": "Activity",
"id": "{activityId}",
"name": "Tennis",
"user": "\/v2\/users\/{userId}",
"sport": "\/v2\/sports\/{sportId}",
"userDevice": "\/v2\/user_devices\/{usrDeviceId}",
"startdate": "2019-07-30T23:42:42+02:00",
"duration": 3954,
"latitude": null,
"longitude": null,
"elevation": null,
"manual": false,
"comment": null,
"connector": "\/v2\/connectors\/{connectorId}",
"userSession": null,
"correctedElevation": false,
"images": [],
"thumbnail": "https:\/\/linkdata-ressources.geonaute.com\/sports\/121_h.jpg",
"dataSummaries": {
"5": 10000,
"6": 86927,
"9": 19227,
"23": 1406,
"24": 3954,
"99": 807
},
"trackFlag": false,
"datastreamFlag": false,
"globalChallenges": [
],
"availableDatatypes": [
5,
6,
9,
24,
23,
99
],
"equipments": [
"\/v2\/user_equipments\/{equipmentId}"
],
"tags": [],
"createdAt": "2019-07-31T09:32:15+00:00",
"updatedAt": "2019-08-01T09:55:30+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
You can add one or many equipment on a activity.
Add an another equipment to an activity
If you want to modify an activity who had already an equipment linked, you must include this equipment on your body request :
{
"equipments": [
"/v2/user_equipments/{currentEquipmentId}"
"/v2/user_equipments/{+1EquipmentId}"
]
}
Request
PUT https://api.decathlon.net/sportstrackingdata/v2/activities/{activityId}
You will need to indicated some URI ressources to modify your activity's equipment :
- equipments refers to the URI of the equipment
User measures
User measures allows you to do quantified self for your body on many datatypes (weight, Body fat, height, Heart rate min, max, ...). Each measure is dated, when you get a collection you can show the evolution of the datatype selected.
Reminder about Datatypes
For these examples we will use the datatype 181: Weight in gramms :
GET https://api.decathlon.net/sportstrackingdata/v2/datatypes/181
{
"@context": "/v2/contexts/Datatype",
"@id": "/v2/datatypes/181",
"@type": "Datatype",
"id": 181,
"unit": "g",
"translatedNames": {
"en": "Weight"
},
"translatedDescriptions": {
"en": null
},
"recordWay": 0,
"cumulable": false,
"active": true,
"createdAt": "2018-03-14T21:36:31+00:00",
"updatedAt": "2018-03-23T10:23:55+00:00"
}
Create a new user measure
Request
POST https://api.decathlon.net/sportstrackingdata/v2/user_measures
Request Body
{
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/181",
"value": 70000,
"date": "2018-04-18T19:36:41.081Z"
}
You will need to indicated some URI ressources to create a new user measure :
- datatype refers to the unit of the measure
- user refers to the URI of your user
Curl
curl -X POST \
https://api.decathlon.net/sportstrackingdata/v2/user_measures \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-d '{
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/181",
"value": 70000,
"date": "2018-04-18T19:36:41.081Z"
}'
Response
status 201 : Created
{
"@context": "/v2/contexts/UserMeasure",
"@id": "/v2/user_measures/738526",
"@type": "UserMeasure",
"id": "738526",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/181",
"value": 70000,
"date": "2018-04-18T19:36:41+00:00",
"createdAt": "2019-01-30T21:12:15+00:00",
"updatedAt": "2019-01-30T21:12:15+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Get user measures
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/user_measures?datatype=181 \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}'
Response
status 200 : Ok
{
"@context": "/v2/contexts/UserMeasure",
"@id": "/v2/user_measures",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/v2/user_measures/738525",
"@type": "UserMeasure",
"id": "738525",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/181",
"value": 90000,
"date": "2019-01-30T20:16:36+00:00",
"createdAt": "2019-01-30T20:16:36+00:00",
"updatedAt": "2019-01-30T20:16:36+00:00"
},
{
"@id": "/v2/user_measures/738526",
"@type": "UserMeasure",
"id": "738526",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/181",
"value": 70000,
"date": "2018-04-18T19:36:41+00:00",
"createdAt": "2019-01-30T21:12:15+00:00",
"updatedAt": "2019-01-30T21:12:15+00:00"
},
{
"@id": "/v2/user_measures/738528",
"@type": "UserMeasure",
"id": "738528",
"user": "/v2/users/eu23d736c047075def68",
"datatype": "/v2/datatypes/181",
"value": 69042,
"date": "2019-01-18T19:36:41+00:00",
"createdAt": "2019-01-30T21:14:18+00:00",
"updatedAt": "2019-01-30T21:14:18+00:00"
}
],
"hydra:view": {
"@id": "/v2/user_measures?datatype=181&page=1",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/v2/user_measures{?user,user[],date,date[],datatype,datatype[],order[id],order[value],order[date],order[dateTimezone],order[createdAt],order[updatedAt],date[before],date[strictly_before],date[after],date[strictly_after]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
"@type": "IriTemplateMapping",
"variable": "user",
"property": "user",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "user[]",
"property": "user",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "date",
"property": "date",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "date[]",
"property": "date",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "datatype",
"property": "datatype",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "datatype[]",
"property": "datatype",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[id]",
"property": "id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[value]",
"property": "value",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[date]",
"property": "date",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[dateTimezone]",
"property": "dateTimezone",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[createdAt]",
"property": "createdAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[updatedAt]",
"property": "updatedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "date[before]",
"property": "date",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "date[strictly_before]",
"property": "date",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "date[after]",
"property": "date",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "date[strictly_after]",
"property": "date",
"required": false
}
]
}
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Get current user measures
You can get user measures at a specific date. For exemple, if you want to get user measure at the 27 august 2020, you can do the following call, it will retrieve the closest (on the past) measures at this date saved by the user .
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/current_user_measures?date=2020-08-27 \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}'
Response
{
"@context": "/v2/contexts/User",
"@id": "/v2/users",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/v2/user_measures/764816",
"@type": "UserMeasure",
"datatype": "/v2/datatypes/3",
"value": 194,
"date": "2020-08-27T16:01:43+00:00",
"createdAt": "2020-08-27T16:01:43+00:00"
},
{
"@id": "/v2/user_measures/764818",
"@type": "UserMeasure",
"datatype": "/v2/datatypes/21",
"value": 55,
"date": "2020-08-27T16:02:35+00:00",
"createdAt": "2020-08-27T16:02:35+00:00"
},
{
"@id": "/v2/user_measures/764815",
"@type": "UserMeasure",
"datatype": "/v2/datatypes/22",
"value": 80,
"date": "2020-08-27T16:01:43+00:00",
"createdAt": "2020-08-27T16:01:43+00:00"
},
{
"@id": "/v2/user_measures/764813",
"@type": "UserMeasure",
"datatype": "/v2/datatypes/27",
"value": 165,
"date": "2020-08-27T16:01:42+00:00",
"createdAt": "2020-08-27T16:01:42+00:00"
},
{
"@id": "/v2/user_measures/764817",
"@type": "UserMeasure",
"datatype": "/v2/datatypes/28",
"value": 70,
"date": "2020-08-27T16:01:44+00:00",
"createdAt": "2020-08-27T16:01:44+00:00"
},
{
"@id": "/v2/user_measures/764814",
"@type": "UserMeasure",
"datatype": "/v2/datatypes/181",
"value": 80000,
"date": "2020-08-27T16:01:43+00:00",
"createdAt": "2020-08-27T16:01:43+00:00"
},
{
"@id": "/v2/user_measures/738995",
"@type": "UserMeasure",
"datatype": "/v2/datatypes/182",
"value": 55,
"date": "2019-04-25T07:52:07+00:00",
"createdAt": "2019-04-25T07:52:07+00:00"
},
{
"@id": "/v2/user_measures/762356",
"@type": "UserMeasure",
"datatype": "/v2/datatypes/217",
"value": 120,
"date": "2019-10-08T09:14:04+00:00",
"createdAt": "2019-10-08T09:14:04+00:00"
}
],
"hydra:view": {
"@id": "/v2/users/a13babcabc378e8d007e/current_user_measures?date=2020-08-27",
"@type": "hydra:PartialCollectionView"
}
}
User program
You can create a sport program for your user. How it's work ?
An user create a program > this program can contain X session(s). Every time the user complete one of this session, his activity is linked to an user_session.
activity > user_session > user_program
Create a user_program
3 informations are mandatory to create an user_program :
- user
- modelId : Your program model identifier
- current : A boolean to know if this program is used.
The basic needs :
Request
POST https://api.decathlon.net/sportstrackingdata/v2/user_programs
Request Body
{
"modelId": "XXX",
"user": "/v2/users/{{ldid}}",
"current": true
}
Response
status 201 : Created
{
"@context": "/v2/contexts/UserProgram",
"@id": "/v2/user_programs/XXX",
"@type": "UserProgram",
"id": "XXX",
"modelId": "XXX",
"userSessions": [],
"user": "/v2/users/XXX",
"current": true,
"endedAt": null,
"createdAt": "2020-04-17T08:02:53+00:00",
"updatedAt": "2020-04-17T08:02:53+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Create a program : go further
You can create your sessions in the same time. This method will automatically create your user program and your user sessions linked to the program.
Request
POST https://api.decathlon.net/sportstrackingdata/v2/user_programs
Request Body
{
"modelId": "XXX",
"user": "/v2/users/{{ldid}}",
"current": true,
"userSessions": [
{
"modelId": "XXX",
"user": "/v2/users/{{ldid}}",
"position": 1,
"type": "string"
},
{
"modelId": "XXX",
"user": "/v2/users/{{ldid}}",
"position": 2,
"type": "string"
}
]
}
Response
status 201 : Created
{
"@context": "/v2/contexts/UserProgram",
"@id": "/v2/user_programs/XXX",
"@type": "UserProgram",
"id": "XXX",
"modelId": "XXX",
"userSessions": [
{
"@id": "/v2/user_sessions/XXX",
"@type": "UserSession",
"modelId": "XXX",
"user": "/v2/users/XXX",
"position": 1,
"type": "string"
},
{
"@id": "/v2/user_sessions/XXX",
"@type": "UserSession",
"modelId": "XXX",
"user": "/v2/users/XXX",
"position": 2,
"type": "string"
}
],
"user": "/v2/users/XXX",
"current": true,
"endedAt": null,
"createdAt": "2020-04-17T08:13:18+00:00",
"updatedAt": "2020-04-17T08:13:18+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Get programs
To retrieve every programs launched by the user :
Request
GET https://api.decathlon.net/sportstrackingdata/v2/user_programs
Response
status 200: OK
{
"@context": "/v2/contexts/UserProgram",
"@id": "/v2/user_programs",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/v2/user_programs/XXX",
"@type": "UserProgram",
"id": "XXX",
"modelId": "XXX",
"userSessions": [
{
"@id": "/v2/user_sessions/XXX",
"@type": "UserSession",
"modelId": "XXX",
"user": "/v2/users/XXX",
"position": 1,
"type": "string"
},
{
"@id": "/v2/user_sessions/XXX",
"@type": "UserSession",
"modelId": "XXX",
"user": "/v2/users/XXX",
"position": 2,
"type": "string"
},
{
"@id": "/v2/user_sessions/XXX",
"@type": "UserSession",
"modelId": "XXX",
"user": "/v2/users/XXX",
"position": 3,
"type": "string"
}
],
"user": "/v2/users/XXX",
"current": false,
"endedAt": "2019-03-25T16:17:44+00:00",
"createdAt": "2019-03-25T16:10:40+00:00",
"updatedAt": "2019-03-25T16:17:44+00:00"
}
],
"hydra:view": {
"@id": "/v2/user_programs?page=1",
"@type": "hydra:PartialCollectionView",
"hydra:next": "/v2/user_programs?page=2"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/v2/user_programs{?user,user[],modelId,modelId[],order[id],order[modelId],order[current],order[endedAt],order[createdAt],order[updatedAt]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
"@type": "IriTemplateMapping",
"variable": "user",
"property": "user",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "user[]",
"property": "user",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "modelId",
"property": "modelId",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "modelId[]",
"property": "modelId",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[id]",
"property": "id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[modelId]",
"property": "modelId",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[current]",
"property": "current",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[endedAt]",
"property": "endedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[createdAt]",
"property": "createdAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[updatedAt]",
"property": "updatedAt",
"required": false
}
]
}
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Modify a program
To modify a program, exemple here, to declare that a program was finished by the user :
Request
PUT https://api.decathlon.net/sportstrackingdata/v2/user_programs/programID
Request Body
{
"current": false,
"endedAt": "2020-04-1710:17:44+00:00"
}
Response
status 200: OK
{
"@context": "/v2/contexts/UserProgram",
"@id": "/v2/user_programs/XXX",
"@type": "UserProgram",
"id": "XXX",
"modelId": "XXX
"userSessions": [
XXX
],
"user": "/v2/users/XXX",
"current": false,
"endedAt": "2020-04-17T10:17:44+00:00",
"createdAt": "2019-03-25T16:10:40+00:00",
"updatedAt": "2020-04-17T08:45:52+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Delete a program
Delete a program will delete the program and every user_session linked. Activities done with this program will not be deleted. The filed userSession will be set to null.
Request
DELETE https://api.decathlon.net/sportstrackingdata/v2/user_programs/programID
Response
status 204: No content
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
User statistics
The user_sumups can give you consolidated statistics on period (years and months). The user_sumups element :
- an user_id
- a sport (121 running, ...)
- a datatype (5 distance meter, ...)
- a period (2019, 201901, ...)
Parameters
The API accepts many parameters to reach quickly the data you want.
period
period[]
user,user[]
type,type[]
order[id]
order[type]
order[period]
order[value]
order[createdAt]
order[updatedAt]
period[between]
period[gt]
period[gte]
period[lt]
period[lte]
Retreive user's sumups
In this example we will look for statistics on 2018 for the running sport (121)
Request
GET https://api.decathlon.net/sportstrackingdata/v2/user_sumups
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/user_sumups?period=2018&sport=121 \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
Response
status 200 : Ok
{
"@context": "/v2/contexts/UserSumup",
"@id": "/v2/user_sumups",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/v2/user_sumups/5774260",
"@type": "UserSumup",
"id": "5774260",
"type": "YearlySumup",
"user": "/v2/users/eu23d736c047075def68",
"sport": "/v2/sports/121",
"datatype": "/v2/datatypes/5",
"period": "2018",
"value": 7651,
"createdAt": "2019-01-30T20:19:54+00:00",
"updatedAt": "2019-01-30T20:19:54+00:00"
},
{
"@id": "/v2/user_sumups/5774261",
"@type": "UserSumup",
"id": "5774261",
"type": "YearlySumup",
"user": "/v2/users/eu23d736c047075def68",
"sport": "/v2/sports/121",
"datatype": "/v2/datatypes/18",
"period": "2018",
"value": 40,
"createdAt": "2019-01-30T20:19:54+00:00",
"updatedAt": "2019-01-30T20:19:54+00:00"
},
{
"@id": "/v2/user_sumups/5774262",
"@type": "UserSumup",
"id": "5774262",
"type": "YearlySumup",
"user": "/v2/users/eu23d736c047075def68",
"sport": "/v2/sports/121",
"datatype": "/v2/datatypes/19",
"period": "2018",
"value": 39,
"createdAt": "2019-01-30T20:19:54+00:00",
"updatedAt": "2019-01-30T20:19:54+00:00"
},
{
"@id": "/v2/user_sumups/5774263",
"@type": "UserSumup",
"id": "5774263",
"type": "YearlySumup",
"user": "/v2/users/eu23d736c047075def68",
"sport": "/v2/sports/121",
"datatype": "/v2/datatypes/23",
"period": "2018",
"value": 538,
"createdAt": "2019-01-30T20:19:54+00:00",
"updatedAt": "2019-01-30T20:19:54+00:00"
},
{
"@id": "/v2/user_sumups/5774264",
"@type": "UserSumup",
"id": "5774264",
"type": "YearlySumup",
"user": "/v2/users/eu23d736c047075def68",
"sport": "/v2/sports/121",
"datatype": "/v2/datatypes/24",
"period": "2018",
"value": 2561,
"createdAt": "2019-01-30T20:19:54+00:00",
"updatedAt": "2019-01-30T20:19:54+00:00"
},
{
"@id": "/v2/user_sumups/5774265",
"@type": "UserSumup",
"id": "5774265",
"type": "YearlySumup",
"user": "/v2/users/eu23d736c047075def68",
"sport": "/v2/sports/121",
"datatype": "/v2/datatypes/97",
"period": "2018",
"value": 353,
"createdAt": "2019-01-30T20:19:54+00:00",
"updatedAt": "2019-01-30T20:19:54+00:00"
},
{
"@id": "/v2/user_sumups/5774266",
"@type": "UserSumup",
"id": "5774266",
"type": "YearlySumup",
"user": "/v2/users/eu23d736c047075def68",
"sport": "/v2/sports/121",
"datatype": "/v2/datatypes/99",
"period": "2018",
"value": 353,
"createdAt": "2019-01-30T20:19:54+00:00",
"updatedAt": "2019-01-30T20:19:54+00:00"
},
{
"@id": "/v2/user_sumups/5774267",
"@type": "UserSumup",
"id": "5774267",
"type": "YearlySumup",
"user": "/v2/users/eu23d736c047075def68",
"sport": "/v2/sports/121",
"datatype": "/v2/datatypes/98",
"period": "2018",
"value": 1,
"createdAt": "2019-01-30T20:19:54+00:00",
"updatedAt": "2019-01-30T20:19:54+00:00"
}
],
"hydra:view": {
"@id": "/v2/user_sumups?period=2018&sport=121&page=1",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/v2/user_sumups{?period,period[],user,user[],type,type[],order[id],order[type],order[period],order[value],order[createdAt],order[updatedAt],period[between],period[gt],period[gte],period[lt],period[lte]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
"@type": "IriTemplateMapping",
"variable": "period",
"property": "period",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "period[]",
"property": "period",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "user",
"property": "user",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "user[]",
"property": "user",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "type",
"property": "type",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "type[]",
"property": "type",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[id]",
"property": "id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[type]",
"property": "type",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[period]",
"property": "period",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[value]",
"property": "value",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[createdAt]",
"property": "createdAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[updatedAt]",
"property": "updatedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "period[between]",
"property": "period",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "period[gt]",
"property": "period",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "period[gte]",
"property": "period",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "period[lt]",
"property": "period",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "period[lte]",
"property": "period",
"required": false
}
]
}
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Explaining a sumup element
{
"@id": "/v2/user_sumups/5774260",
"@type": "UserSumup",
"id": "5774260",
"type": "YearlySumup", //type year
"user": "/v2/users/eu23d736c047075def68",
"sport": "/v2/sports/121", //sport running 121
"datatype": "/v2/datatypes/5", // Distance in meter
"period": "2018",
"value": 7651, // value realised so 7,6Km of running in 2018
"createdAt": "2019-01-30T20:19:54+00:00",
"updatedAt": "2019-01-30T20:19:54+00:00"
}
User Agreement
An easy solution to store the user agreement to use your service.
WARNING : once you have User Agreements on an account, if they are all rejected, the user account is deleted. If there is no anymore agreement accepted, we don't have the right to store the user data.
Create an user agreement
You store the acceptance of your user on your service and the filename of your legal contract.
Each user agreement has a state ( accepted | pending | rejected ).
Request
POST https://api.decathlon.net/sportstrackingdata/v2/user_agreements
Curl
curl -X POST \
https://api.decathlon.net/sportstrackingdata/v2/user_agreements \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-d '{
"user": "/v2/users/#USER_ID#",
"serviceKey": "DecathlonCoach",
"state": "accepted",
"filename": "legal-document-CGS-v1.1-20180808"
}'
Response
status 201 : Created
{
"@context": "/v2/contexts/UserAgreement",
"@id": "/v2/user_agreements/1",
"@type": "UserAgreement",
"id": 1,
"user": "/v2/users/820d0XXXXXa7013969",
"serviceKey": "DecathlonCoach",
"state": "accepted",
"dateAccept": "2018-08-10T13:28:10+00:00",
"dateRepudiation": null,
"filename": "legal-document-CGS-v1.1-20180808",
"createdAt": "2018-08-10T13:28:10+00:00",
"updatedAt": "2018-08-10T13:28:10+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Get the collection of User Agreement or a single ressource
You can list all the user agreements and access to specific one.
Request
GET https://api.decathlon.net/sportstrackingdata/v2/user_agreements
GET https://api.decathlon.net/sportstrackingdata/v2/user_agreements/#RESSOURCEID#
Curl
curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/user_agreements \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}'
Response
status 200 : Ok
{
"@context": "/v2/contexts/UserAgreement",
"@id": "/v2/user_agreements",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/v2/user_agreements/1",
"@type": "UserAgreement",
"id": 1,
"user": "/v2/users/820d0XXXXXa7013969",
"serviceKey": "DecathlonCoach",
"state": "accepted",
"dateAccept": "2018-08-10T13:28:10+00:00",
"dateRepudiation": null,
"filename": "legal-document-CGS-v1.1-20180808",
"createdAt": "2018-08-10T13:28:10+00:00",
"updatedAt": "2018-08-10T13:28:10+00:00"
}
]
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Modify an user agreement
You can modify the state of an user agreement. For example if an user wants to revoke its acceptance to the service.
Request
PUT https://api.decathlon.net/sportstrackingdata/v2/user_agreements/#RESSOURCEID#
Curl
curl -X PUT \
https://api.decathlon.net/sportstrackingdata/v2/user_agreements/#RESSOURCEID# \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-d '{
"state": "rejected"
}'
Response
status 200 : OK
{
"@context": "/v2/contexts/UserAgreement",
"@id": "/v2/user_agreements/1",
"@type": "UserAgreement",
"id": 1,
"user": "/v2/users/820d0XXXXXa7013969",
"serviceKey": "DecathlonCoach",
"state": "rejected",
"dateAccept": "2018-08-10T13:28:10+00:00",
"dateRepudiation": null,
"filename": "legal-document-CGS-v1.1-20180808",
"createdAt": "2018-08-10T13:28:10+00:00",
"updatedAt": "2018-08-10T13:28:10+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Other RGPD rights
The API permits to export all your data and receive a link to access to your archive.
The API permits to delete your account, a delay of 24 hours may be applicable.
Webhook
We support a webhook system on the event of an activity create ("activity_create"). For a user, if you create a webhook to an URL that you manage, you will receive POST request with the user id and activity id every time an activity is added for this user.
Create a webhook
Request
POST https://api.decathlon.net/sportstrackingdata/v2/user_web_hooks
Curl
curl -X POST \
https://api.decathlon.net/sportstrackingdata/v2/user_web_hooks \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {your api key}' \
-d '{
"user": "/v2/users/#USER_ID#",
"url": "https://XXXXXXX.com/webhook_callback",
"events": [
"activity_create"
]
}'
Response
status 201 : Created
{
"@context": "/v2/contexts/UserWebHook",
"@id": "/v2/user_web_hooks/euXf9507eXXXXX997707",
"@type": "UserWebHook",
"id": "euXf9507eXXXXX997707",
"user": "/v2/users/#USER_ID#",
"url": "https://XXXXXXX.com/webhook_callback",
"events": [
"activity_create"
],
"createdAt": "2019-03-18T21:23:50+00:00",
"updatedAt": "2019-03-18T21:23:50+00:00"
}
status 4xx : Client errors, check response for details.
status 5xx : Server errors, check response for details.
Format of the POST message
{
"user_id":"user_id",
"event":{
"name":"activity_create",
"ressource_id":"activity_id",
"event_time":1552944296
}
}
The equivalent request made by Sports Tracking Data to your webhook url with HTTP Code 200 .
Curl
curl -X POST \
https://XXXXXXX.com/webhook_callback \
-d '{"user_id":"user_id","event":{"name":"activity_create","ressource_id":"activity_id","event_time":1552944296}}'
Automatic purge
To manage users who deleted their accounts on client side, a mecanism of purge is set : If client server side response is different than 2xx since more than 5 days, with minimum 3 consecutive times, the webhook will be deleted.
Glossary
- Activity : represent a sport activity, 3 data are mandatory : a sport, a date, a duration
- Connected device : the device which capture a sport activity (like Decathlon Coach App iOs, or On Move 500
- Connector : the app which uploads an activity
- Datastream : all values for an activity to display in function of the elasped time
- DataSummaries : all values consolidated for an activity
- Datatype : our abstraction of the different type of unit : distance (m) , duration (s), weight (g) , ...
- Locations : the stream of the GPS track
- Manual Activity : an activity generated by a form or an import for a file GPX or TCX
- Measure : A body measure stored for an user, the measure is defined by a Datatype, a value and a date
- Sport id : our abstraction of the list of the sports (ex : 121 for the running, 113 for walking...)
- Sumup : any data consolidated to a datatype, a sport and a period (month or year)
Roadmap
V1 retro-compatibility
The v1 (xml) is supported until Q1 2021. The v1 doesn't receive the new features.
V2 new features
- Change the Oauth server : DECATHLON Login 2020-Q1
- Gzip import activity POST 2020-Q1
- VMA logging 2020-Q3
- Sub activities for Triathlon and others 2020-Q3
- User favorites 2020-Q3
- Record prediction 2020-Q4
- Rework on program scheduling persistance 2020-Q4
Support
contacts
- Mailing list API users : sports-tracking-data-api-news@googlegroups.com
- Support contact : infra@decathloncoach.com
Pre-requisites to support
Contact us with a curl showing :
- the request
- result
- transaction identifiers
And/Or :
- a timestamp
- an IP
Terms of service
Discussion
If you have any questions, feedbacks, feel free to share it on our Google groups : https://groups.google.com/forum/#!forum/sports-tracking-data-api-news
Language prefered : English.
API Changelogs
Version 2.18.5 (2020-11-09)
enable JWT validation on /v2/coaching_rankings