Quantcast
Channel: Digital Grin Photography Forum - SmugMug APIs, Hacks & Tricks
Viewing all 147 articles
Browse latest View live

What is the 'ihm' cookie?

$
0
0
I'm trying to write a short Python script to download some images. The script works great for non-private images.

For private images, I've seen some references to the "SMSESS" cookie being required, but that doesn't seem to be sufficient.

I've watched what my browser sends, and there is a magic-looking-to-me "ihm" cookie that seems to be required. I can paste the brower's ihm and SMSESS cookies in the Python code to get a working download. How can I create this ihm cookie manually?

Oddly, I can even mix the browser's "ihm" cookie with my Python session's "SMSESS" cookie and still get a download.

Get response from upload API

$
0
0
Hey guys,

I create a new album and upload a few images via API (I use ColdFusion CFSmug components) and when the user redirects to smugmug album he see "Processing". The user has to wait some time and refresh the page manually to see all images. My question: does API has any function or album/image property to check if all images are uploaded and ready to view.

Just to be clear. Here is what I'd like:
1. User clicks on Submit button, we display "We uploading your images. Please wait." dialog.
2. Do Ajax request, create a new album, upload user's images
3. Get some response from SmugMug about the uploading progress
4. If images are uploaded we hide "Please wait" dialog and redirect user to his album

Thanks!

Md5 hash comparison no longer detects duplicates?

$
0
0
I setup a python script that uploads albums that worked fine until switching to the new smugmug design. It retrieves the md5 hashes for each album first and compares md5 hash for each file to detect duplicates before uploading them. The duplicate detection no longer works and duplicates are uploaded regardless. Any ideas on why this has changed and no longer works? I can't use filenames to detect duplicates because they often get reused. I haven't had much time to insert break points and troubleshoot yet, but am wondering if there was a change to the api that would affect this.

API for getting pageDesignId information for multiple nodes?

$
0
0
Hey guys,

I'm writing a backup tool which allows you to download the data from your SmugMug site designs to your computer, so that if you accidentally delete a widget/page/design, it can be recovered.

I can rapidly enumerate all the nodes on the site with v1.4.0's rpc.node.getchildnodes, or v2's nicknameurlpathlookup. I want to find out the IDs of the page designs used for each of those nodes (pageDesignId, sitePageDesignId and siteDesignId) so that I know which page designs are in use on the site and which pages use which designs.

But the only place I've found to get this information is from the individual HTML pages for those nodes (the data is provided as an argument to Y.SM.Page.init() in the HTML source). This requires me to fetch every single node individually and scrape that data out of the HTML source, which is sloooow.

Is it possible to cause rpc.node.getchildnodes to augment the information it returns about each node with this page design information? Or is there some other API I can call and provide a list of node IDs to get this information for?

How to set image title using SmugMug api?

$
0
0
I sent the question below to SmugMug support, but they asked me to post here instead.

Hello SmugMug

I noticed SmugMug handles more photo metadata than before, namely it extracts title from xmp headers. Which is great. Can you tell me how to change the title using SmugMug api? I use a custom tool to keep my local and remote (SmugMug) photos in sync, I need to change it to accommodate the new field.

I looked here:
* http://api.smugmug.com/services/api/...changeSettings
* http://api.smugmug.com/services/api/...changeSettings

I know how to change the caption (description), but not the title.

Thanks for help
Marek

how to get Accesstoken on android.

$
0
0
I am so frustrated for 3 days to fix the problem. I couldn't find any good example of smugmug 1.3.0 for java.

What I want to do is I have android app that connects java servlet (currently it is on tomcat local).

I want to put Smugmug api code on the doPost method for login.

Once doPost is triggered,
request requestToken (Successful)
request authorizedUrl (Successful)
The problem is Since I am making android, I need to display the authorizedUrl on android phone by using WebView.(I think there is only the way.)

