API Documentation
Introduction
The dailymile API enables third-party developers to build applications on dailymile's social workout platform. You're free to build for the Web, the desktop, or on mobile devices. The API does its best to adhere to the principles of REST and should hopefully feel familiar if you've interacted with APIs of other consumer Web apps before. Manipulating resources is done over HTTP. We do our best to follow standards and best practices.
Authorization
Authorization is required to modify data (generally whenever using POST, PUT, or DELETE). Some resources are protected and will require authorization to manipulate, such as a user's private data. Protected resources exposed by this API can be accessed using OAuth, a simple and open protocol.
OAuth
Third-party applications built on dailymile must use OAuth to authenticate. There are libraries already built for most languages, which you can find here. This API supports OAuth 1.0a and HMAC-SHA1 for signing requests.
To get started using OAuth, you'll first have to register your application. If you haven't yet, you'll want to read the OAuth Documentation.
OAuth is used throughout the documentation to mark resources that are protected.
Rate Limiting
You are allowed to make 1500 requests per hour. This limit should be high enough for most applications and we reserve the right to tune it in the future. If you need more, please contact us. If you exceed this limit, a 503 response will be returned with the Retry-After header set, which will contain the number of seconds until you can start sending requests again.
Formats and HTTP Response Codes
Supported Formats
We currently support both XML and JSON. Unless otherwise specified, wherever format is used in a URI, it can be replaced with either xml or json.
HTTP Response Codes
The following HTTP status codes may be returned in responses from the server:
200OK- It worked :)
404Not Found- The resource doesn't exist.
401Not Authorized- You're accessing resources without the correct authorization. (Make sure your authorization code is properly working!)
422Unprocessable Entity- This is likely the result of invalid or missing parameters. Make sure the data you're sending in your request is correct.
405Method Not Allowed- The method used to manipulate the resource is not allowed. Check the
Allowheader for valid methods. 406Not Acceptable- The resource you've requested cannot be represented in the format you asked for.
503Service Unavailable- You have may have hit your rate limit, check the
Retry-Afterheader. 502or503- Service is down for maintenance. Please try again later. If it's a
503, check the headers to see if it's because you hit your rate limit.
Table of Contents
- Read Data
-
Read Streams
- Public — a stream of everyone's entries
- Person — a person's stream
- You And Friends — the stream of the authenticated user and their friends
- Nearby — a stream of entries nearby a location
-
Publish Data
- Create Entry — post a workout, note, or image
- Delete Entry — delete an entry
- Create Comment — add a comment to an entry
- Create Like — like an entry
Resources
OAuthCreate an Entry
POST http://api.dailymile.com/entries.format
Parameters:
message, string (optional)- text of the note to post or the "how did it go?" text to accompany a workout
Include if posting a workout:
workout[type], string (optional)- one of "running", "cycling", "swimming", "walking", or "fitness"
workout[completed_at], datetime (optional)- when the workout was done, ex: 2010-12-25 12:15:00
workout[distance][value], float (optional)- the distance indicated by units
workout[distance][units], string (optional)- one of "miles", "kilometers", "yards", or "meters"; defaults depending on user's units preference and workout type
workout[duration], integer (optional)- the number of seconds spent working out
workout[felt], string (optional)- one of "great", "good", "alright", "blah", "tired" or "injured"
workout[calories], integer (optional)- the number of calories burned during the workout
Include if sharing an image:
media[type], string- image
media[url], string- the URL to the photo
OAuthDelete an Entry
DELETE http://api.dailymile.com/entries/id.format
Read an Entry
GET http://api.dailymile.com/entries/id.format
Person
GET http://api.dailymile.com/people/username.format
Friends
GET http://api.dailymile.com/people/username/friends.format
User's Stream
GET http://api.dailymile.com/people/username/entries.format
The most recent 20 entries.
Parameters:
page, integer (optional)- page of results to return, starting with 1
For an example response, view the response below for You and Friends.
OAuthYou and Friends Stream
GET http://api.dailymile.com/entries/friends.format
The most recent 20 entries.
Parameters:
page, integer (optional)- page of results to return, starting with 1
max_id, integer (optional)- Fetch all entries with an ID less than or equal to the given
max_id. since_id, integer (optional)- Fetch all entries with an ID greater than the given
since_id.
Public Stream
GET http://api.dailymile.com/entries.format
The most recent 25 entries.
Parameters:
page, integer (optional)- page of results to return, starting with 1
max_id, integer (optional)- Fetch all entries with an ID less than or equal to the given
max_id. since_id, integer (optional)- Fetch all entries with an ID greater than the given
since_id.
Nearby Stream
GET http://api.dailymile.com/entries/nearby/lat,long.format
The most recent 25 entries posted nearby the given coordinates.
Parameters:
radius, integer (optional)- radius in miles to show results in, default is 50 miles
page, integer (optional)- page of results to return, starting with 1
max_id, integer (optional)- Fetch all entries with an ID less than or equal to the given
max_id. since_id, integer (optional)- Fetch all entries with an ID greater than the given
since_id.
OAuthEntry Comments
POST http://api.dailymile.com/entries/id/comments.format
Parameters:
body, string with a max length of 510 (required)- the comment text
OAuthEntry Likes
POST http://api.dailymile.com/entries/id/likes.format
