Invalid API key

dwagnerdwagner Registered Users Posts: 3 Beginner grinner
I am having issues with the smugmug.albums.getInfo and the smugmug.logout methods in both 1.1.1 and 1.2.0 of the REST API. They both return code 18: invalid API key.

However, smugmug.albums.get works just fine. They are all using the same global variable containing the same API key.

Any ideas?

Comments

  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 13, 2007
    Hi dwagner,

    I have just verified both methods work fine for me. Can you please recheck these issues.

    We pushed a new version of the API tonight, the smugmug.logout issue was fixed.

    Did these issues just start occuring ?

    Thanks,

    David
    dwagner wrote:
    I am having issues with the smugmug.albums.getInfo and the smugmug.logout methods in both 1.1.1 and 1.2.0 of the REST API. They both return code 18: invalid API key.

    However, smugmug.albums.get works just fine. They are all using the same global variable containing the same API key.

    Any ideas?
    David Parry
    SmugMug API Developer
    My Photos
  • dwagnerdwagner Registered Users Posts: 3 Beginner grinner
    edited April 13, 2007
    devbobo wrote:
    I have just verified both methods work fine for me. Can you please recheck these issues.

    We pushed a new version of the API tonight, the smugmug.logout issue was fixed.

    Did these issues just start occuring?
    The smugmug.logout was previously broken and still is for me (I knew from forum searches this was an issue). I can't speak to the smugmug.albums.getInfo method before today. I've just started working with the API...

    Here are snippets of my code (perl code):

    This returns the expected XML response:
    my $url = "http://api.smugmug.com/hack/rest/1.1.1/?method=smugmug.albums.get&SessionID=$sessionid&APIKey=$apikey";
    my $response = $session->get($url);
    die "Couldn't get $url" unless $response->is_success;
    
    This returns an Invalid API Key XML response:
    my $url = "http://api.smugmug.com/hack/rest/1.1.1/?method=smugmug.albums.getInfo&SessionID=$sessionid&AlbumID=$albumid&APIKey=$apikey";
    my $response = $session->get($url);
    die "Couldn't get $url" unless $response->is_success;
    
    Both are done after a succesful call to smugmug.login.withPassword. $apikey is a global variable. I've tested this with the 1.2.0 API as well.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 13, 2007
    smugmug.logout with REST 1.1.1 is still broken, I forgot to commit one of my files <img src="https://us.v-cdn.net/6029383/emoji/rolleyes1.gif&quot; border="0" alt="" >

    However, smugmug.logout with REST 1.2.0 should be working, here's some debug output from my perl test framework I am developing...

    # INFO: smugmug.logout (REST 1.2.0)
    # call => smugmug.login.withPassword (EmailAddress => 'api-power', Password => 'removed<removed password="">', APIKey => '</removed>removed<removed password="">'<removed api="" key="">)
    {
    AccountType => "Power",
    PasswordHash => "removed<removed passwordhash="">",
    SessionID => "<removed session=""></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session="">",
    UserID => 140089,
    }
    #
    # call => smugmug.logout (SessionID => '<removed session=""></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session="">', APIKey => '<removed api="" key=""></removed></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session=""><removed api="" key="">')
    # {
    # Logout => { Successful => "" },
    # method => "smugmug.logout",
    # "stat" => "ok",
    # }
    #
    ok 9 - test: smugmug.logout with password session (REST 1.2.0)
    #
    # call => smugmug.logout (SessionID => '</removed></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session=""><removed api="" key=""><removed session="">', APIKey => '</removed></removed></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session=""><removed api="" key=""><removed session=""><removed api="" key="">')
    # { code => 3, msg => "invalid session" }
    #
    ok 10 - test: smugmug.logout with invalid password session (REST 1.2.0)
    ok 11 - check: correct error code [3] (REST 1.2.0)
    ok 12 - check: correct error message [invalid session] (REST 1.2.0)
    #
    # call => smugmug.login.withHash (UserID => '140089', PasswordHash => '<removed passwordhash=""></removed></removed></removed></removed></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session=""><removed api="" key=""><removed session=""><removed api="" key=""><removed passwordhash="">', APIKey => '<removed api="" key=""></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session=""><removed api="" key=""><removed session=""><removed api="" key=""><removed passwordhash=""><removed api="" key="">')
    # {
    # AccountType => "Power",
    # SessionID => "</removed></removed></removed></removed></removed></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session=""><removed api="" key=""><removed session=""><removed api="" key=""><removed passwordhash=""><removed api="" key=""><removed session="">",
    # }
    #
    # call => smugmug.logout (SessionID => '<removed session=""></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session=""><removed api="" key=""><removed session=""><removed api="" key=""><removed passwordhash=""><removed api="" key=""><removed session=""><removed session="">', APIKey => '<removed api="" key=""></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session=""><removed api="" key=""><removed session=""><removed api="" key=""><removed passwordhash=""><removed api="" key=""><removed session=""><removed session=""><removed api="" key="">')
    # {
    # Logout => { Successful => "" },
    # method => "smugmug.logout",
    # "stat" => "ok",
    # }
    #
    ok 13 - test: smugmug.logout with hashed session (REST 1.2.0)
    #
    # call => smugmug.logout (SessionID => '<removed session=""></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session=""><removed api="" key=""><removed session=""><removed api="" key=""><removed passwordhash=""><removed api="" key=""><removed session=""><removed session=""><removed api="" key=""><removed session="">', APIKey => '</removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed>removed<removed password=""><removed api="" key=""><removed passwordhash=""><removed session=""><removed session=""><removed api="" key=""><removed session=""><removed api="" key=""><removed passwordhash=""><removed api="" key=""><removed session=""><removed session=""><removed api="" key=""><removed session=""><removed api="" key="">')
    # { code => 3, msg => "invalid session" }
    #
    ok 14 - test: smugmug.logout with invalid hashed session (REST 1.2.0)
    ok 15 - check: correct error code [3] (REST 1.2.0)
    ok 16 - check: correct error message [invalid session] (REST 1.2.0)</removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed></removed>
    David Parry
    SmugMug API Developer
    My Photos
  • dwagnerdwagner Registered Users Posts: 3 Beginner grinner
    edited April 13, 2007
    OK, I'm stupid. I wasn't defining all the variables in the URL correctly. The API Key was valid, but other parts of the URL were not. And the 1.2.0 smugmug.logout is working for me too, now.

    I'm adding some sanity checks to my URLs.

    Thanks for the quick response!! Sorry to waste your time.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 13, 2007
    dwagner wrote:
    OK, I'm stupid. I wasn't defining all the variables in the URL correctly. The API Key was valid, but other parts of the URL were not. And the 1.2.0 smugmug.logout is working for me too, now.

    I'm adding some sanity checks to my URLs.

    Thanks for the quick response!! Sorry to waste your time.

    :D that's ok...you had me worried for a minute
    David Parry
    SmugMug API Developer
    My Photos
Sign In or Register to comment.