 |
|
|
 |
| |
API Index
Historical Monthly Summaries - Add New Summary
add a new summary. returns a json representation of the new summary
uri:http://c2logapi.appspot.com/api/1/historical/monthlysummaries
method:POST
status codes:
201: created
400: bad request - probably in the input parameters
401: invalid Concept 2 Online logbook user name or password
403: invalid or missing C2 Logbook REST API key
405: method not allowed
503: throttled
Examples:
sample contents of the response body to a successful request
{"distance": 25055, "seconds": 23, "workout_type": "standard", "month": 4, "hours": 1, "link": {"href": "http://powertwenty.com/c2logapi/1/historical/monthlysummary/1001159", "rel": "self"}, "year": 1995, "minutes": 56, "id": 1001159}
Python using httplib2
import httplib2
import urllib
import simplejson
import base64
h = httplib2.Http()
newSummary = {"distance": 25055, "seconds": 23, "workout_type": "standard", "month": 4, "hours": 1, "year": 1995, "minutes": 56 }
authorizationHeader = "Basic %s"%base64.b64encode("%s:%s"%("user", "password"))
response, content = h.request("http://powertwenty.com/c2logapi/1/historical/monthlysummaries", "POST", urllib.urlencode(newSummary), headers={"Authorization":authorizationHeader, "X-API-KEY":"xxxxxxxxxxxxxxx" } )
assert response["status"]=="201"
print content
|
|
|
| |
|