API

From Doc

This page is for Software Developers desiring to extend Phanfare

The Phanfare Public API allows developers to build tools that let you do more with Phanfare. You can integrate Phanfare albums, photos and videos into existing applications, sites and services or build new tools from scratch. (All subject to some restrictions, of course.)

Table of contents

The Basics

The request format for the Phanfare API is REST.

A request for the method 'methodname', that takes a parameter called 'target_uid', with the value '123' would be structured like the following.

http://www.phanfare.com/api/?method=methodname&target_uid=123

The response to a request can take on two forms which are displayed below. The first is a successful request, the second is a request where an error occurred.

<?xml version="1.0" encoding="utf-8" ?><rsp stat="ok">[xml-response]</rsp>
<?xml version="1.0" encoding="utf-8" ?><rsp stat="fail" error_code="" code_value="" msg="" />

Making a Request

To use the Phanfare API, you will need a public Phanfare API key and a private API key. The use of a private key is an addition to Phanfare 2.0 to make your request more secure. To make any request to the API you will need to provide your public key, and sign your request with your private key. API calls also required a session_id, which is obtained from the authenticate call. The following is an example of making your first call, authenticate:

The base URL for this call will be:

http://www.phanfare.com/api/?

The parameters will be:

api_key=abc&method=Authenticate&email_address=a@b.com&password=xyz

You then append your private key onto the end of the parameter string, apply an MD5 hash, and append that result to the parameter string as sig=<result>. Your final URL will resemble:

http://www.phanfare.com/api/?api_key=abc&method=Authenticate&email_address=a@b.com&password=xyz&sig=<MD5 hash>

Getting Started

Before you can use the API, you must request an API key.


Here is a C# example of building an authenticate request.

Part of the result of the authenticate call is a “cookie�?. This cookie represents your session. It is good for 30 minutes, but the expiration will be “rolling�? if the cookie is in use. For all subsequent requests, this cookie should be sent with the HTTP request as a cookie called “phanfare2�? for the domain “.phanfare.com�?.

Here is a C# example of a full HTTP Request.

NOTE: All dates sent to the service (for new albums, images, etc) must be in UTC. Dates sent to the service can be in any format the .NET DateTime type understands; dates returned from the service are in the format of '2006-04-17T21:29:09.3011250Z' (UTC).

Method Calls

Authentication

Accounts

Albums

Images and Videos

Help

For questions, helping using the API, or to report bugs, please send an email to: developer@phanfare.com or post a question on our Public API forum (http://forum.phanfare.com/forumdisplay.php?f=23).

© 2008 Phanfare, Inc.