SmugMug 1.2.0 API

Norman Walsh

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Table of Contents

1. Using the XSLT API
2. smugmug.albums.xsl
smugmug.albums.changeSettings
smugmug.albums.create
smugmug.albums.delete
smugmug.albums.get
smugmug.albums.getInfo
smugmug.albums.getStats
smugmug.albums.reSort
3. smugmug.albumtemplates.xsl
smugmug.albumtemplates.get
4. smugmug.categories.xsl
smugmug.categories.create
smugmug.categories.delete
smugmug.categories.get
smugmug.categories.rename
5. smugmug.images.xsl
smugmug.images.changePosition
smugmug.images.changeSettings
smugmug.images.delete
smugmug.images.get
smugmug.images.getEXIF
smugmug.images.getInfo
smugmug.images.getStats
smugmug.images.getURLs
smugmug.images.upload
smugmug.images.uploadFromURL
6. smugmug.subcategories.xsl
smugmug.subcategories.create
smugmug.subcategories.delete
smugmug.subcategories.get
smugmug.subcategories.getAll
smugmug.subcategories.rename
7. smugmug.users.xsl
smugmug.users.getTransferStats
smugmug.users.getTree

Chapter 1. Using the XSLT API

The XSLT API for SmugMug is a set of XSLT 2.0 stylesheets designed to interact with the SmugMug APIs. Both the 1.2.0 and 1.2.1 SmugMug APIs are supported.

The XSLT API for SmugMug includes named templates for all of the SmugMug API methods. Named templates are used instad of functions so that names parameters can be passed. Using required, positional parameters to XSLT functions would just be too cumbersome.

Each of the templates is in the http://smlocl.sourceforge.net/ns/api# namespace. For example, the smugmug.images.getInfo method can be called with the named template s:images.getInfo, assuming that the prefix s: is bound to the namespace.

Each call to the SmugMug API methods must include a session ID. You obtain a session ID by logging into the service. Obtaining and managing session IDs can be tedious, so the XSLT API employs a few conventions to minimize this burden.

First, the session ID is maintained in a global parameter, $s:SessionID. This value is used as the default session ID for all of the method calls. If you're building a more complex application, you can, of course, pass in explicit values.

The next question is, how to initialize the $s:SessionID parameter? The solution I've adopted is to load it from a file, ~/.smugmug.xml. That file contains the results of the login method.

In short:

  1. Run a stylesheet that calls the login named template (for convience when calling them from the command line, the login and logout templates are not in any namespace). This template uses the email and password parameters to login to SmugMug.

    If the login succeeeds, you'll get back an XML Login element:

    <Login PasswordHash="some-random-looking-hash-value" AccountType="Pro"
           FileSizeLimit="25165824">
       <Session id="some-randome-looking-session-id"/>
       <User id="999999" NickName="yournick" DisplayName="yourname"/>
    </Login>

    Store this in ~/.smugmug.xml.

  2. Now run the stylesheet that performs the actual work. This stylesheet can initialize the session ID from ~/.smugmug.xml.

In practice, session IDs seem to last quite a while. Certainly long enough to accomplish most tasks.

Chapter 2. smugmug.albums.xsl

smugmug.albums.changeSettings

