API smugmug.users.getTree & APIs in general

mhilbushmhilbush Registered Users Posts: 70 Big grins
I am finding that this API does not return what I expect. For some reason, it returns the complete set of albums under each and every category, irrespective of whether those categories have subcategories and/or albums. Is this the correct behavior?

And, more generally, I realize the above api is in "beta", but it appears to have been in beta for quite some time. Are these apis undergoing active development and/or defect fixes?

BTW, I am working on a script to integrate my IMatch image management system with Smugmug.

Thanks,
Mark

[Edit] One clarification, it looks like it is including the albums from other categories only when those albums are directly under another category. If the albums are in other subcategories, they are not included.
Mark

Comments

  • mhilbushmhilbush Registered Users Posts: 70 Big grins
    edited August 13, 2006
    Here's a snippet from the xml doc. Note that the category "Airplanes" does not contain either of those two albums. And, those two albums appear in each and every category returned in the xml doc. I had to replace the angle brackets with parens since I can't figure out how to make it appear correctly...
    <category id="41">(Category id="41")
    (Title)Airplanes(/Title)
    (Albums)
    (Album id="1745431")
    (Title)BMW Club Race at Summit Point (8/5/06)(/Title)
    (/Album)
    (Album id="1480198")
    (Title)NOPI Xbox Drag Race at MIR (5/21/06)(/Title)
    (/Album)
    (/Albums)
    (/Category)<albums><album id="1745431"></album><album id="1480198"></album></albums></category>
    Mark
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited August 13, 2006
    Hi Mark,

    Unfortunately, I don't have much experience with this function. It was introduced after I had already written some code for building tree structures using different API calls.

    Anyway, hopefully Don or someone else might drop by who has more experience with this call.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • claudermilkclaudermilk Registered Users Posts: 2,756 Major grins
    edited August 14, 2006
    I'll be interested in the answer as well (it's my fault he's asking...)
  • mhilbushmhilbush Registered Users Posts: 70 Big grins
    edited August 14, 2006
    I'll be interested in the answer as well (it's my fault he's asking...)

    Yes, it certainly is your fault! :D

    Since this API didn't work, I figured I try the create/delete category/subcategory APIs. Well, it looks like they don't work either.

    What's up with these APIs? Are you supposed to find out which ones work and don't work by trial and error???

    Mark
    Mark
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited August 14, 2006
    mhilbush wrote:
    Yes, it certainly is your fault! :D

    Since this API didn't work, I figured I try the create/delete category/subcategory APIs. Well, it looks like they don't work either.

    What's up with these APIs? Are you supposed to find out which ones work and don't work by trial and error???

    Mark

    Mark,

    I know that you're probably frustrated, but just saying it doesn't work really doesn't give someone anything to go by. How about posting the xml response that you are getting.

    below is a list of SM functions that i know work fine from my own experience...

    smugmug.login.withPassword
    smugmug.login.withHash
    smugmug.login.anonymously
    smugmug.logout
    smugmug.accounts.getType
    smugmug.albums.get
    smugmug.albums.getInfo
    smugmug.albums.create
    smugmug.albumtemplates.get
    smugmug.images.get
    smugmug.images.getURLs
    smugmug.images.getInfo
    smugmug.images.getEXIF
    smugmug.categories.get
    smugmug.subcategories.get


    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • mhilbushmhilbush Registered Users Posts: 70 Big grins
    edited August 15, 2006
    devbobo wrote:
    How about posting the xml response that you are getting.
    No need to post. It's already been covered over a year ago in the following posts.

    Here:
    http://www.dgrin.com/showthread.php?t=11401

    And here:
    http://www.dgrin.com/showthread.php?t=10982

    Had I searched on the category & subcategory create APIs first, I might've saved myself some time. Lesson learned.

    Yes, I've had good experience with some of the APIs, and that's great. In fact, I've used most of the ones you've listed with great success.
    Mark
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited August 15, 2006
    Have you implemented "upload via post" by any chance ?

    The reason I ask, if you really need the functionality for create/modify/delete category/subcategories....it is possible to reverse engineer the current web utilities as a means to an end.

    Myself and Nikolai did this for a few features that didn't exist in the API at the time.

    Just an idea :D

    So what u working on ? And how did claudermilk get u into it ?

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • claudermilkclaudermilk Registered Users Posts: 2,756 Major grins
    edited August 15, 2006
    I'm in this as a fellow IMatch user & PITA user of his script. :D I've actually been pondering a Smugmug-IMatch link in the IMatch scripting engine since signing up here, but have not had the time for various reasons...so I'm just going to prod Mark with annoying enhancement suggestions to get what I want.mwink.gif I hope to learn a bit about the API through osmosis watching here.
  • mhilbushmhilbush Registered Users Posts: 70 Big grins
    edited August 15, 2006
    devbobo wrote:
    Have you implemented "upload via post" by any chance ?
    Yes, I implemented "upload via post" for the image upload. And, I did see the discussion in this forum about going straight to the web utilities for creating/deleting cats & subcats. I may have to go this way, as it looks like the APIs are not getting much attention anymore. I hate the idea of screen-scraping, but that may be the only way.

    devbobo wrote:
    So what u working on ? And how did claudermilk get u into it?
    I'm working on a script to integrate my image management tool, IMatch, with Smugmug. Basically, I wanted a way to upload images from an IMatch category, folder, or selection result set into an album on Smugmug. I wanted the ability to use an existing album, or to create a new album based on an existing album template or on user-defined properties.

    All the above functionality is working, so I was looking to add some more goodies, such as the ability to manage categories and subcategories. I also was toying with the idea of replicating the Smugmug category/subcategory/album tree as a category hierarchy in IMatch, which is where I ran into the issue with the getTree API.

    Thanks for all your advice, devbobo. It's been very helpful.
    Mark
  • mhilbushmhilbush Registered Users Posts: 70 Big grins
    edited August 15, 2006
    I'm in this as a fellow IMatch user & PITA user of his script. :D I've actually been pondering a Smugmug-IMatch link in the IMatch scripting engine since signing up here, but have not had the time for various reasons...
    Dude. You are on every forum I read - DGrin, Bibble, IMatch, FM. I think I now understand the "various reasons" why you have no time. :D:D
    Mark
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited August 15, 2006
    Mark,

    I use the function smugmug.albums.get, it returns category/ category ID for each album along with subcategory/subcategory ID (where applicable).

    I iterate the results and build a tree structure manually. It's a little bit tedious to write and debug...but the code still works.

    Perhaps this is something you could try since smugmug.users.getTree isn't working.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • claudermilkclaudermilk Registered Users Posts: 2,756 Major grins
    edited August 16, 2006
    mhilbush wrote:
    Dude. You are on every forum I read - DGrin, Bibble, IMatch, FM. I think I now understand the "various reasons" why you have no time. :D:D

    rolleyes1.gif

    ne_nau.gif So I like keeping up on the tools I use. Ok, like it used to say at IMatch, I'm an addict... Seriously, take a look at my Dance galleries here, that should really explain it--I'm getting some recognition from local dancers & do a lot of shooting now "hey, I'm doing this show, you wanna photograph it?" "umm...duh?" (thus my db growing from 15k images to over 70k images in a year). Now that I have several technical issues resolved, I should be able to get caught up on postprocessing, then there's some play time available again--oh, and after October the hot rod build wil be complete freeing more time.
  • mhilbushmhilbush Registered Users Posts: 70 Big grins
    edited August 20, 2006
    devbobo wrote:
    I use the function smugmug.albums.get, it returns category/ category ID for each album along with subcategory/subcategory ID (where applicable).

    I iterate the results and build a tree structure manually. It's a little bit tedious to write and debug...but the code still works.

    Good suggestion, David. That approach will work just fine!

    I also tried the POST implementation to create categories and subcategories -- works just fine. I found the category delete REST API to work fine, but the subcategory delete REST API seems to have problems, so that had to be handled just like create.

    Perhaps someone from Smugmug can weigh in on when/if these broken APIs will get some attention.

    Mark
    Mark
Sign In or Register to comment.