BeepBeep Data Service v0.1.9
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Returns info about BeepBeep registered users and their runs
Base URLs:
License: APLv2
Default
addRuns
Code samples
# You can also use wget
curl -X POST 0.0.0.0:5002/add_runs \
-H 'Content-Type: application/json'
POST 0.0.0.0:5002/add_runs HTTP/1.1
Host: 5002
Content-Type: application/json
var headers = {
'Content-Type':'application/json'
};
$.ajax({
url: '0.0.0.0:5002/add_runs',
method: 'post',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"property1": [
{
"title": "string",
"description": "string",
"strava_id": 0,
"distance": 0,
"start_date": 0,
"elapsed_time": 0,
"average_speed": 0,
"total_elevation_gain": 0,
"runner_id": 0
}
],
"property2": [
{
"title": "string",
"description": "string",
"strava_id": 0,
"distance": 0,
"start_date": 0,
"elapsed_time": 0,
"average_speed": 0,
"total_elevation_gain": 0,
"runner_id": 0
}
]
}';
const headers = {
'Content-Type':'application/json'
};
fetch('0.0.0.0:5002/add_runs',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json'
}
result = RestClient.post '0.0.0.0:5002/add_runs',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json'
}
r = requests.post('0.0.0.0:5002/add_runs', params={
}, headers = headers)
print r.json()
URL obj = new URL("0.0.0.0:5002/add_runs");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "0.0.0.0:5002/add_runs", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /add_runs
Adds a bunch of runs to different users
Body parameter
{
"property1": [
{
"title": "string",
"description": "string",
"strava_id": 0,
"distance": 0,
"start_date": 0,
"elapsed_time": 0,
"average_speed": 0,
"total_elevation_gain": 0,
"runner_id": 0
}
],
"property2": [
{
"title": "string",
"description": "string",
"strava_id": 0,
"distance": 0,
"start_date": 0,
"elapsed_time": 0,
"average_speed": 0,
"total_elevation_gain": 0,
"runner_id": 0
}
]
}
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | object | true | An object of array of objects that describe all the runs of some users |
| » additionalProperties | body | [Run] | false | none |
| »» title | body | string | true | A title for the run |
| »» description | body | string | true | A more detailed description for the run |
| »» strava_id | body | integer | true | The id of the run when fetched from Strava |
| »» distance | body | number(float) | true | The distance the user run expressed in meters |
| »» start_date | body | integer(timestamp) | true | The timestamp when this run was made |
| »» elapsed_time | body | integer | true | The total time that this run took to complete |
| »» average_speed | body | number(float) | true | The average speed of the run |
| »» total_elevation_gain | body | number(float) | true | The total elevation gained during the run |
| »» runner_id | body | integer | false | The id of the user who made this run |
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 204 | No Content | The runs were added succesfully | None |
getUsers
Code samples
# You can also use wget
curl -X GET 0.0.0.0:5002/users \
-H 'Accept: application/json'
GET 0.0.0.0:5002/users HTTP/1.1
Host: 5002
Accept: application/json
var headers = {
'Accept':'application/json'
};
$.ajax({
url: '0.0.0.0:5002/users',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('0.0.0.0:5002/users',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get '0.0.0.0:5002/users',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('0.0.0.0:5002/users', params={
}, headers = headers)
print r.json()
URL obj = new URL("0.0.0.0:5002/users");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "0.0.0.0:5002/users", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /users
Returns the list of all the users
Example responses
200 Response
{
"users": [
{
"id": 0,
"email": "user@example.com",
"firstname": "string",
"lastname": "string",
"strava_token": "string",
"age": 0,
"weight": 0,
"max_hr": 0,
"rest_hr": 0,
"vo2max": 0
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | A, possibly empty, list of users | Inline |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » users | [allOf] | true | none | none |
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »» anonymous | object | false | none | none |
| »»» id | integer | true | none | the ID of the user |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »» anonymous | UserTemplate | false | none | none |
| string(email) | true | none | The email of the user | |
| »»» firstname | string | true | none | The firstname of the user |
| »»» lastname | string | true | none | The lastname of the user |
| »»» strava_token | string\ | null | false | none |
| »»» age | integer | true | none | The age of the user |
| »»» weight | number(float) | true | none | The weight of the user |
| »»» max_hr | integer | true | none | The max heartrate of the user |
| »»» rest_hr | integer | true | none | The at rest heartrate of the user |
| »»» vo2max | number(float) | true | none | I have no clue what this is |
addUser
Code samples
# You can also use wget
curl -X POST 0.0.0.0:5002/users \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
POST 0.0.0.0:5002/users HTTP/1.1
Host: 5002
Content-Type: application/json
Accept: application/json
var headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
$.ajax({
url: '0.0.0.0:5002/users',
method: 'post',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"id": 0,
"email": "user@example.com",
"firstname": "string",
"lastname": "string",
"strava_token": "string",
"age": 0,
"weight": 0,
"max_hr": 0,
"rest_hr": 0,
"vo2max": 0
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('0.0.0.0:5002/users',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post '0.0.0.0:5002/users',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('0.0.0.0:5002/users', params={
}, headers = headers)
print r.json()
URL obj = new URL("0.0.0.0:5002/users");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "0.0.0.0:5002/users", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /users
Register a new User inside the Data Service
Body parameter
{
"id": 0,
"email": "user@example.com",
"firstname": "string",
"lastname": "string",
"strava_token": "string",
"age": 0,
"weight": 0,
"max_hr": 0,
"rest_hr": 0,
"vo2max": 0
}
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | User | true | The description of the new User to add into the DataService |
Example responses
400 Response
{
"response-code": 0,
"message": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 204 | No Content | The user was added succesfully | None |
| 400 | Bad Request | Something went wrong trying to parse the request | Error |
getSingleUser
Code samples
# You can also use wget
curl -X GET 0.0.0.0:5002/users/{user_id} \
-H 'Accept: application/json'
GET 0.0.0.0:5002/users/{user_id} HTTP/1.1
Host: 5002
Accept: application/json
var headers = {
'Accept':'application/json'
};
$.ajax({
url: '0.0.0.0:5002/users/{user_id}',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('0.0.0.0:5002/users/{user_id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get '0.0.0.0:5002/users/{user_id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('0.0.0.0:5002/users/{user_id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("0.0.0.0:5002/users/{user_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "0.0.0.0:5002/users/{user_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /users/{user_id}
Returns a specific User
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| user_id | path | integer | true | The id of the user |
Example responses
200 Response
{
"id": 0,
"email": "user@example.com",
"firstname": "string",
"lastname": "string",
"strava_token": "string",
"age": 0,
"weight": 0,
"max_hr": 0,
"rest_hr": 0,
"vo2max": 0
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Information about an User | ExistingUser |
| 404 | Not Found | The specified resource was not found | Error |
updateSingleUser
Code samples
# You can also use wget
curl -X PUT 0.0.0.0:5002/users/{user_id} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
PUT 0.0.0.0:5002/users/{user_id} HTTP/1.1
Host: 5002
Content-Type: application/json
Accept: application/json
var headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
$.ajax({
url: '0.0.0.0:5002/users/{user_id}',
method: 'put',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"id": 0,
"email": "user@example.com",
"firstname": "string",
"lastname": "string",
"strava_token": "string",
"age": 0,
"weight": 0,
"max_hr": 0,
"rest_hr": 0,
"vo2max": 0
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('0.0.0.0:5002/users/{user_id}',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.put '0.0.0.0:5002/users/{user_id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.put('0.0.0.0:5002/users/{user_id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("0.0.0.0:5002/users/{user_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "0.0.0.0:5002/users/{user_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /users/{user_id}
Update the information of a single User
Body parameter
{
"id": 0,
"email": "user@example.com",
"firstname": "string",
"lastname": "string",
"strava_token": "string",
"age": 0,
"weight": 0,
"max_hr": 0,
"rest_hr": 0,
"vo2max": 0
}
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | UpdateUser | true | The description of the update information of the User |
| » id | body | integer | true | The id of the user |
| body | string(email) | false | The email of the user | |
| » firstname | body | string | false | The firstname of the user |
| » lastname | body | string | false | The lastname of the user |
| » strava_token | body | string\ | null | false |
| » age | body | integer | false | The age of the user |
| » weight | body | number(float) | false | The weight of the user |
| » max_hr | body | integer | false | The max heartrate of the user |
| » rest_hr | body | integer | false | The at rest heartrate of the user |
| » vo2max | body | number(float) | false | I have no clue what this is |
| user_id | path | integer | true | The id of the user |
Example responses
400 Response
{
"response-code": 0,
"message": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 204 | No Content | User succesfully updated | None |
| 400 | Bad Request | Something went wrong trying to parse the request | Error |
| 404 | Not Found | The specified resource was not found | Error |
deleteSingleUser
Code samples
# You can also use wget
curl -X DELETE 0.0.0.0:5002/users/{user_id} \
-H 'Accept: application/json'
DELETE 0.0.0.0:5002/users/{user_id} HTTP/1.1
Host: 5002
Accept: application/json
var headers = {
'Accept':'application/json'
};
$.ajax({
url: '0.0.0.0:5002/users/{user_id}',
method: 'delete',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('0.0.0.0:5002/users/{user_id}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.delete '0.0.0.0:5002/users/{user_id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.delete('0.0.0.0:5002/users/{user_id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("0.0.0.0:5002/users/{user_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "0.0.0.0:5002/users/{user_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /users/{user_id}
Remove an User from the service
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| user_id | path | integer | true | The id of the user |
Example responses
404 Response
{
"response-code": 0,
"message": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 204 | No Content | User succesfully removed | None |
| 404 | Not Found | The specified resource was not found | Error |
getAverage
Code samples
# You can also use wget
curl -X GET 0.0.0.0:5002/users/{user_id}/average \
-H 'Accept: application/json'
GET 0.0.0.0:5002/users/{user_id}/average HTTP/1.1
Host: 5002
Accept: application/json
var headers = {
'Accept':'application/json'
};
$.ajax({
url: '0.0.0.0:5002/users/{user_id}/average',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('0.0.0.0:5002/users/{user_id}/average',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get '0.0.0.0:5002/users/{user_id}/average',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('0.0.0.0:5002/users/{user_id}/average', params={
}, headers = headers)
print r.json()
URL obj = new URL("0.0.0.0:5002/users/{user_id}/average");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "0.0.0.0:5002/users/{user_id}/average", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /users/{user_id}/average
Get the average speed for all the runs of the user
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| user_id | path | integer | true | The ID of the user |
Example responses
200 Response
{
"average_speed": 0
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | The average speed of the user | Inline |
| 404 | Not Found | The specified resource was not found | Error |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » average_speed | number(float) | false | none | a float with 2 decimals which indicates the average speed of the user in m/s |
getRuns
Code samples
# You can also use wget
curl -X GET 0.0.0.0:5002/users/{user_id}/runs \
-H 'Accept: application/json'
GET 0.0.0.0:5002/users/{user_id}/runs HTTP/1.1
Host: 5002
Accept: application/json
var headers = {
'Accept':'application/json'
};
$.ajax({
url: '0.0.0.0:5002/users/{user_id}/runs',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('0.0.0.0:5002/users/{user_id}/runs',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get '0.0.0.0:5002/users/{user_id}/runs',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('0.0.0.0:5002/users/{user_id}/runs', params={
}, headers = headers)
print r.json()
URL obj = new URL("0.0.0.0:5002/users/{user_id}/runs");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "0.0.0.0:5002/users/{user_id}/runs", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /users/{user_id}/runs
Get all the run of an user with respect to some criteria
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| user_id | path | integer | true | The ID of the User |
| start-date | query | string(date-time) | false | Datetime in %Y-%m-%dT%H:%M:%SZ format. If this parameter is set all the runs returned will have a start_date not less than date-start |
| finish-date | query | string(date-time) | false | Datetime in %Y-%m-%dT%H:%M:%SZ format. If this parameter is set all the runs returned will have a start_date not greater than date-finish |
| from-id | query | integer | false | If this parameter is set all the runs returned will have an id greater than from-id |
| page-size | query | integer | false | How many entries are present in a page. If this parameter is set the request will return at most page-size items |
| skip-number | query | integer | false | How many entries skip. If this parameter is set the request will skip the first skip-number elements and returns only entries after them |
Example responses
200 Response
[
{
"id": 0,
"title": "string",
"description": "string",
"strava_id": 0,
"distance": 0,
"start_date": 0,
"elapsed_time": 0,
"average_speed": 0,
"total_elevation_gain": 0,
"runner_id": 0
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | A, possibly empty, list of runs | Inline |
| 400 | Bad Request | Something went wrong trying to parse the request | Error |
| 404 | Not Found | The specified resource was not found | Error |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [allOf] | false | none | none |
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | object | false | none | none |
| »» id | integer | false | none | The ID of the Run |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | Run | false | none | none |
| »» title | string | true | none | A title for the run |
| »» description | string | true | none | A more detailed description for the run |
| »» strava_id | integer | true | none | The id of the run when fetched from Strava |
| »» distance | number(float) | true | none | The distance the user run expressed in meters |
| »» start_date | integer(timestamp) | true | none | The timestamp when this run was made |
| »» elapsed_time | integer | true | none | The total time that this run took to complete |
| »» average_speed | number(float) | true | none | The average speed of the run |
| »» total_elevation_gain | number(float) | true | none | The total elevation gained during the run |
| »» runner_id | integer | false | none | The id of the user who made this run |
getSingleRun
Code samples
# You can also use wget
curl -X GET 0.0.0.0:5002/users/{user_id}/runs/{run_id} \
-H 'Accept: application/json'
GET 0.0.0.0:5002/users/{user_id}/runs/{run_id} HTTP/1.1
Host: 5002
Accept: application/json
var headers = {
'Accept':'application/json'
};
$.ajax({
url: '0.0.0.0:5002/users/{user_id}/runs/{run_id}',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('0.0.0.0:5002/users/{user_id}/runs/{run_id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get '0.0.0.0:5002/users/{user_id}/runs/{run_id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('0.0.0.0:5002/users/{user_id}/runs/{run_id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("0.0.0.0:5002/users/{user_id}/runs/{run_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "0.0.0.0:5002/users/{user_id}/runs/{run_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /users/{user_id}/runs/{run_id}
Get The run run_id of the user user_id
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| user_id | path | integer | true | ID of the user |
| run_id | path | integer | true | ID of the Run |
Example responses
200 Response
{
"id": 0,
"title": "string",
"description": "string",
"strava_id": 0,
"distance": 0,
"start_date": 0,
"elapsed_time": 0,
"average_speed": 0,
"total_elevation_gain": 0,
"runner_id": 0
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | The run of the user | ResponseRun |
| 404 | Not Found | The specified resource was not found | Error |
Schemas
Run
{
"title": "string",
"description": "string",
"strava_id": 0,
"distance": 0,
"start_date": 0,
"elapsed_time": 0,
"average_speed": 0,
"total_elevation_gain": 0,
"runner_id": 0
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| title | string | true | none | A title for the run |
| description | string | true | none | A more detailed description for the run |
| strava_id | integer | true | none | The id of the run when fetched from Strava |
| distance | number(float) | true | none | The distance the user run expressed in meters |
| start_date | integer(timestamp) | true | none | The timestamp when this run was made |
| elapsed_time | integer | true | none | The total time that this run took to complete |
| average_speed | number(float) | true | none | The average speed of the run |
| total_elevation_gain | number(float) | true | none | The total elevation gained during the run |
| runner_id | integer | false | none | The id of the user who made this run |
ResponseRun
{
"id": 0,
"title": "string",
"description": "string",
"strava_id": 0,
"distance": 0,
"start_date": 0,
"elapsed_time": 0,
"average_speed": 0,
"total_elevation_gain": 0,
"runner_id": 0
}
Properties
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | object | false | none | none |
| » id | integer | false | none | The ID of the Run |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | Run | false | none | none |
UserTemplate
{
"email": "user@example.com",
"firstname": "string",
"lastname": "string",
"strava_token": "string",
"age": 0,
"weight": 0,
"max_hr": 0,
"rest_hr": 0,
"vo2max": 0
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| string(email) | true | none | The email of the user | |
| firstname | string | true | none | The firstname of the user |
| lastname | string | true | none | The lastname of the user |
| strava_token | string\ | null | false | none |
| age | integer | true | none | The age of the user |
| weight | number(float) | true | none | The weight of the user |
| max_hr | integer | true | none | The max heartrate of the user |
| rest_hr | integer | true | none | The at rest heartrate of the user |
| vo2max | number(float) | true | none | I have no clue what this is |
ExistingUser
{
"id": 0,
"email": "user@example.com",
"firstname": "string",
"lastname": "string",
"strava_token": "string",
"age": 0,
"weight": 0,
"max_hr": 0,
"rest_hr": 0,
"vo2max": 0
}
Properties
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | object | false | none | none |
| » id | integer | true | none | the ID of the user |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | UserTemplate | false | none | none |
User
{
"id": 0,
"email": "user@example.com",
"firstname": "string",
"lastname": "string",
"strava_token": "string",
"age": 0,
"weight": 0,
"max_hr": 0,
"rest_hr": 0,
"vo2max": 0
}
Properties
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | object | false | none | none |
| » id | integer | false | none | the ID of the user |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | UserTemplate | false | none | none |
UpdateUser
{
"id": 0,
"email": "user@example.com",
"firstname": "string",
"lastname": "string",
"strava_token": "string",
"age": 0,
"weight": 0,
"max_hr": 0,
"rest_hr": 0,
"vo2max": 0
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | integer | true | none | The id of the user |
| string(email) | false | none | The email of the user | |
| firstname | string | false | none | The firstname of the user |
| lastname | string | false | none | The lastname of the user |
| strava_token | string\ | null | false | none |
| age | integer | false | none | The age of the user |
| weight | number(float) | false | none | The weight of the user |
| max_hr | integer | false | none | The max heartrate of the user |
| rest_hr | integer | false | none | The at rest heartrate of the user |
| vo2max | number(float) | false | none | I have no clue what this is |
Error
{
"response-code": 0,
"message": "string"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| response-code | integer | true | none | The code of the HTTP response error |
| message | string | true | none | Additional description about the error |