API 1.2.2 (soft release)

devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
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...
  • Pretty mode: Adding &Pretty=1 to the request returns readable json responses.
  • Boolean parameters: Boolean parameters can now be sent as either 0|1 or true|false.
  • Strict mode: A number of people complained about calls like smugmug.albums.get returning an error response when there are no albums. By default now, empty elements (albums, images, subcats, watermarks, etc) are returned. To invoke an error like previously, add &Strict=1 to the request. This feature also works for methods like smugmug.albums.changeSettings where saving the same parameters resulted in an error.
  • 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.
  • Build your own heavy response: I have had a ton of requests by different people to add different bits and pieces to the standard non-heavy response for methods like smugmug.albums.get, smugmug.users.getTree or smugmug.images.get. I have added a new feature that lets you build your own heavy response and only return the info you want. To do this add &Extras to your requests and then comma-seperate the additional parameters you want returned.
eg. ....method=smugmug.albums.get&Extras=LastUpdated,Geography
  • Previously, a number of parameters returned by smugmug.images.getInfo or smugmug.albums.getInfo were returned only for the owner scope. However, a number of these parameters were able to be determined by a logged out user of the site. As a result, what is returned now by those methods is more in line with what is available on the site.
Caveats:
  • Stats methods: I haven't had a chance to rewrite the Stats methods yet, so they currenly return "System Error (Not Implemented yet)".
  • Image/Album Key: This version of the API has the stage 3 security features implemented.
I imagine there are going to be some bugs, just let me know.

Cheers,

David
David Parry
SmugMug API Developer
My Photos
«13

