Album API endpoint - retrieving Unlisted albums
robrob
Registered Users Posts: 2 Beginner grinner
I'm calling "api.smugmug.com/api/v2/user/XXXXXX!albums", and I'm getting a result that has albums that are public. How can I also get Unlisted albums?
0
Comments
You'll have to make an authenticated call using OAuth. This means passing an appropriate
Authorization
header. There are a lot of guides that can walk you through this process and there are helper libraries available for pretty much every modern language and request library. Note that we use OAuth 1.0a, which is very different than OAuth 2.0, so make sure you are working with the correct version.from rauth import OAuth1Service
from rauth import OAuth1Session
import json
service = OAuth1Service(
name='smugmug-list',
consumer_key=key,
consumer_secret=secret,
...
base_url='htt ps://api.smugmug.com/api/v2')
session = OAuth1Session(
service.consumer_key,
service.consumer_secret,
access_token=at,
access_token_secret=ats)
albums=json.loads(session.get(
"htt ps://api.smugmug.com/api/v2/user/XXXXXX!albums",
headers={'Accept': 'application/json'}).text).get('Response').get('Album')
How can I tell if the call is authenticated? I went through the whole thing about getting the numeric code and entering it on the page in the browser to get the token.
(Edit: url's above edited to allow forum to let me "post links")
PhotoTeleport: open source, multi platform photo uploader.