API method requests
TazzyTazzy
Registered Users Posts: 32 Big grins
I have alot of ideas, but for now, I'm requesting two simple API methods. :lynnma
1) Random images
smugmug.images.getRandom
Arguments:
SessionID - Required
Number of images - Optional, default of say ~5
Results:
Array of ImageIDs
Purpose: Get random images from smugmug.
Reason this should be in API: To get truely random images, you need to first get all album ID's, then a list of all ImageID within each album id. There could be several hundred API requests. Not to mention, several KB of data transfer for a list of all images within a smugmug gallery.
This method would be simple to implement on smugmug's side. I don't know your database tables, but a simple query would fullfill this request and minimize data transfer between the API and remote app. Keep in mind the following code has no security/sanity checking. Just example only..
if ($API_REQUEST == 0) {
$limit = 5;
} else {
$limit = $API_REQUEST;
}
$userID = $sessionID; // getting userid from the API session
$query = "select imageID FROM smugmug.images WHERE userID = '$userID' ORDER BY RAND() LIMIT $limit"
return mysql_query($query);
2) Last XX images uploaded
smugmug.images.getLast
Arguments:
SessionID - Required
Number of images - Optional, default of say ~5
Results:
Array of ImageIDs
Purpose: Get latest images uploaded to smugmug.
Reason this should be in API: To get a list of the last images uploaded, you need to first get all album ID's, then a list of all ImageID within each album id. There could be several hundred API requests. Not to mention, several KB of data transfer for a list of all images within a smugmug gallery.
This method would be simple to implement on smugmug's side. I don't know your database tables, but a simple query would fullfill this request and minimize data transfer between the API and remote app. Keep in mind the following code has no security/sanity checking. Just example only..
if ($API_REQUEST == 0) {
$limit = 5;
} else {
$limit = $API_REQUEST;
}
$userID = $sessionID; // getting userid from the API session
$query = "select imageID FROM smugmug.images WHERE userID = '$userID' ORDER BY imageUploadStamp LIMIT $limit"
return mysql_query($query);
As you can see, these two API functions would be nearly identical to each other, and should be fairly easy to implement. :thumb
Thoughts?
1) Random images
smugmug.images.getRandom
Arguments:
SessionID - Required
Number of images - Optional, default of say ~5
Results:
Array of ImageIDs
Purpose: Get random images from smugmug.
Reason this should be in API: To get truely random images, you need to first get all album ID's, then a list of all ImageID within each album id. There could be several hundred API requests. Not to mention, several KB of data transfer for a list of all images within a smugmug gallery.
This method would be simple to implement on smugmug's side. I don't know your database tables, but a simple query would fullfill this request and minimize data transfer between the API and remote app. Keep in mind the following code has no security/sanity checking. Just example only..
if ($API_REQUEST == 0) {
$limit = 5;
} else {
$limit = $API_REQUEST;
}
$userID = $sessionID; // getting userid from the API session
$query = "select imageID FROM smugmug.images WHERE userID = '$userID' ORDER BY RAND() LIMIT $limit"
return mysql_query($query);
2) Last XX images uploaded
smugmug.images.getLast
Arguments:
SessionID - Required
Number of images - Optional, default of say ~5
Results:
Array of ImageIDs
Purpose: Get latest images uploaded to smugmug.
Reason this should be in API: To get a list of the last images uploaded, you need to first get all album ID's, then a list of all ImageID within each album id. There could be several hundred API requests. Not to mention, several KB of data transfer for a list of all images within a smugmug gallery.
This method would be simple to implement on smugmug's side. I don't know your database tables, but a simple query would fullfill this request and minimize data transfer between the API and remote app. Keep in mind the following code has no security/sanity checking. Just example only..
if ($API_REQUEST == 0) {
$limit = 5;
} else {
$limit = $API_REQUEST;
}
$userID = $sessionID; // getting userid from the API session
$query = "select imageID FROM smugmug.images WHERE userID = '$userID' ORDER BY imageUploadStamp LIMIT $limit"
return mysql_query($query);
As you can see, these two API functions would be nearly identical to each other, and should be fairly easy to implement. :thumb
Thoughts?
0
Comments
Have you thought about using the RSS/Atom feeds ?
You should be able to get the latest uploaded photos from there.
I know it would be nice to have an API method for this, but in all honesty there haven't been work done on the API on a long while....so I wouldn't hold my breath.
Cheers,
David
SmugMug API Developer
My Photos