which means that after getting the url, servlet has to pass url to android.
After user login, android goes to the servlet again to process the rest of flow.


My question is this.
Is there way smugmug automatically display their own loging page once accepting requestToken?
If not, what should I do once I get authorizedUrl on the servlet to do next step for login.

how to get Accesstoken on android.

$
0
0
I am so frustrated for 3 days to fix the problem. I couldn't find any good example of smugmug 1.3.0 for java.

What I want to do is I have android app that connects java servlet (currently it is on tomcat local).

I want to put Smugmug api code on the doPost method for login.

Once doPost is triggered,
request requestToken (Successful)
request authorizedUrl (Successful)
The problem is Since I am making android, I need to display the authorizedUrl on android phone by using WebView.(I think there is only the way.)

which means that after getting the url, servlet has to pass url to android.
After user login, android goes to the servlet again to process the rest of flow.


My question is this.
Is there way smugmug automatically display their own loging page once accepting requestToken?
If not, what should I do once I get authorizedUrl on the servlet to do next step for login.

New SmugMug & API - Categories/Albums vs. Folders

$
0
0
I have an iOS app that uses MY Business account to let customers upload their photos into Categories that I created manually, with Albums they create and they can upload photos with my app, all UNDER the old SmugMug and API 1.2.2. Version 1.3 and OAuth is not relevant or even useful in this scenario.

Anyway, I found that my old Categories were somehow turned into a top-level folder during the transition to the NEW SmugMug. However, when I create new Categories programmatically, and get a Category ID returned successfully, they do not show up as Folders. So, there is apparently not a way to create Folders via the old API.

So, my app is dead in the water and I am unable to offer my new customers SmugMug services.

SmugMug has dropped the ball in supporting developers who have used their API for purposes other than hobbies, and I'll have to look elsewhere unless a new non-OAuth API is published very quickly.

Any response from SmugMug???

OAuth and Methods with Parameters says "Invalid Signature"

$
0
0
Hi,

