 |
|
|
 |
| |
API Index
Current-Season Workouts - Get All Workouts
returns list of Current-Season Workouts
uri:http://c2logapi.appspot.com/api/1/currentseason/workouts
method:GET
status codes:
200: ok
401: invalid Concept 2 Online logbook user name or password
403: invalid or missing C2 Logbook REST API key
503: throttled
Examples:
sample contents of the response body to a successful request as JSON data
[
{
"distance": 2000,
"seconds": 5,
"age": 41,
"day": 10,
"comments": "personal best!",
"month": 10,
"hours": 0,
"weightClass": "H",
"link": {"href": "http://powertwenty.com/c2logapi/1/currentseason/workout/1099", "rel": "self"},
"typeOfWorkout": "standard",
"year": 2009,
"minutes": 8,
"id": 1099,
"tenths": 4
},
{
"distance": 5000,
"seconds": 10,
"age": 41,
"day": 24,
"comments": "first row",
"month": 9,
"hours": 0,
"weightClass": "H",
"link": {"href": "http://powertwenty.com/c2logapi/1/currentseason/workout/1095", "rel": "self"},
"typeOfWorkout": "standard",
"year": 2009,
"minutes": 20,
"id": 1095,
"tenths": 9
}
]
Python using httplib2
import httplib2
import simplejson
import base64
url = "http://powertwenty.com/c2logapi/1/currentseason/workouts"
h = httplib2.Http()
authorizationHeader = "Basic %s"%base64.b64encode("%s:%s"%("user", "password"))
resp, content = h.request( url, "GET", headers={"Authorization":authorizationHeader, "X-API-KEY":"xxxxxxxxxxxxxxx" } )
assert resp["status"]=="200"
workouts = simplejson.loads(content)
for workout in workouts:
print workout["distance"]
|
|
|
| |
|