• Gear
  • Shots
  • Photo Craft
  • Video
  • Wide Angle
  • Support
  • New Stuff
  • More
Support SmugMug APIs, Hacks & Tricks "invalid API key" on rest api calls

Need some help with your New SmugMug Site?

Dgrin Challenges

Our Challenges moderator has lined up an new set of challenges for you. The Weekly Word Challenge. Get all the details and participate in the conversation Weekly Word Challenge.

Past DSS Challenge Winners, DSS Challenge Rules, and other important DSS Challenge information is here.

Looking for a little challenge? The Dgrin Mini-Challenges are a great way to challenge yourself. Take a moment to look through past winners and find the current Mini Challenge here.

From Around the Net

Enjoy a few of our favorite articles from around the 'net. If you have something you think we should see, post it here and we'll have a look.

Journeys

Landscapes

Sports

 
Thread Tools Display Modes
Old Apr-20-2012, 06:14 PM
#1
auser is offline auser OP
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?
Old Apr-21-2012, 03:02 PM
#2
auser is offline auser OP
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?
Old May-10-2012, 01:29 PM
#3
olegos is offline olegos
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 09:23 PM
Some problems with REST 1.1.1 API mhilbush SmugMug APIs, Hacks & Tricks 9 May-03-2007 05:51 PM
stuck on smugmug.images.upload API call crenner SmugMug APIs, Hacks & Tricks 5 Sep-04-2006 10:12 PM
Image URLs from REST API Don't Always Work in Firefox o_swas SmugMug APIs, Hacks & Tricks 4 Jul-27-2006 11:50 AM
Bugs in REST API mpmcleod SmugMug APIs, Hacks & Tricks 3 Jun-06-2006 01:50 AM


Thread Tools
Display Modes

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump