 |
|
|
 |
| |
API Index
Current-Season Workout - Get One
returns a Current-Season Workout. This information is here for compleness, it is preferable to use the link relation 'self' contained in the workout object returned by Current-Season Workouts - get all workouts.
uri:http://c2logapi.appspot.com/api/1/currentseason/workout/{id}
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": 25,
"comments": "",
"month": 10,
"hours": 0,
"weightClass": "H",
"link": {"href": "http://c2logapi.appspot.com/api/1/currentseason/workout/1087", "rel": "self"},
"typeOfWorkout": "indoor rower",
"year": 2009,
"minutes": 8,
"id": 1087,
"tenths": 4
}
Python using httplib2
import httplib2
import simplejson
import base64
url = "http://c2logapi.appspot.com/api/1/currentseason/workout/10873395"
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", "status:%s != 200"%resp["status"]
workout = simplejson.loads(content)
print workout["distance"]
|
|
|
| |
|