getAlbumInfo returns null content string. Why?
tk421
Registered Users Posts: 6 Beginner grinner
Hi folks,
I'm trying to write a perl script to access my smugmug account via the XML-RPC API. I have been able to login and get a list of albums, but when I try iterating over the albums calling getAlbumInfo, the response has a null content string. As a result, the XML parser dies.
Any ideas as to why the response would have a blank content string? I would have thought that, had I messed something up, it would return an error string.
I've added the snippet of code, below, up to the point where I get the invalid response. Any feedback you might have is greatly appreciated.
Thanks,
Bryan
use Frontier::Client;
my $url = "https://upload.smugmug.com/xmlrpc/";
my $username = 'INSERT_YOUR_NAME_HERE';
my $password = 'INSERT_YOUR_PASSWORD_HERE';
my $client = Frontier::Client->new(url => $url, debug => 0, );
print "Attempting to log in...\n";
my $result = $client->call('loginWithPassword', $username, $password);
my $SessionID = $result->{SessionID};
print "Session ID is: $SessionID\n";
print "Trying to get albums\n";
my $albums = $client->call('getAlbums', $SessionID);
print "Found ", scalar(@$albums), " album(s)\n";
foreach my $album (@$albums)
{
my $AlbumID = $album->{AlbumID};
print "Looking at album '", $album->{Title}, "' ($AlbumID)\n";
print "Getting album info\n";
my $album_info = $client->call('getAlbumInfo', $SessionID, $AlbumID);
I'm trying to write a perl script to access my smugmug account via the XML-RPC API. I have been able to login and get a list of albums, but when I try iterating over the albums calling getAlbumInfo, the response has a null content string. As a result, the XML parser dies.
Any ideas as to why the response would have a blank content string? I would have thought that, had I messed something up, it would return an error string.
I've added the snippet of code, below, up to the point where I get the invalid response. Any feedback you might have is greatly appreciated.
Thanks,
Bryan
use Frontier::Client;
my $url = "https://upload.smugmug.com/xmlrpc/";
my $username = 'INSERT_YOUR_NAME_HERE';
my $password = 'INSERT_YOUR_PASSWORD_HERE';
my $client = Frontier::Client->new(url => $url, debug => 0, );
print "Attempting to log in...\n";
my $result = $client->call('loginWithPassword', $username, $password);
my $SessionID = $result->{SessionID};
print "Session ID is: $SessionID\n";
print "Trying to get albums\n";
my $albums = $client->call('getAlbums', $SessionID);
print "Found ", scalar(@$albums), " album(s)\n";
foreach my $album (@$albums)
{
my $AlbumID = $album->{AlbumID};
print "Looking at album '", $album->{Title}, "' ($AlbumID)\n";
print "Getting album info\n";
my $album_info = $client->call('getAlbumInfo', $SessionID, $AlbumID);
0
Comments
Incidentally, if I replace the final two lines of:
print "Getting album info\n";
my $album_info = $client->call('getAlbumInfo', $SessionID, $AlbumID);
with
print "Getting image info\n";
my $images = $client->call('getImages', $SessionID, $AlbumID);
I get a fault code 4: invalid user, instead of a blank content line. So, still a problem, but not as harsh.
.. and, frankly speaking, until the initial (very basic and limited) set of API is fixed and brought up to date with all those recently introduced features, I'm not going to..
Just my $.02
Cheers!