How can i detect non-existent/deleted Smugmug objects?
flyingdutchie
Registered Users Posts: 1,286 Major grins
Using Smugmug API 1.2.0, i've been trying to figure out how to detect when a call to a smugmug api function fails because the object is deleted (e.g. album.rename fails because the albumID is not/no longer valid). When specifying an invalid ID, the smugmug response returns an error:
Is it possible to detect if an item (image, album, category, etc...) is not valid on Smugmug, i.e. its ID is not known or has been deleted? The smugmug API responses are not very clear on this ('invalid user' or 'system error' could mean that the object still exists, but something else is wrong).
I ask this, because my SmugFig API has a simple caching mechanism and being able to figure out wether an object is valid on the Smugmug system/server itself is crucial. I could do a 'get' function, but this may be expensive and may not work for images (images.get require an AlbumID parameter; image could have moved and still exist).
Through the [I]rename[/I] function: [B]Categories[/B]: [I]Code = 4: Invalid user[/I] [B]SubCategories[/B]: [I]Code = 4: Invalid user[/I] [B]Albums[/B]: Through the [I]changeSettings[/I] function: [I]Code = 5: system error[/I] or [I]Code = 4: invalid user[/I] Code is 5: when accessing previously deleted album Code is 4: when accessing album that does not exist and never did. Through the [I]getInfo[/I] function when referring to previously deleted album: I get the deleted album back! :scratch [I]Code = 5: (system error) [/I]when accessing album that does not exist and never did [B]Images[/B]: to-do, for a little later.Question:
Is it possible to detect if an item (image, album, category, etc...) is not valid on Smugmug, i.e. its ID is not known or has been deleted? The smugmug API responses are not very clear on this ('invalid user' or 'system error' could mean that the object still exists, but something else is wrong).
I ask this, because my SmugFig API has a simple caching mechanism and being able to figure out wether an object is valid on the Smugmug system/server itself is crucial. I could do a 'get' function, but this may be expensive and may not work for images (images.get require an AlbumID parameter; image could have moved and still exist).
I can't grasp the notion of time.
When I hear the earth will melt into the sun,
in two billion years,
all I can think is:
"Will that be on a Monday?"
==========================
http://www.streetsofboston.com
http://blog.antonspaans.com
When I hear the earth will melt into the sun,
in two billion years,
all I can think is:
"Will that be on a Monday?"
==========================
http://www.streetsofboston.com
http://blog.antonspaans.com
0
Comments
(bump)
When I hear the earth will melt into the sun,
in two billion years,
all I can think is:
"Will that be on a Monday?"
==========================
http://www.streetsofboston.com
http://blog.antonspaans.com
yeah, I was actually thinking about this issue the other day when I was looking into the other issue you raised about returning valid results for deleted images.
I will look into this, when I get a chance.
CHeers,
David
SmugMug API Developer
My Photos
Thank you David,
I know you have a lot of work on your hand. Just let me know when you get some time to look into this.:D
Just 1 response for this "Deleted or if the object was not really deleted, but not/no-longer available for the given user (based on log-in creds&nickname)" is good enough, i think. Maybe this is a little easier to implement...? As long as the error code (or message) is consistent among all the smugmug objects and their functions.
When I hear the earth will melt into the sun,
in two billion years,
all I can think is:
"Will that be on a Monday?"
==========================
http://www.streetsofboston.com
http://blog.antonspaans.com
David, correct me if I'm wrong, but I think you fixed all these issues with the current dev build of the API right?
Should be deployed live soon with all these fixes and a ton more cleanups/fixes.
Yay David!
kallasoft | The "Break It Down" Blog
i don't believe that the changes fix Anton's situation, but whatever the case...those changes are live.
SmugMug API Developer
My Photos