Project Description

SmugMugAPIWrapper is a simple wrapper around the smugmug REST API. The main emphasis is simple uploading of files to an album, but as time goes on, more of the API will be supported. The project was originally called SmugMugAPI, but there is already one of those, so I changed the name to SmugMugAPIWrapper.

Current Version

Version 1 works for me, but the documentation is kind of thin. I suggest looking at the source to stsm.exe, which is what I use to test things out, it shows how to use all of the functionality. There are also unit tests in SmugMugAPITest.cs, but that's focused on testing each individual method, not end-to-end functionality.


I don't have a smugmug account anymore, so this whole project is mooted. If you find something you can use, I'm glad, but I cant make any more changes because I don't have an account to test against.

Introduction

SmugMugAPI is a wrapper around the SmugMug REST API. It is intended to be a simple managed interface to the API, that focuses on basic tasks, as opposed to implementing the REST API method by method.

It is very much a work in progress. It's geared toward uploading files with basic information.

Functions

Currently, the functions supported are:

public bool DeleteSmugMugAlbum(string albumName)

public SmugMugImageEXIFData GetEXIFData(GetEXIFArguments arguments)

public List<SmugMugAlbumInfo> GetAlbums()

public Dictionary<int, string> GetCategories()

public Dictionary<int, string> GetSubCategories(string category)

public SmugMugAlbumInfo CreateAlbum(CreateAlbumArguments albumArguments)

public void PostPicturesToSmugMug(List<string> fileList, PostPicturesToSmugMugArguments arguments)

public SmugMugImagesInfo PostPicturesToSmugMugWithReturnInfo(List<string> fileList, PostPicturesToSmugMugArguments arguments)

public void DownloadImages(DownloadImagesArguments arguments)

public SmugMugImages GetImages(GetImagesArguments arguments)

public SmugMugImageInfo GetImageInfo(GetImageInfoArguments arguments)

public SmugMugImagesInfo GetImagesInfo(GetImagesInfoArguments arguments)

public SmugMugImageInfo SetImageInfo(SetImageInfoArguments arguments)

public string GetAlbumURL(string albumName, string urlBase)

Constructors

SmugMugAPI(string user, string pass) : creates an instance of the library and logs on

public SmugMugApi(string apiKey, string userAgent, string userName, string userPassword) : allows you to use your own API Key and userAgent if you write your own application

Example

I'm trying to make this dirt simple to use from any managed component.

string fileToUpload = "c:\\hold\\whatever.jpg";
string userName = "whoever@example.com";
string userPassword = "blahblahblah";

if (File.Exists(fileToUpload))
{
SmugMugAPI api = new SmugMugAPI(userName, userPassword);
PostPicturesToSmugMugArguments args = new PostPicturesToSmugMugArguments();
args.AlbumName = "whatever";
List<string> fileList = new List<string>();
fileList.Add(fileToUpload);
api.postPicturesToSmugMug(fileList, args);

}


If you look at the file Program.cs in the sendtosmugmug project in the source included in the download you will see an example for every API call.

System Requirements

Created using Visual Studio 2008, targeted at .NET Framework 3.5 The library itself should compile on 2.0

Contents


Library and sendtosmugmug, which is a console application that I use to exercise the library, and can also be used to upload files to your smugmug account.

Partial list of files Installed (if you run the installer)

SmugMugApiWrapper.dll -- This is the actual library
SmugMugApiWrapper.pdb -- Symbols for above

SmugMugAPI.cs - Code to the functions listed above
SmugMugAPIObjects.cs -- code for SmugMugImages classes
SmugMugArguments.cs -- code for all of the parameter types (i.e.. PostPicturesToSmugMugArguments class)

stsm.exe -- Console Application to upload files to smugmug. Has examples for all of the public functions
stsm.pdb -- Symbols for above
Utilities.cs -- misc helper functions


Credits

I got the original idea as to this library, and my start, by finding a sample at http://www.blackbonsai.co.uk/?n=portfolio_view&pid=36, by Steven Davies.
Omar Shahine provided the code to retrieve keywords from a jpg.

Last edited Nov 24, 2009 at 11:26 AM by weloytty, version 30