<xsl:template name="s:albums.changeSettings">
   <xsl:param name="AlbumID"            as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="AlbumTemplateID"    as="xs:integer"/>
   <xsl:param name="Backprinting"       as="xs:string"/>
   <xsl:param name="CanRank"            as="xs:boolean"/>
   <xsl:param name="CategoryID"         as="xs:string"/>
   <xsl:param name="Clean"              as="xs:boolean"/>
   <xsl:param name="Comments"           as="xs:boolean"/>
   <xsl:param name="CommunityID"        as="xs:integer"/>
   <xsl:param name="DefaultColor"       as="xs:boolean"/>
   <xsl:param name="Description"        as="xs:string"/>
   <xsl:param name="EXIF"               as="xs:boolean"/>
   <xsl:param name="External"           as="xs:boolean"/>
   <xsl:param name="FamilyEdit"         as="xs:boolean"/>
   <xsl:param name="Filenames"          as="xs:boolean"/>
   <xsl:param name="FriendEdit"         as="xs:boolean"/>
   <xsl:param name="Geography"          as="xs:boolean"/>
   <xsl:param name="Header"             as="xs:boolean"/>
   <xsl:param name="HideOwner"          as="xs:boolean"/>
   <xsl:param name="Keywords"           as="xs:string"/>
   <xsl:param name="Larges"             as="xs:boolean"/>
   <xsl:param name="Originals"          as="xs:boolean"/>
   <xsl:param name="Password"           as="xs:string"/>
   <xsl:param name="PasswordHint"       as="xs:string"/>
   <xsl:param name="Printable"          as="xs:boolean"/>
   <xsl:param name="ProofDays"          as="xs:integer"/>
   <xsl:param name="Protected"          as="xs:boolean"/>
   <xsl:param name="Public"             as="xs:boolean"/>
   <xsl:param name="Share"              as="xs:boolean"/>
   <xsl:param name="SmugSearchable"     as="xs:boolean"/>
   <xsl:param name="SortDirection"      as="xs:boolean"/>
   <xsl:param name="SortMethod"         as="xs:string"/>
   <xsl:param name="SubCategoryID"      as="xs:integer"/>
   <xsl:param name="TemplateID"         as="xs:integer"/>
   <xsl:param name="Title"              as="xs:string"/>
   <xsl:param name="UnsharpAmount"      as="xs:float"/>
   <xsl:param name="UnsharpRadius"      as="xs:float"/>
   <xsl:param name="UnsharpSigma"       as="xs:float"/>
   <xsl:param name="UnsharpThreshold"   as="xs:float"/>
   <xsl:param name="WatermarkID"        as="xs:integer"/>
   <xsl:param name="Watermarking"       as="xs:boolean"/>
   <xsl:param name="WorldSearchable"    as="xs:boolean"/>
   <xsl:param name="X2Larges"           as="xs:boolean"/>
   <xsl:param name="X3Larges"           as="xs:boolean"/>
   <xsl:param name="XLarges"            as="xs:boolean"/>
</xsl:template>

See smugmug.albums.changeSettings.

smugmug.albums.create

<xsl:template name="s:albums.create">
   <xsl:param name="CategoryID"         as="xs:string"/>
   <xsl:param name="Title"              as="xs:string"/>
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="AlbumTemplateID"    as="xs:integer"/>
   <xsl:param name="Backprinting"       as="xs:string"/>
   <xsl:param name="CanRank"            as="xs:boolean"/>
   <xsl:param name="Clean"              as="xs:boolean"/>
   <xsl:param name="Comments"           as="xs:boolean"/>
   <xsl:param name="CommunityID"        as="xs:integer"/>
   <xsl:param name="DefaultColor"       as="xs:boolean"/>
   <xsl:param name="Description"        as="xs:string"/>
   <xsl:param name="EXIF"               as="xs:boolean"/>
   <xsl:param name="External"           as="xs:boolean"/>
   <xsl:param name="FamilyEdit"         as="xs:boolean"/>
   <xsl:param name="Filenames"          as="xs:boolean"/>
   <xsl:param name="FriendEdit"         as="xs:boolean"/>
   <xsl:param name="Geography"          as="xs:boolean"/>
   <xsl:param name="Header"             as="xs:boolean"/>
   <xsl:param name="HideOwner"          as="xs:boolean"/>
   <xsl:param name="Keywords"           as="xs:string"/>
   <xsl:param name="Larges"             as="xs:boolean"/>
   <xsl:param name="Originals"          as="xs:boolean"/>
   <xsl:param name="Password"           as="xs:string"/>
   <xsl:param name="PasswordHint"       as="xs:string"/>
   <xsl:param name="Printable"          as="xs:boolean"/>
   <xsl:param name="ProofDays"          as="xs:integer"/>
   <xsl:param name="Protected"          as="xs:boolean"/>
   <xsl:param name="Public"             as="xs:boolean"/>
   <xsl:param name="Share"              as="xs:boolean"/>
   <xsl:param name="SmugSearchable"     as="xs:boolean"/>
   <xsl:param name="SortDirection"      as="xs:boolean"/>
   <xsl:param name="SortMethod"         as="xs:string"/>
   <xsl:param name="SubCategoryID"      as="xs:integer"/>
   <xsl:param name="TemplateID"         as="xs:integer"/>
   <xsl:param name="UnsharpAmount"      as="xs:float"/>
   <xsl:param name="UnsharpRadius"      as="xs:float"/>
   <xsl:param name="UnsharpSigma"       as="xs:float"/>
   <xsl:param name="UnsharpThreshold"   as="xs:float"/>
   <xsl:param name="WatermarkID"        as="xs:integer"/>
   <xsl:param name="Watermarking"       as="xs:boolean"/>
   <xsl:param name="WorldSearchable"    as="xs:boolean"/>
   <xsl:param name="X2Larges"           as="xs:boolean"/>
   <xsl:param name="X3Larges"           as="xs:boolean"/>
   <xsl:param name="XLarges"            as="xs:boolean"/>
