tk421
Jan-06-2005, 12:07 PM
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);