I got OAuth working to the point that I can do requests to methods without parameters.
For example, I can call "smugmug.users.getTree" and I get a result. Whenever I try to add a parameter (e.g. Extras=ImageCount") to a request, I get "Invalid Signature". I tried every possible combination of generating the base_string, nothing is working. I've even read the official RFC specs about OAuth. My base_string seems good to me. I have clearly overlooked something. If anyone sees something, I would really appreciate your help.

Here is what is working:
BASE_STRING (I added New Lines for readability purpose):
Code:

GET&https%3A%2F%2Fapi.smugmug.com%2Fservices%2Fapi%2Fjson%2F1.3.0%2F&
method%3Dsmugmug.users.getTree%26
oauth_consumer_key%3DZATFDe0SJ2h4UuOyD7NL0UZ1DQokFivH%26
oauth_nonce%3DF0A7BB13-FCFB-4C0D-A32C-783DADA1766A%26
oauth_signature_method%3DHMAC-SHA1%26
oauth_timestamp%3D1378109752%26
oauth_token%3Dfdb73b19a9a10b7d2afb021c2de6a898%26
oauth_version%3D1.0

Authorization Header (I added New Lines for readability purpose):
Code:

realm="https://api.smugmug.com/",
method="smugmug.users.getTree",
oauth_consumer_key="ZATFDe0SJ2h4UuOyD7NL0UZ1DQokFivH",
oauth_nonce="F0A7BB13-FCFB-4C0D-A32C-783DADA1766A",
oauth_signature="0VFFu%2BnSb8waKqqNz4XR5G5%2BUng%3D",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1378109752",
oauth_token="fdb73b19a9a10b7d2afb021c2de6a898",
oauth_version="1.0"

Here is what is NOT working:
BASE_STRING (I added New Lines for readability purpose):
Code:

GET&https%3A%2F%2Fapi.smugmug.com%2Fservices%2Fapi%2Fjson%2F1.3.0%2F&
Extras%3DImageCount%26
method%3Dsmugmug.users.getTree%26
oauth_consumer_key%3DZATFDe0SJ2h4UuOyD7NL0UZ1DQokFivH%26
oauth_nonce%3D614B39B4-6F41-4D11-A9DB-2553AD4BC495%26
oauth_signature_method%3DHMAC-SHA1%26
oauth_timestamp%3D1378109612%26
oauth_token%3Dfdb73b19a9a10b7d2afb021c2de6a898%26
oauth_version%3D1.0

Authorization Header (I added New Lines for readability purpose):
Code:

realm="https://api.smugmug.com/",
Extras="ImageCount",
method="smugmug.users.getTree",
oauth_consumer_key="ZATFDe0SJ2h4UuOyD7NL0UZ1DQokFivH",
oauth_nonce="614B39B4-6F41-4D11-A9DB-2553AD4BC495",
oauth_signature="nsQgp3P4cuUCXyYm1XIzu%2Be4PI4%3D",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1378109612",
oauth_token="fdb73b19a9a10b7d2afb021c2de6a898",
oauth_version="1.0"

Thanks.

Smugmug XBMC Addon - help with SSL connection

$
0
0
Hi,

I'm working on a Smugmug addon for XBMC.
I got everything working besides the oauth login. I want to let the user enter his mail and password in XBMC and send it to smugmug to authorize my application.

I try to call the method rpc.user.login on https://secure.smugmug.com/services/api/json/1.4.0/
with post data like this:
Email=myemail%40aaa.com&Password=myPwd&KeepLoggedI n=0&method=rpc.user.login

I would expect a result like this:
{"stat":"ok", "method":"rps.user.login","Homepage":"watherver.co m","Domain":"","SessionID":"foo","Key":"bar"}

But instead I get the following error message:
{"stat":"fail","method":"rpc.user.login","code":2, "message":"SSL required"}

I don't understand the error message. If it is an SSL handshake error, why do I get a message from the smugmug API? In that case I would expect a SSL Handshake Exception or something like that.
I imported the smugmug certificate and the Comodo root certificate but it didn't change anything.

I'm new to Python programming, can anyone help?

Regards,
Andreas

How do I mirror or sync my galleries with my desktop?

$
0
0
Hi folks,

I am looking for a way to easily manage and organize all of my SmugMug photos and galleries from the desktop. I use a Windows laptop running Win7 and ideally, it would be convenient if I could setup a folder tree in Windows, and then have those mirror/sync the galleries on SmugMug automagically. Of course, I'd also like it to go the other way, too, where any changes I make on SmugMug are mirrored/sync'd on the desktop, too.

This may sound like a weird request, but the reason I'm asking is because I am finding that I don't go into SmugMug that often. What I usually do is snap photos on my iPhone using Camera Awesome. I have those photos set to automatically share/upload to a SmugMug folder I call "the Holding Pen." I know I should go into the Holding Pen gallery on SmugMug and then move them over to the appropriate galleries, but ... well, I find that I'm often lazy and don't do this often enough.

Now, I have 2000 photos in the Holding Pen and it would just be a lot easier if I could download my photos to my laptop, manually move them over to the correct folders using Picasa, and then mirror/sync those folders on SmugMug. And of course, I know sometimes I won't be near my desktop, so I'd like to be able to make changes to my galleries from my iPhone on the road ... and have them show up properly in Picasa.

Make sense?

I have searched through the third-party apps and hacks, but haven't quite found what I'm looking for. Can you please help or point me in the right direction?

At your service,
Michael

"Invalid signature" using smugmug.albums.get api

$
0
0
Hello folks,
This is my first time working with smugmug apis.

I've managed to do the oauth dance and get an access token.

I can even do smugmug.auth.checkAccessToken and get details like user id, name & nickname

But when I do smugmug.albums.get, this is what I see:

If I add "&NickName=<mynickname>" as a parameter to the sigBaseString & query, I get back "invalid signature".

If I omit the nickname parameter, I get a successful response with my own albums.

Any pointers on what might be going on?

=GEP

PS: The reason I'd like to use the NickName parameter is because I'd like to be able to see albums from other users.

How to handle Smugmug callback method(servlet) for android

$
0
0
I have been struggling so much for this problem.

I have android project to connect to smugmug login page by communicating to servlets

So I have

* android app project
* servlet one (to get request token & receive authorized url)
* servlet two (to get access token after login. It is called after login which is good)

flow is supposed be like

the user hit the button to smugmug login on android project => the servlet one => android project to browse the url through webview => the user login => the servlet two * at this point, I got the access token on the servlet
=> come back to android project to store access token

everything works until getting access token. However, there is no way to sending access token from the servlet two to the android project since the servlet two is callback. It will called from smugmug server.

Could you please give me a idea. It looks really easy but I have been stuck for a few days..Feel so stupid.

Thank you

categoryID defaut for smugmug.albums.create in 1.2.2 API

$
0
0
Hi,

I was not able to find an answer on the forums, any pointers to existing documentation is welcome.

Here is my problem (1.2.2):
I am trying to understand the behavior of smugmug.albums.create when there is no or bugs CategoryID set

my observations:
smugmug.albums.create does not require CategoryID to be set. Upon some exploration I noticed the following:
- if CategoryID is not set, i.e. not defined in the request, the album gets created in a Category "Other"
- if CategoryID is set to -1 (thought this might be a valid default), the album gets created in a category "Smug Preview"
- if I create a top level album in the web frontend (i.e. w/o a category in the root of my account), the album lists category "Homepage"

neither "Smug Preview" nor "Homepage" are listed in smugmug.categories.get and thus are not accessible from an app using the API.

What am I doing wrong? is there another API call to get access to the top level hierarchy?

thx,
Olli

Retrieving Images By Date?

$
0
0
I don't see a way in the API to retrieve all of a user's images between two dates. Is it possible to do this (in my case, I don't even need to retrieve them -- simply having URLs to the images would be sufficient).

Thanks!

Retrieving gallery comments sometimes doesn't work

$
0
0
SmugMug API 1.3.0, method: smugmug.albums.comments.get

Response:

{
code = 26;
message = "deprecated method";
method = "smugmug.albums.comments.get";
stat = fail;
}

(5) system error in script

$
0
0
Hey Guys,

I have a client for whom I am writing an import script using the 1.3 API. I've been testing the script out on my test plan. It seems to hum along just fine, and then chokes on "(5) system error" which is returned from the "smugmug.albums.create" method.

I cannot tell why this error is happening, and smugmug support hasn't been able to help me. They directed me here. I can imagine two scenarious:
  1. I am being rate-limited
  2. My free plan has reached some kind of limit

For #1 I am going to have a problem when I run this for my client as it won't entire work for them. For #2 I am only going to have a problem testing everything, but I think I can find ways around it, such as several batches starting from an empty test account. If you're able to help me, much thanks!

API creating folders?

$
0
0
I'm new to the SM API and I'm looking to start a project. I need to be able to create a gallery. But one thing I seem to be missing is how to I create a folder and put a gallery in a folder in accordance with the new SM design?

Can I access all the levels of folders?

Where is the documentation on this?

Thanks!
-Matt

User authentication

$
0
0
Hi! I work on the photo studio website. My client wants to have an access form on the website allows to direct user to his smugmug gallery. How it should work:
1. User types gallery name and password (galleries should secure = be password protected) and click Submit
2. It directs user to his gallery

How can user avoid "Unlock Gallery" form on smug? Maybe I could get request token and post password to smugmug?

Thank you all for any help.

Newbie: Ruby, OAuth

$
0
0
I'm just starting to mess around with the API. I'm hoping to write something in ruby that will do a bulk update of captions for images in an account.

I'm getting hung up on the use of OAuth and am using the oauth gem but I'm having a hard time wrapping my head around how OAuth is going work without a browser. For the moment I'd be fine hard-coding my credentials in to get the thing working and worry about that later.

My sample code looks like this. My questions follow the code

Code:

require 'rubygems'
require 'oauth'
 
@consumer = OAuth::Consumer.new(ENV['SMUGMUG_API_KEY'],
                                ENV['SMUGMUG_API_SECRET'],
                                { :site => "http://api.smugmug.com",
                                  :scheme => :query_string,
                                  :request_token_path => "/services/oauth/getRequestToken.mg",
                                  :access_token_path  => "/services/oauth/getAccessToken.mg",
                                  :authorize_path    => "/services/oauth/authorize.mg"
                                })

@consumer.http.set_debug_output($stdout)

@request_token = @consumer.get_request_token
@access_token = @request_token.get_access_token

The output of this session is shown below, with some values replaced with "<OMITTED>" where I have scrubbed them out.

Code:

opening connection to api.smugmug.com...
opened
<- "POST /services/oauth/getRequestToken.mg?oauth_callback=oob&oauth_nonce=KG5crViraAQE3is9XVv6g9lC0oOjrVwZqzVr04Sd4I&oauth_timestamp=1385241479&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&oauth_consumer_key=<OMITTED>&oauth_body_hash=2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D&oauth_signature=EdY6oxtvjQbHcwlmdwJXV8ALqIE%3D HTTP/1.1\r\nContent-Length: 0\r\nConnection: close\r\nUser-Agent: OAuth gem v0.4.7\r\nAccept: */*\r\nHost: api.smugmug.com\r\n\r\n"
-> "HTTP/1.1 200 OK\r\n"
-> "Cache-Control: private, max-age=1, must-revalidate\r\n"
-> "Content-Type: text/html; charset=utf-8\r\n"
-> "Expires: Sat, 23 Nov 2013 21:18:00 GMT\r\n"
-> "Server: Apache\r\n"
-> "X-Extra: 0.03654\r\n"
-> "X-Powered-By: SmugMug/1.0\r\n"
-> "X-S: 100.10.215:11638\r\n"
-> "X-SmugMug-Hiring: How to love what you do: http://www.smugmug.com/jobs/\r\n"
-> "X-SmugMug-Values: 2/4 - Love your employees\r\n"
-> "X-TTFB: 0.0426\r\n"
-> "X-TTFB-L: 128\r\n"
-> "X-UA-Compatible: IE=edge\r\n"
-> "Date: Sat, 23 Nov 2013 21:17:59 GMT\r\n"
-> "Transfer-Encoding:  chunked\r\n"
-> "Connection: close\r\n"
-> "Connection: Transfer-Encoding\r\n"
-> "Set-Cookie: SMSESS=f4cf45295399414ea2747ca75f7925af; path=/; domain=.smugmug.com; HttpOnly\r\n"
-> "Set-Cookie: SMSESS=2f58844d18d212dbeade9c6dc8e783cd; path=/; domain=.smugmug.com; HttpOnly\r\n"
-> "Set-Cookie: _ss=mBvxJMMQV%2Fn1zj%2FC3bzVA4inuhQ9IbUdmE3YD4ZpfFD3a2SDXhuT%2Fw%3D%3D; expires=Sun, 24-Nov-2013 22:17:59 GMT; path=/; domain=.smugmug.com\r\n"
-> "Set-Cookie: _ss=tu7n8Qrt7FA9FP%2FF%2BHNyTmQ8HCQhYSRgnNzaTiVb2XD1dzGv16XFqw%3D%3D; expires=Sun, 24-Nov-2013 22:17:59 GMT; path=/; domain=.smugmug.com\r\n"
-> "\r\n"
-> "00000080\r\n"
reading 128 bytes...
-> "oauth_token=8ae04d01a8f51c534b6946c4d4e20290&oauth_token_secret=<OMITTED>"
read 128 bytes
reading 2 bytes...
-> "\r\n"
read 2 bytes
-> "00000000\r\n"
-> "\r\n"
Conn close
opening connection to api.smugmug.com...
opened
<- "POST /services/oauth/getAccessToken.mg?oauth_nonce=5k52YB0P2t8CpJR7xkJIhSsuEUE9Ggd0mtXYrMbQ2U&oauth_timestamp=1385241480&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&oauth_consumer_key=<OMITTED>&oauth_token=8ae04d01a8f51c534b6946c4d4e20290&oauth_body_hash=2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D&oauth_signature=sixgJkX59hdjRO6DUHYVvQpeBf8%3D HTTP/1.1\r\nContent-Length: 0\r\nConnection: close\r\nUser-Agent: OAuth gem v0.4.7\r\nAccept: */*\r\nHost: api.smugmug.com\r\n\r\n"
-> "HTTP/1.1 401 Unauthorized\r\n"
-> "Cache-Control: private, max-age=1, must-revalidate\r\n"
-> "Content-Encoding: gzip\r\n"
-> "Content-Type: text/html; charset=utf-8\r\n"
-> "Expires: Sat, 23 Nov 2013 21:18:00 GMT\r\n"
-> "Server: Apache\r\n"
-> "Vary: Accept-Encoding\r\n"
-> "X-Extra: 0.02748\r\n"
-> "X-Powered-By: SmugMug/1.0\r\n"
-> "X-S: 100.12.164:7607\r\n"
-> "X-SmugMug-Hiring: How to love what you do: http://www.smugmug.com/jobs/\r\n"
-> "X-SmugMug-Values: 4/4 - It's the product, stupid\r\n"
-> "X-TTFB: 0.0312\r\n"
-> "X-TTFB-L: 21\r\n"
-> "X-UA-Compatible: IE=edge\r\n"
-> "Content-Length: 41\r\n"
-> "Date: Sat, 23 Nov 2013 21:17:59 GMT\r\n"
-> "Connection: close\r\n"
-> "Set-Cookie: SMSESS=94606debaf7723262042300a42c46b5f; path=/; domain=.smugmug.com; HttpOnly\r\n"
-> "Set-Cookie: SMSESS=e5b46d76941fdc77697ba7782dbf46b1; path=/; domain=.smugmug.com; HttpOnly\r\n"
-> "Set-Cookie: _ss=aN4U7uVbvW7mCVFQaUAaU2tt4UMpM6lL8%2FYK0TeKRC3pjsEEJsmEHg%3D%3D; expires=Sun, 24-Nov-2013 22:17:59 GMT; path=/; domain=.smugmug.com\r\n"
-> "Set-Cookie: _ss=qdcHm%2ByaPtdY5adw84qRkHStMmiTOuRkCt8SepzmMz7QOec7iJGpig%3D%3D; expires=Sun, 24-Nov-2013 22:17:59 GMT; path=/; domain=.smugmug.com\r\n"
-> "\r\n"
reading 41 bytes...
-> "\037\213\b\000\000\000\000\000\000\003\313\314+K\314\311L\321O\255(\310,JMQ(\311\317N\315\003\000h\205SW\025\000\000\000"
read 41 bytes
Conn close
/Library/Ruby/Gems/1.8/gems/oauth-0.4.7/lib/oauth/consumer.rb:216:in `token_request': 401 Unauthorized (OAuth::Unauthorized)
        from /Library/Ruby/Gems/1.8/gems/oauth-0.4.7/lib/oauth/tokens/request_token.rb:18:in `get_access_token'
        from ./interact.rb:18

The end result is that I'm getting a 401 (not authorized), but I'm trying to figure out if I'm skipping some very basic step here. For example, with a headless app, how can I inject the user authorization portion of the OAuth transaction.
Viewing all 147 articles
Browse latest View live