|
|
Thread Tools | Display Modes |
|
#1
|
|
|
Beginner grinner
|
"invalid API key" on rest api calls
This is my first time trying to use the API.
I login with https://api.smugmug.com/services/api/rest/1.2.2/?method=smugmug.login.withPassword&APIKey=...&Emai lAddress=...&Password=... and get a response with stat="ok" and a session id. Then I try: https://api.smugmug.com/services/api/rest/1.2.2/?SessionID=...&method=smugmug.categories.get and I get <rsp stat="fail"><method>smugmug.categories.get</method><err code="18" msg="invalid API key"/></rsp> I tried a few different methods, always with the same result. What's wrong? |
|
|
|
|
#2
|
|
|
Beginner grinner
|
I got it to work. I used wget with "--save-cookies /tmp/cookies.txt --keep-session-cookies" for the login.withPassword, and "--load-cookies /tmp/cookies.txt" on the subsequent categories.get. Is the requirement of having cookies enabled documented anywhere?
|
|
|
|
|
#3
|
|
|
Big grins
|
Just wanted to say thanks for posting this. I was trying to use the API from perl, and was running into this error too. Your posts helped me along.
This is all I needed to do in perl to enable cookies: Code:
use HTTP::Cookies;
my $cookie_jar = HTTP::Cookies->new(
file => "sm_cookies.dat",
autosave => 1,
);
my $ua = LWP::UserAgent->new;
$ua->cookie_jar($cookie_jar);
|
|
|
|
| Tell The World! | |
| Similar Threads | Thread Starter | Forum | Replies | Last Post | ![]() |
| Why is REST API not RESTful? | MikeSchinkel | SmugMug APIs, Hacks & Tricks | 6 | Apr-02-2008 08:23 PM | |
| Some problems with REST 1.1.1 API | mhilbush | SmugMug APIs, Hacks & Tricks | 9 | May-03-2007 04:51 PM | |
| stuck on smugmug.images.upload API call | crenner | SmugMug APIs, Hacks & Tricks | 5 | Sep-04-2006 09:12 PM | |
| Image URLs from REST API Don't Always Work in Firefox | o_swas | SmugMug APIs, Hacks & Tricks | 4 | Jul-27-2006 10:50 AM | |
| Bugs in REST API | mpmcleod | SmugMug APIs, Hacks & Tricks | 3 | Jun-06-2006 12:50 AM | |
| Thread Tools | |
| Display Modes | |
|
|