Hiding Predefined Categories
GoofyPhotographer
Registered Users Posts: 4 Beginner grinner
Hello,
I understand Smugmug doesn't provide a way to hide their predefined categories. Is there anything I can do at the API level to achieve this?
Thanks
I understand Smugmug doesn't provide a way to hide their predefined categories. Is there anything I can do at the API level to achieve this?
Thanks
0
Comments
None of the API methods return any indication of which are predefined and which are not. However, you can filter these predefined categories out in your program simply by figuring out the CategoryIDs for the predefined categories. I was interested in this same thing, so I went through this and wrote a simple function like this:
Of course if SM adds new predefined categories in the future, you will have to update your code. I don't think they have added any in a couple of years so it doesn't seem that will happen too often.
[/SIZE][/FONT][/SIZE][/FONT]
Thanks a lot, David. I figured any code would need revision from time-to-time, but since I'll have less than 10 categories, this will make life much easier.
Actually, they do now...API 1.2.2 returns a Type parameter.
http://wiki.smugmug.net/display/API/show+1.2.2?method=smugmug.categories.get
Cheers,
David
SmugMug API Developer
My Photos
Very nice. I did not notice that change in that API method. It must be pretty recent because I've been using 1.2.2 for some time now and haven't run across that.
Now looking back at the API functions for this, it looks like the smugmug.users.getTree still doesn't return the Type or the NiceName for each Category like smugmug.categories.get now does. That is the way I usually pull the categories for a user, and it would be very nice if those could be returned for that method as well.
Thanks.
Passing NiceName,Type in Extras should return those parameters (from memory)
SmugMug API Developer
My Photos
Ive noticed when i request type in extras for getTree, i get back "SmugMug" for predefined categories, and nothing for user defined ones.
which API version ? and Type is only returned for Categories, since all SubCategories are user defined.
SmugMug API Developer
My Photos