- Documentation
- Key Request
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 documented 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.
This method returns all comments a user has received.
- 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
// Include myDailyPhoto PHP library
require('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
$mdp_param['format'] = '{FORMAT}';
// 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.
- 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
// Include myDailyPhoto PHP library
require('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
$mdp_param['format'] = '{FORMAT}';
// 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.
- 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
- service
- 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
// Include myDailyPhoto PHP library
require('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
$mdp_param['format'] = '{FORMAT}';
// 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'] . '.</div>';
?>
This method returns the dates for which a user has not posted a photo.
- date - The date in human-readable format
- @ymd - The missed date (YYYYMMDD)
- @unix - The missed date in UNIX
<?php
// Include myDailyPhoto PHP library
require('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
$mdp_param['format'] = '{FORMAT}';
// 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']) . '!</div>';
}
?>
This method returns data about all public photos a user has posted between a date range.
date_start - The start of the date range (YYYYMMDD)
date_end - The end of the date range (YYYYMMDD)
- 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
// Include myDailyPhoto PHP library
require('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
$mdp_param['format'] = '{FORMAT}';
// 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.
- 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
// Include myDailyPhoto PHP library
require('mdp_api.inc');
// Application API key and format
$mdp_param['key'] = '{API_KEY}';
$mdp_param['format'] = '{FORMAT}';
// 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>';
}
?>