Phanfare Support Site

Phanfare Public API

From Phanfare Support

This page is for Software Developers desiring to extend Phanfare

This page covers the API for the Phanfare 1.0 service, which is a legacy system scheduled to be shut down in June 2008. For information on the API for the Phanfare 2.0 service,click here. (http://help.phanfare.com/index.php/API)

The Phanfare Public API allows developers to build tools (which we call Widgets) 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.) We'll be hosting Widgets Created by the Community on the site so other Phanfare user can take advantage of them. And we've even seeded the cloud with Our Wishlist - Extensions We Hope Others Write.

If you don't have a Phanfare account already, just sign up for an unrestricted 30-day trial account here (http://www.phanfare.com/startfreetrial.aspx). Anyone who creates a publicly-available application using the Phanfare API will receive a free lifetime Phanfare subscription.

Table of contents

The API Format

The request format for the Phanfare API is REST.

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

http://api.phanfare.com/rest/?method=methodname&username=public

If you creating albums (or sections) and suppling long descriptions, it may be a good idea to POST the parameters as part of the message body to avoid hitting the limit on the length of a url.

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">
	<err code="[error-code]" msg="[error-message]" />
</rsp>

Responses can also be in JSON. If you wish to receive a JSON response instead of xml add the parameter 'response' with the value 'json' to your request. The JSON response will look like

jsonPhanfare(....)

To change the name of the 'callback' function, add the parameter 'function' with the value as the function name.

Request Basics

Every call to the Phanfare API requires an API key must be obtained for your application. All read and write methods also require a session_id, which can be obtained through a method call. Your session_id holds all of the privileges which you currently have. If you wish to make read only calls to only public accounts and albums you could use the special session_id "publiconly". You can not add any privs to this session_id.

When you receive a new session_id it already has read the privileges required to access any public Phanfare account and album. If you wish to make method call which requires read privs against an account with a guest password, or an album with a guest password, you must authenticate your session_id to that object first. If you wish to make a method call that requires write privs you must authenticate using the account username and password. A session_id can only have write privs to one account. If your application is going to write to multiple accounts you must obtain multiple session_ids.

Note: It is very important to be aware of whether the session_id you are using has read or write privs to the current account. When a session_id with write privs asks for an AlbumList it will see ALL albums including those that are hidden. Likewise, if an album is set to not allow guests to view exif, a session_id with the write priv will still see the exif. The general guideline is to not obtain write privs unless your application is going to be writing to the account and don't use a session_id with write privs for any guest facing application.

Method Calls

Auth

Album

Image

Getting Started

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

There is a C# wrapper available for the API to help with any .NET development your looking to do. Release (http://www.phanfare.com/updates/extras/0.2/PhanfareAPIWrapper.dll) Source (http://www.phanfare.com/updates/extras/0.2/PhanfareAPIWrapper.zip)

Examples

There are Widgets Created by the Community that you can use as examples.

Help

For questions, helping using the API, or to report bugs, please send an email to: developer@phanfare.com

© 2008 Phanfare, Inc.