API 1.2.1 beta
devbobo
Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
Hi Guys,
We decided to push out an early release of 1.2.1 so that you guys can start playing.
It's not feature complete, and there will probably get a few bugs. At this point, I haven't had a chance to do the documentation, so below I have listed the new endpoints and the input parameters for the new methods.
I'm away at Glacier for the next week, so I will look at any issues when I get back.
Cheers,
David
REST: http/api.smugmug.com/services/api/rest/1.2.1/
JSON: http/api.smugmug.com/services/api/json/1.2.1/
PHP: http/api.smugmug.com/services/api/php/1.2.1/
XML-RPC: http/api.smugmug.com/services/api/xmlrpc/1.2.1/
smugmug.albums.applyWatermark
smugmug.albumtemplates.changeSettings
smugmug.watermarks.changeSettings (pro only)
smugmug.products.get
smugmug.propricing.getPortfolio (pro only)
smugmug.propricing.getAlbum (pro only)
smugmug.propricing.getImage (pro only)
Updated Methods...
smugmug.albums.get
smugmug.users.getTree
now accepts a ShareGroup parameter, which can be a single or an array of share group tags, which will expose any private albums for a given sharegroup when you call this method on another user's account.
smugmug.images.getInfo now returns Latitude, Longitude and Altitude if set.
smugmug.images.changeSettings now accepts Latitude, Longitude and Altitude
We decided to push out an early release of 1.2.1 so that you guys can start playing.
It's not feature complete, and there will probably get a few bugs. At this point, I haven't had a chance to do the documentation, so below I have listed the new endpoints and the input parameters for the new methods.
I'm away at Glacier for the next week, so I will look at any issues when I get back.
Cheers,
David
REST: http/api.smugmug.com/services/api/rest/1.2.1/
JSON: http/api.smugmug.com/services/api/json/1.2.1/
PHP: http/api.smugmug.com/services/api/php/1.2.1/
XML-RPC: http/api.smugmug.com/services/api/xmlrpc/1.2.1/
smugmug.albums.applyWatermark
- string SessionID
- int AlbumID
- int WatermarkID
- string SessionID
- int AlbumID
- string SessionID
smugmug.albumtemplates.changeSettings
- string SessionID
- int AlbumTemplateID
- see the response from smugmug.albumtemplates.get for more parameters
- string SessionID
- string NickName
- string SessionID
- string SessionID
- string NickName
- string SessionID
- string SessionID
- string NickName
- string SessionID
- string SessionID
- string NickName
- string SessionID
- string SessionID
- int ImageID
- int WatermarkID
- string SessionID
- int ImageID
- int Width
- int Height
- int X
- int Y
- string SessionID
- int ImageID
- string SessionID
- int ImageID
- int Degrees
- bool Flip
- string SessionID
- int ImageID
- int Width
- int Height
- int X
- int Y
- string SessionID
- int ShareGroupID
- int AlbumID
- string SessionID
- string Name
- string Description
- string SessionID
- int ShareGroupID
- string SessionID
- bool Heavy
- string SessionID
- int ShareGroupID
- string SessionID
- int ShareGroupID
- int AlbumID
- string SessionID
- string SessionID
- string NickName
smugmug.watermarks.changeSettings (pro only)
- string SessionID
- int ImageID
- string Name
- string Pinned (Left, Right, Center, Top, Bottom, TopLeft, TopRight, BottomLeft, BottomRight, Tile)
- int Dissolved (0-100)
- bool Thumbs
- string SessionID
- int ImageID
- string Name
- string Pinned (Left, Right, Center, Top, Bottom, TopLeft, TopRight, BottomLeft, BottomRight, Tile)
- int Dissolve (0-100)
- bool Thumbs
- string SessionID
- int WatermarkID
- string SessionID
- string Heavy
- string SessionID
- int WatermarkID
smugmug.products.get
- string SessionID
smugmug.propricing.getPortfolio (pro only)
- string SessionID
- string/array of strings ProductType optional (CommonPrint, DigitalPrint, SpecialityPrint, Merchandise, Download)
- int/array of ints ProductID optional
smugmug.propricing.getAlbum (pro only)
- string SessionID
- int AlbumID
- string/array of strings ProductType optional (CommonPrint, DigitalPrint, SpecialityPrint, Merchandise, Download)
- int/array of ints ProductID optional
smugmug.propricing.getImage (pro only)
- string SessionID
- int ImageID
- string/array of strings ProductType optional (CommonPrint, DigitalPrint, SpecialityPrint, Merchandise, Download)
- int/array of ints ProductID optional
Updated Methods...
smugmug.albums.get
smugmug.users.getTree
now accepts a ShareGroup parameter, which can be a single or an array of share group tags, which will expose any private albums for a given sharegroup when you call this method on another user's account.
smugmug.images.getInfo now returns Latitude, Longitude and Altitude if set.
smugmug.images.changeSettings now accepts Latitude, Longitude and Altitude
0
Comments
SmugMug API Developer
My Photos
users.getTransferStats:
http://api.smugmug.com/services/api/rest/1.2.1/?APIKey=API_KEY
&method=smugmug.users.getTransferStats&SessionId=SESSION_ID
&Month=9&Year=2007
(takes a long time, then just errors out with:
The requested URL could not be retrieved)
albums.getStats:
http://api.smugmug.com/services/api/rest/1.2.1/?APIKey=API_KEY
&method=smugmug.albums.getStats&SessionId=SESSION_ID
&Month=9&Year=2007&AlbumID=3504830&heavy=true
just gives me overall stats - not detailed per-image. I've also tried heavy=True,TRUE,1
The previous api 1.1.1 would return a heavy listing, but all the image stats were 0 (posted another thread about that)
I've been trying to access my per-image stats in the last couple versions, and never have been able to get them.
yes, I am aware of this issue... however, it requires me spending some time with Don to figure it out. It's on my list of stuff that needs to be fixed.
Cheers,
David
SmugMug API Developer
My Photos
This works:
http://api.smugmug.com/hack/rest/1.2.0/?method=smugmug.login.anonymously&APIKey=<removed
This doesn't:
http://api.smugmug.com/hack/rest/1.2.1/?method=smugmug.login.anonymously&APIKey=<removed>
The first is returning what appears to be the correct XML document, the seconds is giving me nothing... no error message, nothing.
the endpoints for 1.2.1 are different...
http://api.smugmug.com/services/api/rest/1.2.1/?method=smugmug.login.anonymously&APIKey=<removed>
SmugMug API Developer
My Photos
smugmug.users.getDisplayName = invalid API key
only the methods currently listed in this thread are implemented.
I will check out the issue with smugmug.users.getDisplayName
SmugMug API Developer
My Photos
Is the change in the structure of the REST responses intentional?
REST 1.2.0
<?xml version="1.0" encoding="utf-8" ?>
[URL="file:///C:/Users/Luke%20Church/AppData/Local/Temp/VSD1.tmp.XML#"]-[/URL] <rsp stat="ok">
<method>smugmug.login.withPassword</method>
[URL="file:///C:/Users/Luke%20Church/AppData/Local/Temp/VSD1.tmp.XML#"]-[/URL] <Login PasswordHash="..." AccountType="Pro" FileSizeLimit="25165824">
<Session id="..." />
<User id="..." NickName="..." DisplayName="Luke Church" />
</Login>
</rsp>
REST 1.2.1
<?xml version="1.0" encoding="utf-8" ?>
[URL="file:///C:/Users/Luke%20Church/AppData/Local/Temp/VSD1.tmp.XML#"]-[/URL] <rsp stat="ok">
<method>smugmug.login.withPassword</method>
[URL="file:///C:/Users/Luke%20Church/AppData/Local/Temp/VSD1.tmp.XML#"]-[/URL] <Login SessionID="..." PasswordHash="..." AccountType="Pro" FileSizeLimit="25165824">
<User id="..." NickName="..." DisplayName="Luke Church" />
</Login>
</rsp>
Note the change from <session id = foo> to <Login SessionID= foo>
This testing is being done shoddily, I was just prodding the API to see whether things have improved since last time, to decide whether it's worth investing time in developing something. If a rigourous demo case is required to answer the question let me know.
All the best,
Luke
SmugSoftware: www.smugtools.com
Luke,
yes, the change was intentional...it enabled us to generate xml-rpc, json, rest and php responses from a common code base. It has been like that for some time.
Cheers,
David
SmugMug API Developer
My Photos
OK thanks David. Hope you're keeping well?
SmugSoftware: www.smugtools.com
yeah but busy... how about you ?
SmugMug API Developer
My Photos
Sounds familiar
SmugSoftware: www.smugtools.com
As for the rational for changing this response, I dunno.... I was wondering the same thing myself.
Mark
Apologies
That will learn me for tackling forum threads before coffee. That's a bug, it's been fixed on my dev server.
I'll let you know when it's live.
David
SmugMug API Developer
My Photos
This is my first post. I have just started working on a Ruby R/W implementation of your API and found an issue with setting captions and keywords through the API.
CAPTIONS:
Captions with quotes, end up having the quote escaped when viewed on the web. Here is a sample of what I am talking about.
Photo with escaped quote
API Call to change Caption
If I change the caption manually through the web interface it works fine, however I am working on setting up a feed from our RallyNorth.net site and manual caption editing is not an option.
KEYWORDS:
Keywords with numbers or spaces also seem to have an issue that might be centered around this quoting issue as well. For some reason I need to quote any keyword with a number or space in it, when using the API, however if I use the web interface this is not necessary.
For instance the above photo has the following keywords:
Sports, GameID365, Featured Photo, Football, High School, 2007, 200709, 20070907, North Andover, Andover
If I submit them through the API like so:
Update Keywords through API
The site only shows the following keywords:
football, sports, andover, high school, featured photo, north andover, gameid
But when I go to edit them they all appear correctly, and if I submit them from the online form as is they don't work as well, I have to quote any keyword with a number. So if I quote all keywords and submit them through the API like so:
Update keywords through API with quotes
The keywords now appear correctly on the site, however if I edit them all the quotes are escaped like so:
\"Sports\", \"GameID365\", \"Featured Photo\", \"Football\", \"High School\", \"2007\", \"200709\", \"20070907\", \"North Andover\", \"Andover\"
The keywords is not really a big issue since I do get the desired results, however the caption issue is a little more important, since that is what the user sees when viewing the photos.
In reference to the last post, I tried setting a caption using all ASCII characters from 32 to 255, and all the characters worked fine except for:
%34 - " - double quote (escaped)
%39 - ' - apostrophe (escaped)
%92 - \ - backslash (escaped)
I also found that entities could be used easily enough, for instance you could use "%26apos;" or "%26quot;" for single and double quotes.
But there is still the issue with quoting if you want to put a URL in the caption, for instance passing:
smugmug
results in the following being output when viewing the photo:
smugmug
This obviously prevents the URL from being valid.
In [thread=73837]this thread[/thread] I've talked about similar problems I've been having with Keywords. I was so excited to find your post, and I tried using %26quot;foo%26quot; in a keyword, but to no avail. When I look at it on the website, it appears exactly as I've typed it above.
Suck.
--Darryl
Well, the problem was that I thought I might have multiple guest users, including newbies, editing the keywords in the UI.
If there was an existing keyword, for say, Ty, that looked like \"Ty\" and they just wanted to add Will and John, the backslashes might be confusing to a non-coder.
But I think I'll be bypassing the problem by implementing my hack to convert comments to keywords on an hourly basis. (They'll have to have "keywords:" or "tags:" at the beginning for my script to pick them up.)
That sounds like an interesting hack, can you share it when you get it working.
Here ya go: http://www.dgrin.com/showthread.php?p=660273
I was trying to force my coce to error so I could test my error handling code, so I didn't pass the SessionId to smugmug.albums.get
(My URI that I used was
http://api.smugmug.com/services/api/rest/1.2.1/?method=smugmug.albums.get&Heavy=1
and it returned a valid result.
On a side note, it would be really cool if I could ask for a gallery list for a user without being logged in. I realise I wouldn't get private galleries etc, but still would be useful for what I am doing.
Gareth,
There is a simple explanation for this, even though you didn't provide implicitly in the request, the browser actually sent the session id cookie with the request. You can double check this by sniffing your packets in wireshark/ethereal or the like.
To you get a non-logged in view of your albums, login anonymously and then get albums.get witht NickName option.
Cheers,
David
SmugMug API Developer
My Photos
Oh Gosh Darnit, I missed the nickname option.
Now I have to go change my code and I was about to release it
The NickName option is only required when calling albums.get with an anonymous session or on another user's galleries.
SmugMug API Developer
My Photos
Yup, that is what I do in SmugSaver. If you do not give me your account details, I will use the nickname you supply.
Is there any way to find out the nickname of a user with a non-smugmug domain? (Like your site)?
This is a hack, but it's worked for me every time I've wanted to do that: get the homepage, in the header get one of the links. I've been using the rss+xml one, the nickname is the Data parameter in the href.
example:
[HTML]<link rel="alternate" type="application/rss+xml" title="SmugMug: introversion's recent galleries RSS feed" href="/hack/feed.mg?Type=nickname&Data=introversion&format=rss200" />[/HTML]
so devbobo's nickname on smugmug is introversion.
http://wall-art.smugmug.com/
Happy to join the API 1.2.1 party.
I'll be doing some testing with the applyWatermark. And my main code is now all running 1.2.1.
smugmug.images.applyWatermark
- string SessionID
- int ImageID
- int WatermarkID
I'll know soon enough with some testing but I have these questions:1) Does the watermark need to reside in the gallery with the picture? or can I have a seperate, non-viewable gallery with the my watermarks?
2) I'll have to review the picture size limits on watermark. I wish that was removed and let the pics be watermarked. (see error below)
F1b Failure for ?method=smugmug.images.applyWatermark Info to follow:
F1b API code statement to follow: https://api.smugmug.com/services/api/php/1.2.1/
?method=smugmug.images.applyWatermark&SessionID=<removed>
&ImageID=227553672&WatermarkID=187022140&output=phpArray
(
[stat] => fail
[code] => 16
[message] => invalid data (image is too small to watermark)
)
But so far so good with 1.2.1.
KC