Metrics
API Version 2 (V2)
Goals
You can retrieve user goals by user_id
Get a goals data by user_id
GET
Request
Query Parameters
user_id
required
String
User ID returned by add integration request. This key should be stored in your database against the user and used for all interactions with the Spike API.
Header Parameters
authorizationtoken
optional
String
Client access token (deprecated)
x-spike-auth
required
String
Client access token
Python
Node.js
Ruby
Java
Curl
1curl -X GET \
2 'https://api.spikeapi.com/v2/metrics/goals/?user_id=fa1e3803-6068-4ea7-9788-eccce210daa1&start_date=2020-05-01&end_date=2020-05-03' \
3 -H 'x-spike-auth: fa0b3803-1111-2222-9788-eccce210d30c'
Responses
200
1{
2 "user_id": "fa1e3803-6068-4ea7-9788-eccce210daa1",
3 "type": "goals",
4 "source": [
5 {
6 "name": "fitbit",
7 "status": "ok"
8 }
9 ],
10 "data": [
11 {
12 "daily":{
13 "active_minutes": 30,
14 "calories": 1950,
15 "distance": 8.05,
16 "floors": 10,
17 "steps": 7500,
18 "sleep": 480
19 },
20 "weekly": {
21 "active_minutes": 130,
22 "calories": 11950,
23 "distance": 18.05,
24 "floors": 110,
25 "steps": 17500
26 },
27 "monthly": {
28 "active_minutes": 230,
29 "calories": 21950,
30 "distance": 28.05,
31 "floors": 210,
32 "steps": 27500
33 },
34 "source": "fitbit"
35 }
36 ]
37}
1<style>
2@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap');
3
4.h2, .h3, .list, .description{
5 font-family: 'Poppins', sans-serif;
6 font-weight: 500;
7}
8
9.h2 {
10 margin-top: -20px;
11 margin-bottom: 20px;
12
13 font-size: 30px;
14}
15
16.h3 {
17 font-size: 22px;
18 margin-top: -20px;
19}
20
21.list-wrapper {
22 white-space: normal;
23 margin-top: -10px;
24}
25
26.list, .description {
27 font-size: 14px;
28}
29
30</style>
31<h2 class="h2">Fields</h2>
32<h3 class="h3">Goals.daily.active_minutes</h3>
33<ul class="list-wrapper">
34 <li class="list">Type: Int</li>
35 <li class="list">Example: 60</li>
36</ul>
37<p class="description">The active minutes goal.</p>
38
39<h3 class="h3">Goals.daily.calories</h3>
40<ul class="list-wrapper">
41 <li class="list">Type: Int</li>
42 <li class="list">Example: 2000</li>
43</ul>
44<p class="description">The calories goal.</p>
45
46<h3 class="h3">Goals.daily.distance</h3>
47<ul class="list-wrapper">
48 <li class="list">Type: Float</li>
49 <li class="list">Example: 5.2</li>
50</ul>
51<p class="description">The distance goal.</p>
52
53<h3 class="h3">Goals.daily.floors</h3>
54<ul class="list-wrapper">
55 <li class="list">Type: Int</li>
56 <li class="list">Example: 11</li>
57</ul>
58<p class="description">The floors goal.</p>
59
60<h3 class="h3">Goals.daily.steps</h3>
61<ul class="list-wrapper">
62 <li class="list">Type: Int</li>
63 <li class="list">Example:11000</li>
64</ul>
65<p class="description">The steps goal.</p>
66
67<h3 class="h3">Goals.daily.sleep</h3>
68<ul class="list-wrapper">
69 <li class="list">Type: Int</li>
70 <li class="list">Example:480</li>
71</ul>
72<p class="description">The sleep goal.</p>