Need help getting started with the API
sackroyd
Registered Users Posts: 5 Beginner grinner
I am writing an iPad application. I need to access and display photos from a series of public gallery for a particular smugmug user.
In the past, I have gotten other apis to work by using tools to generate the initial http post strings. I try these in a browser, and then when I get them to work, I just shift over to putting that http url directly into my code. Then I just parse the response with a nice JSON parser I have.
As an example, the internet archive has a nice page where you can try out urls and see the responses:
http://www.archive.org/advancedsearch.php
So as an example, I wanted to get a list concerts by String Cheese Incident and see how many downloads there were - it helped me toi craft this url (which returns some excellent JSON).
http://www.archive.org/advancedsearch.php?q=collection%3A%28StringCheeseIncident%29&fl[]=avg_rating&fl[]=downloads&sort[]=&sort[]=&sort[]=&rows=50&page=1&indent=yes&output=json&callback=callback
So, for Smugmug, all I need to do is to craft the http messages to login anonymously, select a particular user, get a list of galleries and then get a list of photos in each gallery.
I have an API key.
So, I am trying to craft the url I need to login, and I am trying:
http://api.smugmug.com/services/api/json/1.2.2/smugmug.login.anonymously?APIKey=xxxxyyyyzzzz
So - I get nothing back, because clearly I do not know what I am doing.
Can anyone give me a little guidance about how to craft the right URL to use for logging in and then getting a list of galleries??
I really want to try in a browser first, so I understand how to build the correct url.
Thanks in advance.
Best,
Steve
In the past, I have gotten other apis to work by using tools to generate the initial http post strings. I try these in a browser, and then when I get them to work, I just shift over to putting that http url directly into my code. Then I just parse the response with a nice JSON parser I have.
As an example, the internet archive has a nice page where you can try out urls and see the responses:
http://www.archive.org/advancedsearch.php
So as an example, I wanted to get a list concerts by String Cheese Incident and see how many downloads there were - it helped me toi craft this url (which returns some excellent JSON).
http://www.archive.org/advancedsearch.php?q=collection%3A%28StringCheeseIncident%29&fl[]=avg_rating&fl[]=downloads&sort[]=&sort[]=&sort[]=&rows=50&page=1&indent=yes&output=json&callback=callback
So, for Smugmug, all I need to do is to craft the http messages to login anonymously, select a particular user, get a list of galleries and then get a list of photos in each gallery.
I have an API key.
So, I am trying to craft the url I need to login, and I am trying:
http://api.smugmug.com/services/api/json/1.2.2/smugmug.login.anonymously?APIKey=xxxxyyyyzzzz
So - I get nothing back, because clearly I do not know what I am doing.
Can anyone give me a little guidance about how to craft the right URL to use for logging in and then getting a list of galleries??
I really want to try in a browser first, so I understand how to build the correct url.
Thanks in advance.
Best,
Steve
0
Comments
You need to pass the method as a query parameter like this (and also the callback if you want one)...
http://api.smugmug.com/services/api/json/1.2.2/?method=smugmug.login.anonymously&APIKey=xxxxyyyyzzzz&Callback=callback
Cheers,
David
SmugMug API Developer
My Photos
Thanks!!