Comments

  • AdamNAdamN Registered Users Posts: 18 Big grins
    edited April 12, 2008
    Niiice!!!
    Wow, this is a real improvment! I can't wait (and won't) to start testing this! rolleyes1.gif
  • David PLDavid PL Registered Users Posts: 80 Big grins
    edited April 12, 2008
    devbobo wrote:
    G'day All,

    <snip>

    Build your own heavy response: I have had a ton of requests by different people to add different bits and pieces to the standard non-heavy response for methods like smugmug.albums.get, smugmug.users.getTree or smugmug.images.get. I have added a new feature that lets you build your own heavy response and only return the info you want. To do this add &Extras to your requests and then comma-seperate the additional parameters you want returned.

    Previously, a number of parameters returned by smugmug.images.getInfo or smugmug.albums.getInfo were returned only for the owner scope. However, a number of these parameters were able to be determined by a logged out user of the site. As a result, what is returned now by those methods is more in line with what is available on the site.

    <snip>

    This sounds great. Thanks for implementing our requests.

    Does version 1.2.2 also have all of the methods listed in the 1.2.1 wiki implemented?: http://wiki.smugmug.com/display/SmugMug/1.2.1

    Thanks for all your work on this
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 12, 2008
    David PL wrote:
    This sounds great. Thanks for implementing our requests.

    Does version 1.2.2 also have all of the methods listed in the 1.2.1 wiki implemented?: http://wiki.smugmug.com/display/SmugMug/1.2.1

    Thanks for all your work on this

    David,

    yes, except for all the communitiy methods (i believe)
    David Parry
    SmugMug API Developer
    My Photos
  • dounddound Registered Users Posts: 72 Big grins
    edited April 13, 2008
    devbobo wrote:
    G'day All,
    • Boolean parameters
    • Strict mode
    • Build your own heavy response

    Great! These new features and flexibility are a nice improvement. Thanks! thumb.gif
  • iotashaniotashan Registered Users Posts: 68 Big grins
    edited April 14, 2008
    Dumb question... pretty and strict... do they accept true/false and 1/0 ?

    Shan
  • AdamNAdamN Registered Users Posts: 18 Big grins
    edited April 14, 2008
    Bugs...
    Hi!
    The smugmug.friend.get method returns this:
    {"stat":"fail","code":3,"message":"invalid session"}

    after this request (JSON):
    method=smugmug.friends.get&SessionID=

    The sessionID is just fine as I can add a friend w/o a hitch.
    (using the 1.2.2 endpoint)

    &&

    In the watermark struct returned by watermarks.get the variable dissolve is returned as a string, maybe it should be returned as an int?
    (JSON 1.2.2)

    &&

    The dgrinn documentation for watermak.create is wrong. int Dissolved should be int Dissolve

    /Adam
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 14, 2008
    iotashan wrote:
    Dumb question... pretty and strict... do they accept true/false and 1/0 ?

    Shan

    yes
    David Parry
    SmugMug API Developer
    My Photos
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 14, 2008
    AdamN wrote:
    The smugmug.friend.get method returns this:
    {"stat":"fail","code":3,"message":"invalid session"}

    fix internally

    AdamN wrote:
    In the watermark struct returned by watermarks.get the variable dissolve is returned as a string, maybe it should be returned as an int?
    (JSON 1.2.2)

    yes, fixed internally
    AdamN wrote:
    The dgrinn documentation for watermak.create is wrong. int Dissolved should be int Dissolve

    changed

    Thanks thumb.gif
    David Parry
    SmugMug API Developer
    My Photos
  • AdamNAdamN Registered Users Posts: 18 Big grins
    edited April 16, 2008
    Todays crop...
    Ok, here goes:

    Sharegroups.getInfo, create, results in "The remote server returned an error: (500) Internal Server Error"

    Alsos theres a "waterwark" typo in smugmug.images.removeWaterwark
    /Adam
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 16, 2008
    AdamN wrote:
    Ok, here goes:

    Sharegroups.getInfo, create, results in "The remote server returned an error: (500) Internal Server Error"

    Alsos theres a "waterwark" typo in smugmug.images.removeWaterwark
    /Adam

    fixed (internally) and fixed thumb.gif
    David Parry
    SmugMug API Developer
    My Photos
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 17, 2008
    the above bug fixes should be live now thumb.gif
    David Parry
    SmugMug API Developer
    My Photos
  • DrDavidDrDavid Registered Users Posts: 1,292 Major grins
    edited April 18, 2008
    devbobo wrote:
    • 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.
    How do you determine what the themeID is for a particular theme?

    David
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 18, 2008
    DrDavid wrote:
    How do you determine what the themeID is for a particular theme?

    David

    call smugmug.themes.get thumb.gif
    David Parry
    SmugMug API Developer
    My Photos
  • AdamNAdamN Registered Users Posts: 18 Big grins
    edited April 18, 2008
    devbobo wrote:
    the above bug fixes should be live now thumb.gif

    Sweet! clap.gif
  • AdamNAdamN Registered Users Posts: 18 Big grins
    edited April 18, 2008
    Another day, anoter bug to be squashed :-)
    Ok...
    Here goes!
    smugmug.propricing.getPortfolio getAlbum, getImage w/o any optionals works just fine, but with a call like this:
    "method=smugmug.propricing.getPortfolio&SessionID=e0d0da5a0bf9808fcc2ffb995392030a&ProductType=[\"CommonPrint\",\"Merchandise\",\"Download\"]"
    you get an answer like this:
    "{\"stat\":\"ok\",\"method\":\"smugmug.propricing.getPortfolio\"}" which is not as bad as an internal 500 but not quite as good as an array of products... :D
    If you call it like this:
    "method=smugmug.propricing.getPortfolio&SessionID=e0d0da5a0bf9808fcc2ffb995392030a&ProductID=[10040,10043,10048]"
    or like this:
    method=smugmug.propricing.getPortfolio&SessionID=e0d0da5a0bf9808fcc2ffb995392030a&ProductType=[\"CommonPrint\",\"Merchandise\",\"Download\"]&ProductID=[10040,10043,10048]""
    you get this:
    {\"stat\":\"fail\",\"code\":16,\"message\":\"invalid data (no custom portfolio pricing set)\"}"
    Which is not true...

    Also a question.
    The logout method returns an error when trying to logout a anonymous session. I understand the logic behind that but isn't actually good manners to tell the server that a session is to be considred expired instead of waiting for the session to timeout and die?
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 18, 2008
    AdamN wrote:
    Ok...
    Here goes!
    smugmug.propricing.getPortfolio getAlbum, getImage w/o any optionals works just fine, but with a call like this:
    "method=smugmug.propricing.getPortfolio&SessionID=e0d0da5a0bf9808fcc2ffb995392030a&ProductType=[\"CommonPrint\",\"Merchandise\",\"Download\"]"
    you get an answer like this:
    "{\"stat\":\"ok\",\"method\":\"smugmug.propricing.getPortfolio\"}" which is not as bad as an internal 500 but not quite as good as an array of products... :D
    If you call it like this:
    "method=smugmug.propricing.getPortfolio&SessionID=e0d0da5a0bf9808fcc2ffb995392030a&ProductID=[10040,10043,10048]"
    or like this:
    method=smugmug.propricing.getPortfolio&SessionID=e0d0da5a0bf9808fcc2ffb995392030a&ProductType=[\"CommonPrint\",\"Merchandise\",\"Download\"]&ProductID=[10040,10043,10048]""
    you get this:
    {\"stat\":\"fail\",\"code\":16,\"message\":\"invalid data (no custom portfolio pricing set)\"}"
    Which is not true...

    Also a question.
    The logout method returns an error when trying to logout a anonymous session. I understand the logic behind that but isn't actually good manners to tell the server that a session is to be considred expired instead of waiting for the session to timeout and die?

    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
    David Parry
    SmugMug API Developer
    My Photos
  • AdamNAdamN Registered Users Posts: 18 Big grins
    edited April 19, 2008
    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

    Ok! Are you going to fix it to be more JSON-like, or is this how it should look?headscratch.gif

    /Adam
  • lildudelildude Registered Users Posts: 70 Big grins
    edited May 25, 2008
    1.2.2's anonymous albums.get() doesn't return same info as older revs
    I've just noticed that the 1.2.2 albums.get() for anonymous calls don't return the same information as say earlier revs, eg 1.2.1.

    I'm using the PHP endpoint.

    eg. 1.2.1 anonymous albums.get(Heavy=FALSE):
    Array
    (
        [0] => Array
            (
                [id] => 4644971
                [Key] => vwxmf
                [Title] => Photo of the Week
                [Category] => Array
                    (
                        [id] => 0
                        [Name] => Other
                    )
    
                [ImageCount] => 5
                [Public] => 1
                [Passworded] => 
            )
    
        [1] => Array
    [...]
    

    eg. 1.2.2 anonymous albums.get(Heavy=FALSE):
    Array
    (
        [0] => Array
            (
                [id] => 4644971
                [Key] => vwxmf
                [Category] => Array
                    (
                        [id] => 0
                        [Name] => Other
                    )
    
            )
    
        [1] => Array
    [...]
    

    In fact, even using Heavy=TRUE doesn't return the album Title when logged in anonymously.

    I've not tested any other methods yet, but as soon as I notice more diffs, I'll let you know.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited May 25, 2008
    headscratch.gif

    something odd there...i'll check it out.
    lildude wrote:
    I've just noticed that the 1.2.2 albums.get() for anonymous calls don't return the same information as say earlier revs, eg 1.2.1.

    I'm using the PHP endpoint.

    eg. 1.2.1 anonymous albums.get(Heavy=FALSE):
    Array
    (
        [0] => Array
            (
                [id] => 4644971
                [Key] => vwxmf
                [Title] => Photo of the Week
                [Category] => Array
                    (
                        [id] => 0
                        [Name] => Other
                    )
    
                [ImageCount] => 5
                [Public] => 1
                [Passworded] => 
            )
    
        [1] => Array
    [...]
    
    eg. 1.2.2 anonymous albums.get(Heavy=FALSE):
    Array
    (
        [0] => Array
            (
                [id] => 4644971
                [Key] => vwxmf
                [Category] => Array
                    (
                        [id] => 0
                        [Name] => Other
                    )
    
            )
    
        [1] => Array
    [...]
    
    In fact, even using Heavy=TRUE doesn't return the album Title when logged in anonymously.

    I've not tested any other methods yet, but as soon as I notice more diffs, I'll let you know.
    David Parry
    SmugMug API Developer
    My Photos
  • jwalkerohjwalkeroh Registered Users Posts: 165 Major grins
    edited May 27, 2008
    Wiki API info seems to be missing
    Trying to find the API documentation in the Wiki, and it seems to be missing.
  • iotashaniotashan Registered Users Posts: 68 Big grins
    edited May 27, 2008
    jwalkeroh wrote:
    Trying to find the API documentation in the Wiki, and it seems to be missing.

    http://wiki.smugmug.com/display/API/API+1.2.2
  • jwalkerohjwalkeroh Registered Users Posts: 165 Major grins
    edited May 27, 2008
    iotashan wrote:

    That's interesting, and it certainly does take you to the 1.2.2 API, but from the main Wiki page at
    http://wiki.smugmug.com/display/SmugMug/Home
    there does not seem to be any way to get to the API documentation. It looks like it may be broken.
  • iotashaniotashan Registered Users Posts: 68 Big grins
    edited May 27, 2008
    jwalkeroh wrote:
    That's interesting, and it certainly does take you to the 1.2.2 API, but from the main Wiki page at
    http://wiki.smugmug.com/display/SmugMug/Home
    there does not seem to be any way to get to the API documentation. It looks like it may be broken.

    Yeah, Mr. devbobo is working on the new API documentation, along with the new API itself, amongst other things. I'm sure he'll fix it as soon as he can :D

    I only provided the 1.2.2 docs since this is a 1.2.2 thread. The other docs are also easily found if you use the search box.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited May 28, 2008
    jwalkeroh wrote:
    That's interesting, and it certainly does take you to the 1.2.2 API, but from the main Wiki page at
    http://wiki.smugmug.com/display/SmugMug/Home
    there does not seem to be any way to get to the API documentation. It looks like it may be broken.

    someone pwned some of our wiki pages. Should be working again now.
    David Parry
    SmugMug API Developer
    My Photos
  • jwalkerohjwalkeroh Registered Users Posts: 165 Major grins
    edited May 28, 2008
    devbobo wrote:
    someone pwned some of our wiki pages. Should be working again now.

    Now when I click API from
    http://wiki.smugmug.net/display/SmugMug/Home
    it does seem to take me to the API wiki,
    but the "General information, tutorials, documentation and more!" link still seems broken/confused.
    Hope this helps.


    And now the "General info..." link points to the API wiki also. Thanks for fixing.
  • lildudelildude Registered Users Posts: 70 Big grins
    edited June 3, 2008
    devbobo wrote:
    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...

    Is the 1.2.2 API going to implement the oauth_callback functionality at some time in the future?

    It doesn't appear to right now and this would really help streamline the whole access/authorisation process for application developers.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited June 3, 2008
    lildude wrote:
    Is the 1.2.2 API going to implement the oauth_callback functionality at some time in the future?

    It doesn't appear to right now and this would really help streamline the whole access/authorisation process for application developers.

    Hey Colin,

    In your control panel in the API Keys section, if you select 'change' you can set the oauth_callback_url. At this point, we aren't allowing the oauth_callback_url to be passed in authorize request.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • lildudelildude Registered Users Posts: 70 Big grins
    edited June 4, 2008
    Thanks David
  • DrDavidDrDavid Registered Users Posts: 1,292 Major grins
    edited June 8, 2008
    Any chance of implementing a Thumbnail Re-Gen option to automate moving to square thumbs?

    David
  • lildudelildude Registered Users Posts: 70 Big grins
    edited June 12, 2008
    BUG: watermarks.create no longer returns watermark ID.
    Hi David

    Looks like watermarks.create no longer returns the watermark ID on success when using the PHP endpoint (I've not tested others):

    1.2.1 Endpoint:
    Array
    (
        [stat] => ok
        [method] => smugmug.watermarks.create
        [Watermark] => Array
            (
                [id] => 44135
            )
    
    )
    


    1.2.2. Endpoint:
    Array
    (
        [stat] => ok
        [method] => smugmug.watermarks.create
    )
    
Sign In or Register to comment.