Newb: Using OAuth and JSON to get an image?

pcm2apcm2a Registered Users Posts: 21 Big grins
Place me in the newb category and hopefully I didn't miss this when I searched around. I am writing a test program to download one image thumbnail using Java.

What I have so far:
- Using the Java API (uses JSON) I can successfully connect to my account, list my albums, lists my images, and get the image URLs. There is no API that I could find to actually download the image. That is where the image URL comes in.
- If the gallery has external links set to "Yes" then I can use regular http get to pull the image down.
- If the gallery has external links set to "No" I cannot download the image.

So my next step is trying to learn how I can access these private images. Is this where OAuth is going to be required?

Are these the steps others are using to access images?
1. Use JSON (or other available mechanism) to get the image name
2. Use OAuth to authenticate the user
3. Use the OAuth object (instead of a basic http object) to get the image url

I am new to OAuth so I wanted to run that by some pros before going down a wrong path. Thanks!

Comments

  • pcm2apcm2a Registered Users Posts: 21 Big grins
    edited July 22, 2010
    I feel like I am missing something pretty simple here. It seems like using the JSON I should be able to download an image after authenticating?
  • pcm2apcm2a Registered Users Posts: 21 Big grins
    edited July 22, 2010
    Nevermind, I have figured it out. The key peice of information that didn't seem to be in the documentation was how to set a cookie with the session id.

    SMSESS=. Once that cookie was set I was able to get the image, no OAuth required.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited July 22, 2010
    Looks like you got yourself sorted out, you can also send the OAuth Authorization header in the URL request.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
Sign In or Register to comment.