API 1.2.2 (soft release)

2

Comments

  • lildudelildude Registered Users Posts: 70 Big grins
    edited June 12, 2008
    More possible bugs with the PHP 1.2.2 endpoint (Not tested other endpoints)
    Hmmm, may be missing something here, but the following methods don't seem to do anything or offer any response, even when using deliberately incorrect information:

    albums.applyWatermark, albums.removeWatermark, images.applyWatermark, images.removeWatermark, images.rotate, images.zoomThumbnail and images.crop

    More importantly, if you don't specify an AlbumID when changing the settings of an image using images.changeSettings, it gets assigned an AlbumID of 0 instead of keeping it's original AlbumID like it does with the other revisions of the PHP endpoint.

    I kept a record of the ImageID and ImageKey for one of the images that "disappeared" and used images.getInfo to "find" it and this is what is returned:
    Array
    (
        [id] => 311924021
        [Key] => ie3Q3
        [Album] => Array
            (
                [id] => 0
                [Key] => 
                [URL] => http://.smugmug.com/gallery/0_#311924021_ie3Q3
            )
    
        [Caption] => 1New title1
        [Height] => 404
        [Keywords] => 
        [LastUpdated] => 2008-06-12 11:39:57
        [MediumURL] => http://.smugmug.com/photos/311924021_ie3Q3-M.jpg
        [Position] => 2
        [Serial] => 0
        [Size] => 100736
        [SmallURL] => http://.smugmug.com/photos/311924021_ie3Q3-S.jpg
        [ThumbURL] => http://.smugmug.com/photos/311924021_ie3Q3-Th.jpg
        [TinyURL] => http://.smugmug.com/photos/311924021_ie3Q3-Ti.jpg
        [Width] => 992
    )
    

    See, AlbumID is now 0 and the key is blank. This image is no longer accessible.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited June 12, 2008
    Thanks Colin, I'll check those out thumb.gif
    David Parry
    SmugMug API Developer
    My Photos
  • lildudelildude Registered Users Posts: 70 Big grins
    edited June 14, 2008
    propricing.getImage and propricing.getAlbum don't acknowledge new Strict=0 func
    Hi there

    Another inconsistency/bug:

    It appears propricing.getImage and propricing.getAlbum don't acknowledge the new Strict=0 functionality. They always return an error response (old behaviour) even if Strict=0 is explicitly stated.
  • rakeshxprakeshxp Registered Users Posts: 4 Beginner grinner
    edited July 2, 2008
    Oauth - Public + Private Access
    Hi,

    I am in process of integrating 1.2.2 API into our service. When the user hits the authorization URL, there is only one option "Access photos from your public galleries". But after authorization, if the user goes to the control panel, then he/she can select "Full Access".

    So is there a way to give the option of access right at the authorization stage?

    Thanks,
    Rakesh
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited July 2, 2008
    rakeshxp wrote:
    Hi,

    I am in process of integrating 1.2.2 API into our service. When the user hits the authorization URL, there is only one option "Access photos from your public galleries". But after authorization, if the user goes to the control panel, then he/she can select "Full Access".

    So is there a way to give the option of access right at the authorization stage?

    Thanks,
    Rakesh

    Hi Rakesh,

    Yes, sorry I'm a bit lagged with the full documentation, when you call the authorize url, you can send the following parameters...

    &Access=[Public or Full]
    &Permissions=[Read, Add or Modify]'

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • rakeshxprakeshxp Registered Users Posts: 4 Beginner grinner
    edited July 3, 2008
    devbobo wrote:
    when you call the authorize url, you can send the following parameters...

    &Access=[Public or Full]
    &Permissions=[Read, Add or Modify]'

    Thanks David!:D
  • rakeshxprakeshxp Registered Users Posts: 4 Beginner grinner
    edited July 3, 2008
    I am able to fetch albums using
    http://api.smugmug.com/services/api/rest/1.2.2/?method=smugmug.albums.get&Heavy=true

    But, when I try to fetch photos for a given album ID, using
    http://api.smugmug.com/services/api/rest/1.2.2/?method=smugmug.images.get&AlbumKey=XYZ&Heavy=true , I am getting
    <rsp stat="fail"><method>smugmug.images.get</method><err code="5" msg="system error"/></rsp>
    

    Any idea why this might be happening ? <img src="https://us.v-cdn.net/6029383/emoji/ne_nau.gif&quot; border="0" alt="" >
  • rakeshxprakeshxp Registered Users Posts: 4 Beginner grinner
    edited July 3, 2008
    Posted too quickly :P .. Had missed that I need to add both AlbumID and AlbumKey . Can you update the error code to reflect such cases ? ( Instead of "system error" :) )

    rakeshxp wrote:
    I am able to fetch albums using
    http://api.smugmug.com/services/api/rest/1.2.2/?method=smugmug.albums.get&Heavy=true

    But, when I try to fetch photos for a given album ID, using
    http://api.smugmug.com/services/api/rest/1.2.2/?method=smugmug.images.get&AlbumKey=XYZ&Heavy=true , I am getting
    <rsp stat="fail"><method>smugmug.images.get</method><err code="5" msg="system error"/></rsp>
    
    Any idea why this might be happening ? <img src="https://us.v-cdn.net/6029383/emoji/ne_nau.gif&quot; border="0" alt="" >
  • lildudelildude Registered Users Posts: 70 Big grins
    edited July 28, 2008
    Regression in watermarks.create()
    Looks like we've got some sort of regression in watermarks.create(): it's continually returning error #16 - "invalid data (invalid Dissolve parameter)".

    This occurs regardless of whether a dissolve param is supplied or not.

    As before, I'm using the PHP endpoint.
  • vonwyssvonwyss Registered Users Posts: 2 Beginner grinner
    edited August 13, 2008
    Hi!

    This new API version looks good; however, there seem to be errors in the documentation.

    For instance, in http://wiki.smugmug.net/display/API/smugmug.albums.create+1.2.2, the TemplateID parameter should be AlbumTemplateID (specifying TemplateID simply does not do anything useful and results in galleries with corrupt settings).

    Is there a technical/formal documentation (like a WSDL or something) that would reflect the actual implementation in the system? Right now, there is quite a bit of try/error involved...

    Regards,

    Leo
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited August 14, 2008
    Hey Leo,

    Answers below...
    vonwyss wrote:
    For instance, in http://wiki.smugmug.net/display/API/smugmug.albums.create+1.2.2, the TemplateID parameter should be AlbumTemplateID (specifying TemplateID simply does not do anything useful and results in galleries with corrupt settings).

    That's not actually correct, AlbumTemplateID and TemplateID are two seperate parameters.

    AlbumTemplateID corresponds to an AlbumTemplate holding gallery/album options.

    TemplateID corresponds to the style template used for view the gallery, eg Viewer Controlled, SmugMug, Journal, etc. The full list can be obtained by calling method smugmug.styles.getTemplates.
    vonwyss wrote:
    Is there a technical/formal documentation (like a WSDL or something) that would reflect the actual implementation in the system? Right now, there is quite a bit of try/error involved...

    I'm in the process of implementing something like this for api 1.2.2, which will be used to autogenerate the api documentation. You can see a preview of it here.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • lfoustlfoust Registered Users Posts: 3 Beginner grinner
    edited August 24, 2008
    smugmug.albums.getStats not yet implemented?
    When trying to call smugmug.albums.getStats using the REST endpoint, I am getting the following response:
    <?xml version="1.0" encoding="utf-8"?>
    <rsp stat="fail">
        <method>smugmug.albums.getStats</method>
        <err code="5" msg="system error (Not implemented yet)"/>
    </rsp>
    

    Is this expected?
  • lildudelildude Registered Users Posts: 70 Big grins
    edited August 24, 2008
    lfoust wrote:
    When trying to call smugmug.albums.getStats using the REST endpoint, I am getting the following response:
    <?xml version="1.0" encoding="utf-8"?>
    <rsp stat="fail">
        <method>smugmug.albums.getStats</method>
        <err code="5" msg="system error (Not implemented yet)"/>
    </rsp>
    

    Is this expected?

    Yup. As the very first entry on this topic and the message states, the stats methods have not been implemented in the 1.2.2 API yet :D
  • lfoustlfoust Registered Users Posts: 3 Beginner grinner
    edited August 25, 2008
    lildude wrote:
    Yup. As the very first entry on this topic and the message states, the stats methods have not been implemented in the 1.2.2 API yet :D

    Thanks. I figured I would ask to see if anything had changed since April when this thread was created.
  • mr ignatzmr ignatz Registered Users Posts: 2 Beginner grinner
    edited September 22, 2008
    oauth callback problem?
    is this the right place to ask about oauth problems too? it seemed like 1.2.2 and oauth are linked, so here's my question:

    i am able to get an oauth request token and i can authorize it as well. however in my authorize url, i have a callback specified that is getting ignored.

    i'm sending users to :

    http://api.smugmug.com/services/oauth/authorize.mg?oauth_token=[token omitted]&oauth_callback=http%3A%2%2Fsome.url.here%2Fservices%2Fsmugmug%2Fcallback%2F

    assuming this would redirect successful authorizations to

    http://some.url.here/services/smugmug/callback/?oauth_token=[same token omitted]

    but instead i merely get the confirmation "my app" was added to your Authorized Applications, without the callback.

    while doing some forensics, i noticed that in the headers of my navigation, to http://api.smugmug.com/services/oauth/*

    there is the header "X-Powered-By: smugmug/1.2.0"

    does this mean that i'm not hitting the 1.2.2 api that i'm intending to? there don't seem to be api specific endpoints for the oauth requests, just the rest of the api.

    am i missing something? also, is it possible to set a callback if a user denies/cancels token authorization? i know that's not part of the oauth spec but would be really helpful.
  • lildudelildude Registered Users Posts: 70 Big grins
    edited September 23, 2008
    You're not missing anything
    mr ignatz wrote:
    am i missing something? also, is it possible to set a callback if a user denies/cancels token authorization? i know that's not part of the oauth spec but would be really helpful.

    No, you're not missing anything. The SmugMug API doesn't honour the oauth_callback option as specified via the authorize.mg URL.

    If you want to use the callback functionality, you need to predefine the callback URL in your control panel . See comment #28 in this thread for devbobo's response when I asked the same question
  • mr ignatzmr ignatz Registered Users Posts: 2 Beginner grinner
    edited September 23, 2008
    lildude wrote:
    No, you're not missing anything. The SmugMug API doesn't honour the oauth_callback option as specified via the authorize.mg URL.

    If you want to use the callback functionality, you need to predefine the callback URL in your control panel . See comment #28 in this thread for devbobo's response when I asked the same question

    thanks a bunch!

    one last question (hopefully)--
    a lot of these get methods return a seemingly unbounded result set. is there any way to paginate the results, lets say with a ?max-results=N&offset=X ?
  • lildudelildude Registered Users Posts: 70 Big grins
    edited September 24, 2008
    mr ignatz wrote:
    thanks a bunch!

    one last question (hopefully)--
    a lot of these get methods return a seemingly unbounded result set. is there any way to paginate the results, lets say with a ?max-results=N&offset=X ?

    Unfortunately not.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited September 24, 2008
    mr ignatz wrote:
    thanks a bunch!

    one last question (hopefully)--
    a lot of these get methods return a seemingly unbounded result set. is there any way to paginate the results, lets say with a ?max-results=N&offset=X ?

    Not at the moment, but it's something I have wanted to do for some time.
    David Parry
    SmugMug API Developer
    My Photos
  • chrispatchrispat Registered Users Posts: 7 Beginner grinner
    edited November 20, 2008
    devbobo wrote:
    Not at the moment, but it's something I have wanted to do for some time.

    Even if we didn't have paging it would really be nice to have a way to query against the API. For example I would like to get all albums in a given category or all photos with a given keyword.
  • David PLDavid PL Registered Users Posts: 80 Big grins
    edited February 9, 2009
    devbobo wrote:
    G'day All,

    I am in the processing of implementing OAuth for the API. The first stage of the process was to refactor the API to make it possible to implement OAuth, as part of these changes I have done a lot of optimisation and implemented a few features that people having been asking for. So I am rolling this version out as a soft release, the released and beta api versions aren't going to change at this point as there is still quite a bit of work to complete the OAuth implementation.

    Here's a list of changes in no particular order...
    • ..........
    • ThemeID: ThemeID can now be set for smugmug.albums.create and smugmug.albums.changeSettings, and is returned by smugmug.albums.getInfo and smugmug.albums.get with Heavy=1.
    • ..........
    Hello,

    I came across a small bug with Themes in 1.2.2. Specifically, for albums that have no specific theme set, smugmug.albums.get with Heavy=1 returns ThemeID=0. However, a call to smugmug.themes.get does not return any themes with an ID=0. Based on the listing of returned themes, it appears that the "default" theme has an ID=1. Therefore, it seems that albums with no theme set should have a ThemeID=1.

    Thanks
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited February 9, 2009
    David PL wrote:
    Hello,

    I came across a small bug with Themes in 1.2.2. Specifically, for albums that have no specific theme set, smugmug.albums.get with Heavy=1 returns ThemeID=0. However, a call to smugmug.themes.get does not return any themes with an ID=0. Based on the listing of returned themes, it appears that the "default" theme has an ID=1. Therefore, it seems that albums with no theme set should have a ThemeID=1.

    Thanks

    Hey David,

    yes, I'm aware of this...it's not really an api bug...but I think I will need to put some code in to return ThemeID as 1 if it's set to 0 in the db.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • David PLDavid PL Registered Users Posts: 80 Big grins
    edited February 10, 2009
    LastUpdated Parameter
    devbobo wrote:
    Hey David,

    yes, I'm aware of this...it's not really an api bug...but I think I will need to put some code in to return ThemeID as 1 if it's set to 0 in the db.

    Cheers,

    David

    Great. Thanks.

    As I'm starting to implement some features to use the new functionality of 1.2.2, I've got another question/request:

    The new LastUpdated parameter in smugmug.albums.get to query for only albums after a given date is extremely useful. However, from doing some preliminary testing with this function, it seems the query is solely based on the last date a new photo was uploaded to an album. Other changes to an album (such as changes to Album settings, changes to album category/subcategory, deleting a photo from an album, etc) do not seem to trigger a change in the LastUpdated date. One feature of the software application I am developing displays and allows users to update their album settings. To be able to effectively cache the albums for this application, I am hoping there is a way to use the LastUpdated (or another API parameter) to return all albums that have been changed in any way (including changes to album settings, and changes to album category/subcategory) after the given date. Is there any way that this can be done?

    BTW, the new functions and updates in 1.2.2 are very impressive.

    Thanks for all your help.
  • David PLDavid PL Registered Users Posts: 80 Big grins
    edited February 21, 2009
    Bug - smugmug.albums.changeSettings
    Hello,

    I ran across a bug in 1.2.2 with smugmug.albums.changeSettings. If you pass an empty "Password" parameter to clear the album's password, 1.2.2 ignores it and the current password remains active. This is not an issue in 1.2.0, so it appears to be a new bug in 1.2.2.

    Thanks
  • cutawaycutaway Registered Users Posts: 5 Beginner grinner
    edited March 5, 2009
    The posted code works but if I remove the optional parts (ProductType and ProductID). I get an error ("XML Parsing Error: no element found").

    method=smugmug.propricing.getPortfolio&SessionID=<sessionID>

    I get the same error if I just remove the ProductID parameters.

    I tried this with both the 1.2.1 and 1.2.2 endpoints.

    Any suggestions?
    devbobo wrote:
    it does actually work, but you need to call it like this....

    method=smugmug.propricing.getPortfolio&SessionID=e0d0da5a0bf9808fcc2ffb995392030a&ProductType[]=CommonPrint&ProductType[]=Merchandise&ProductType[]=Downloads&ProductID[]=10040&ProductID[]=10043&ProductID[]=10048
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited March 5, 2009
    cutaway wrote:
    The posted code works but if I remove the optional parts (ProductType and ProductID). I get an error ("XML Parsing Error: no element found").

    method=smugmug.propricing.getPortfolio&SessionID=<sessionID>

    I get the same error if I just remove the ProductID parameters.

    I tried this with both the 1.2.1 and 1.2.2 endpoints.

    Any suggestions?

    Yes, unfortunately recent changes to support Bay photo have broken all my propricing methods and due to the nature of those changes the pro-pricing needs to be rewritten in a different form, which probably won't happen until 1.2.3.
    David Parry
    SmugMug API Developer
    My Photos
  • SurfPunkSurfPunk Registered Users Posts: 1 Beginner grinner
    edited March 23, 2009
    OAuth API complete?
    I am trying to get acclimated to the API and seeing that I already have a framework for OAuth in my application I WAS happy to find implementation listed in documentation. The challenge is which documentation is up to date?

    Anyhow, IS API 1.2.2 officially released? Are all the API methods supported via OAuth now? if Not then when?

    I have made it through the Authentication/Login process, but can't seem to find right method name to call using OAuth for the smugmug.albums.get method. The call return the html stream for SMugMug.com.

    Any guidance or direction?
    Thanks
  • iotashaniotashan Registered Users Posts: 68 Big grins
    edited March 23, 2009
    The calls are identical between OAuth or not, except with OAuth, you can leave off the sessionid parameter. That little tidbit hasn't made it's way into the docs yet.

    Also, 1.2.2 is in beta, as is 1.2.1. They'll make their way out as the 'official' release eventually, but you're pretty safe in using them for whatever you're building.
  • iotashaniotashan Registered Users Posts: 68 Big grins
    edited March 23, 2009
    iotashan wrote:
    The calls are identical between OAuth or not

    Of course, you have to pass all the OAuth parameters and properly sign it, too.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 8, 2009
    iotashan wrote:
    That little tidbit hasn't made it's way into the docs yet.

    headscratch.gif

    http://wiki.smugmug.net/display/API/show+1.2.2?method=smugmug.albums.get
    David Parry
    SmugMug API Developer
    My Photos
Sign In or Register to comment.