</xsl:template>

See smugmug.albums.create.

smugmug.albums.delete

<xsl:template name="s:albums.delete">
   <xsl:param name="AlbumID"            as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.albums.delete.

smugmug.albums.get

<xsl:template name="s:albums.get">
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="Heavy"              as="xs:boolean"/>
   <xsl:param name="NickName"           as="xs:string"/>
   <xsl:param name="SitePassword"       as="xs:string"/>
</xsl:template>

See smugmug.albums.get.

smugmug.albums.getInfo

<xsl:template name="s:albums.getInfo">
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="AlbumID"            as="xs:integer"/>
   <xsl:param name="AlbumKey"           as="xs:string"/>
   <xsl:param name="Password"           as="xs:string"/>
   <xsl:param name="SitePassword"       as="xs:string"/>
</xsl:template>

See smugmug.albums.getInfo.

smugmug.albums.getStats

<xsl:template name="s:albums.getStats">
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="AlbumID"            as="xs:integer"/>
   <xsl:param name="Heavy"              as="xs:boolean"/>
   <xsl:param name="Month"              as="xs:integer"/>
   <xsl:param name="Year"               as="xs:integer"/>
</xsl:template>

See smugmug.albums.getStats.

smugmug.albums.reSort

<xsl:template name="s:albums.reSort">
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="AlbumID"            as="xs:integer"/>
   <xsl:param name="By"                 as="xs:string"/>
   <xsl:param name="Direction"          as="xs:string"/>
</xsl:template>

See smugmug.albums.reSort.

Chapter 3. smugmug.albumtemplates.xsl

smugmug.albumtemplates.get

<xsl:template name="s:albumtemplates.get">
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.albumtemplates.get.

Chapter 4. smugmug.categories.xsl

smugmug.categories.create

<xsl:template name="s:categories.create">
   <xsl:param name="Name"               as="xs:string"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.categories.create.

smugmug.categories.delete

<xsl:template name="s:categories.delete">
   <xsl:param name="CategoryID"         as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.categories.delete.

smugmug.categories.get

<xsl:template name="s:categories.get">
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="NickName"           as="xs:string"/>
   <xsl:param name="SitePassword"       as="xs:string"/>
</xsl:template>

See smugmug.categories.get.

smugmug.categories.rename

<xsl:template name="s:categories.rename">
   <xsl:param name="CategoryID"         as="xs:integer"/>
   <xsl:param name="Name"               as="xs:string"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.categories.rename.

Chapter 5. smugmug.images.xsl

smugmug.images.changePosition

<xsl:template name="s:images.changePosition">
   <xsl:param name="ImageID"            as="xs:integer"/>
   <xsl:param name="Position"           as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.images.changePosition.

smugmug.images.changeSettings

<xsl:template name="s:images.changeSettings">
   <xsl:param name="ImageID"            as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="AlbumID"            as="xs:integer"/>
   <xsl:param name="Caption"            as="xs:string"/>
   <xsl:param name="Hidden"             as="xs:boolean"/>
   <xsl:param name="Keywords"           as="xs:string"/>
</xsl:template>

See smugmug.images.changeSettings.

smugmug.images.delete

<xsl:template name="s:images.delete">
   <xsl:param name="ImageID"            as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.images.delete.

smugmug.images.get

<xsl:template name="s:images.get">
   <xsl:param name="AlbumID"            as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="AlbumKey"           as="xs:string"/>
   <xsl:param name="Heavy"              as="xs:boolean"/>
   <xsl:param name="Password"           as="xs:string"/>
   <xsl:param name="SitePassword"       as="xs:string"/>
</xsl:template>

See smugmug.images.get.

smugmug.images.getEXIF

