API Documentation
Welcome to the myDailyPhoto API documentation for developers. This page will serve as a guide for implementing the myDailyPhoto API into your applications.
The myDailyPhoto API ("Service") allows developers ("Consumer") to access and retrieve information about users ("User") and the community to integrate into their own applications. This is accomplished by verifying the authenticity of the Consumer, receiving a request from the Consumer, and returning the requested information in a specified format.
The myDailyPhoto API is currently document in PHP, but any language that supports REST (Representational State Transfer) is supported.
At this time we provide the following code libraries:
PHP (
Download)
The only return format currently supported is XML, but JSON support is being added.
To begin integrating myDailyPhoto data into your application you will need to obtain an
API authorization key ("API Key").
In order to access information about a user they must allow API access and have a public profile (which is set on registration and can be changed from the Settings page). Any information marked as 'Private' or 'Friends Only' is not available through the API.
To send information (write-API) the user must first grant an application access to their account. This is done by re-directing the user to an authentication page on myDailyPhoto. After successfully verifying their identity they are sent to the callback URL of the application (provided during the API Key request) along with a UAuth token. This token serves as their authentication for requests and must be sent with all write-API requests.
For various reasons you may receive an error code when making a request. If an error is received the script will stop running and print out the error number and a short description to further assist your integration. Provided below is a list of all error codes and information on why they may have been received, as well as how to remedy the problems.
01 - Invalid API key
The API key that you have provided is incorrect or not valid. Please ensure that the API key matches the one you received during the API key request process.
02 - Application not yet approved
Your application has not yet been approved to access the myDailyPhoto API. Please wait while we review your request. If more than 72-hours have passed, or if you need to start development immediately and would like a temporary developer token, please contact Technical Support.
03 - Invalid return format requested
The format you requested that data be returned as (e.g. XML) is not currently supported. Please use a support return format.
04 - Too many parameters
Your API request includes too many parameters. Please read the applicable documentation for the method.
05 - Not enough parameters
Your API request does not include enough parameters. Please read the applicable documentation for the method.
06 - Invalid method requested
The method which you requested does not exist.
07 - User does not exist
The user for whom you're trying to retrieve data does not exist.
08 - User data not accessible
The user for whom you're trying to retrieve data does not have API access enabled for their account. Please notify the user of this and inform them of how to change this setting.
09 - User data is private
The user's account, or the specific data you're trying to access, is marked as private and therefore un-available through the API. Please notify the user of this and inform them of how to change this setting.
10 - Invalid UAuth token
The UAuth (user authentication) token passed with your request is incorrect or not valid. Please have the user re-authenticate.
11 - Incorrect data transmission method
The way you're passing parameters for your request is either un-supported or incorrect for the method called (e.g. POST rather than GET). Please read the applicable documentation for the method.
12 - Image data not received
The image was un-able to be retrieved. Please read the applicable documentation for the method.
13 - Incorrect image size
The dimensions of the image are too small (less than 250px in width or 100px in height).
This method returns all comments a user has received.
Request URI
http://www.mydailyphoto.com/api/{API_KEY}/{FORMAT}/getComments/{USERNAME}
Request Options
username - The username of the user for which you want to retrieve comments
Return Data
- from - The username of the user who posted the comment
- approved
- @status - Whether the comment has been approved by the user (0: Approved, 1: Un-approved)
- permalink - The URL to the profile page of the user who posted the comment
- avatar - The URL to the avatar of the user who posted the comment
- timestamp
- @unix - The UNIX timestamp of the comment
- message - The text of the comment
PHP Example
<?php
// Include myDailPhoto PHP library
require_once('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
// Query options
$mdp_options = array('testUser');
$mdp = mdp($mdp_param, 'getComments', $mdp_options);
foreach($mdp->comment as $comment)
{
echo '<div><strong>' . $comment->from . '</strong> said "' . $comment->message . '".</div>';
}
?>
This method returns data about all friends of a user.
Request URI
http://www.mydailyphoto.com/api/{API_KEY}/{FORMAT}/getFriends/{USERNAME}
Request Options
username - The username of the user for which you want to retrieve friend information
Return Data
- username - The username of the friend
- approved
- @status - Whether the friendship has been approved by both users (0: Approved, 1: Un-approved)
- permalink - The URL to the profile page of the friend
- avatar - The URL to the avatar of the friend
PHP Example
<?php
// Include myDailPhoto PHP library
require_once('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
// Query options
$mdp_options = array('testUser');
$mdp = mdp($mdp_param, 'getFriends', $mdp_options);
foreach($mdp->friend as $friend)
{
echo '<div><a href="' . $friend->permalink . '">' . $friend->username . '</a> is my friend!</div>';
}
?>
This method returns all publicly accessible data about a user.
Request URI
http://www.mydailyphoto.com/api/{API_KEY}/{FORMAT}/getInfo/{USERNAME}
Request Options
username - The username of the user for which you want to retrieve information
Return Data
- name
- @username - The user's username
- @first - The user's first name
- @last - The user's last name
- @full - The user's full name
- @birthdate - The user's birthdate (for age verification only)
- permalink - The URL to the profile page of the user
- avatar - The URL to the avatar of the user
- location
- @city - The user's city
- @state - The user's state
- @country - The user's country
- @timezone - The GMT offset for the user
- settings
- @active - The user's active status (0: In-active, 1: Active)
- @private - The user's privacy setting (0: Public, 1: Private)
- stats
- @joined - The date the user joined (YYYYMMDD)
- @passed - The number of days since the user registered
- @posted - The number of the days the user has posted a photo
- @percentage - The percentage of days a user has posted
- excuse - The user's current excuse
- contact
- @email - The user's e-mail address
- im
- service
- @type - The type of IM service
- @handle - The user's handle
- featured
- @state - Whether the user is a featured member (0: False, 1: True)
- reason - The user's reason for joining
- profile
- @interests - The user's list of interests
- @camera - The user's camera model
- @website - The URL for the user's personal website
PHP Example
<?php
// Include myDailPhoto PHP library
require_once('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
// Query options
$mdp_options = array('testUser');
$mdp = mdp($mdp_param, 'getInfo', $mdp_options);
echo '<div>Hello, my name is <a href="' . $mdp->permalink . '">' . $mdp->name['first'] . '</a>.<br />';
echo 'I live in ' . $mdp->location['city'] . ', ' . $mdp->location['state'] . '.'
?>
This method returns the dates for which a user has not posted a photo.
Request URI
http://www.mydailyphoto.com/api/{API_KEY}/{FORMAT}/getMissedDates/{USERNAME}
Request Options
username - The username of the user for which you want to retrieve the date listing
Return Data
- date - The date in human-readable format
- @ymd - The missed date (YYYYMMDD)
- @unix - The missed date in UNIX
PHP Example
<?php
// Include myDailPhoto PHP library
require_once('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
// Query options
$mdp_options = array('testUser');
$mdp = mdp($mdp_param, 'getMissedDates', $mdp_options);
foreach($mdp->date as $date)
{
echo '<div>You forgot to post on ' . date('F jS, Y', (int)$date['unix']) . '!<br />';
}
?>
This method returns data about all public photos a user has posted between a date range.
Request URI
http://www.mydailyphoto.com/api/{API_KEY}/{FORMAT}/getPhotos/{USERNAME}/{DATE_START}/{DATE_END}
Request Options
username - The username of the user for which you want to retrieve friend information
date_start - The start of the date range (YYYYMMDD)
date_end - The end of the date range (YYYYMMDD)
Return Data
- date - The date for which the photo was posted (YYYYMMDD)
- permalink - The URL of the photo view page
- image
- @src - The URL of the image (250x167px)
- thumb
- @src - The URL of the image (100x67px)
- original
- @src - The URL of the image (dimensions vary)
- caption - The caption for the photo
- description - The description for the photo
PHP Example
<?php
// Include myDailPhoto PHP library
require_once('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
// Query options
$mdp_options = array('testUser', '20080101', '20080131');
$mdp = mdp($mdp_param, 'getPhotos', $mdp_options);
foreach($mdp->photo as $photo)
{
echo '<div><img src="' . $photo->thumb['src'] . '" width="100" height="67" /><br />';
echo 'Posted on ' . date('F jS, Y', strtotime((int)$photo->date)) . '</div>';
}
?>
This method returns data about the top photos in the community.
Request URI
http://www.mydailyphoto.com/api/{API_KEY}/{FORMAT}/getTopPhotos/{LIMIT}
Request Options
limit - The number of photos to return
Return Data
- rank - The rank of the photo
- username - The username of the user who posted the photo
- date - The date for which the photo was posted (YYYYMMDD)
- permalink - The URL of the photo view page
- image
- @src - The URL of the image (250x167px)
- thumb
- @src - The URL of the image (100x67px)
- original
- @src - The URL of the image (dimensions vary)
- caption - The caption for the photo
- description - The description for the photo
PHP Example
<?php
// Include myDailPhoto PHP library
require_once('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
// Query options
$mdp_options = array('5');
$mdp = mdp($mdp_param, 'getTopPhotos', $mdp_options);
foreach($mdp->photo as $photo)
{
echo '<div><img src="' . $photo->thumb['src'] . '" width="100" height="67" /><br />';
echo 'Posted by ' . $photo->username . '</div>';
}
?>