<xsl:template name="s:images.getEXIF">
   <xsl:param name="ImageID"            as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="ImageKey"           as="xs:string"/>
   <xsl:param name="Password"           as="xs:string"/>
   <xsl:param name="SitePassword"       as="xs:string"/>
</xsl:template>

See smugmug.images.getEXIF.

smugmug.images.getInfo

<xsl:template name="s:images.getInfo">
   <xsl:param name="ImageID"            as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="ImageKey"           as="xs:string"/>
   <xsl:param name="Password"           as="xs:string"/>
   <xsl:param name="SitePassword"       as="xs:string"/>
</xsl:template>

See smugmug.images.getInfo.

smugmug.images.getStats

<xsl:template name="s:images.getStats">
   <xsl:param name="ImageID"            as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="Month"              as="xs:integer"/>
</xsl:template>

See smugmug.images.getStats.

smugmug.images.getURLs

<xsl:template name="s:images.getURLs">
   <xsl:param name="ImageID"            as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="ImageKey"           as="xs:string"/>
   <xsl:param name="Password"           as="xs:string"/>
   <xsl:param name="SitePassword"       as="xs:string"/>
   <xsl:param name="TemplateID"         as="xs:integer"/>
</xsl:template>

See smugmug.images.getURLs.

smugmug.images.upload

<xsl:template name="s:images.upload">
   <xsl:param name="AlbumID"            as="xs:integer"/>
   <xsl:param name="ByteCount"          as="xs:string"/>
   <xsl:param name="Caption"            as="xs:string"/>
   <xsl:param name="Data"               as="xs:string"/>
   <xsl:param name="FileName"           as="xs:string"/>
   <xsl:param name="MD5Sum"             as="xs:string"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.images.upload.

smugmug.images.uploadFromURL

<xsl:template name="s:images.uploadFromURL">
   <xsl:param name="AlbumID"            as="xs:integer"/>
   <xsl:param name="Caption"            as="xs:string"/>
   <xsl:param name="URL"                as="xs:string"/>
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="Altitude"           as="xs:string"/>
   <xsl:param name="ByteCount"          as="xs:integer"/>
   <xsl:param name="Keywords"           as="xs:string"/>
   <xsl:param name="Latitude"           as="xs:string"/>
   <xsl:param name="Longitude"          as="xs:string"/>
   <xsl:param name="MD5Sum"             as="xs:string"/>
</xsl:template>

See smugmug.images.uploadFromURL.

Chapter 6. smugmug.subcategories.xsl

smugmug.subcategories.create

<xsl:template name="s:subcategories.create">
   <xsl:param name="CategoryID"         as="xs:integer"/>
   <xsl:param name="Name"               as="xs:string"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.subcategories.create.

smugmug.subcategories.delete

<xsl:template name="s:subcategories.delete">
   <xsl:param name="SubCategoryID"      as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.subcategories.delete.

smugmug.subcategories.get

<xsl:template name="s:subcategories.get">
   <xsl:param name="CategoryID"         as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="NickName"           as="xs:string"/>
   <xsl:param name="SitePassword"       as="xs:string"/>
</xsl:template>

See smugmug.subcategories.get.

smugmug.subcategories.getAll

<xsl:template name="s:subcategories.getAll">
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="NickName"           as="xs:string"/>
   <xsl:param name="SitePassword"       as="xs:string"/>
</xsl:template>

See smugmug.subcategories.getAll.

smugmug.subcategories.rename

<xsl:template name="s:subcategories.rename">
   <xsl:param name="Name"               as="xs:string"/>
   <xsl:param name="SubCategoryID"      as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.subcategories.rename.

Chapter 7. smugmug.users.xsl

smugmug.users.getTransferStats

<xsl:template name="s:users.getTransferStats">
   <xsl:param name="Month"              as="xs:integer"/>
   <xsl:param name="Year"               as="xs:integer"/>
   <xsl:param name="SessionID"          as="xs:string"/>
</xsl:template>

See smugmug.users.getTransferStats.

smugmug.users.getTree

<xsl:template name="s:users.getTree">
   <xsl:param name="SessionID"          as="xs:string"/>
   <xsl:param name="Heavy"              as="xs:boolean"/>
   <xsl:param name="NickName"           as="xs:string"/>
   <xsl:param name="SitePassword"       as="xs:string"/>
</xsl:template>

See smugmug.users.getTree.