API 1.2.2 (soft release)

13»

Comments

  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 8, 2009
    SurfPunk wrote:
    I am trying to get acclimated to the API and seeing that I already have a framework for OAuth in my application I WAS happy to find implementation listed in documentation. The challenge is which documentation is up to date?

    Anyhow, IS API 1.2.2 officially released? Are all the API methods supported via OAuth now? if Not then when?

    I have made it through the Authentication/Login process, but can't seem to find right method name to call using OAuth for the smugmug.albums.get method. The call return the html stream for SMugMug.com.

    Any guidance or direction?
    Thanks

    Hey SurfPunk,

    You are correct that we only support authentication methods for OAuth using the OAuth compliant response formats.

    It's difficult to return complex data structures that we require for the majority of our api responses using OAuth's response format. However, using our traditional API endpoints (json, rest,php, xmlrpc) we support OAuth for all the methods, as per our documentation here... http://wiki.smugmug.net/display/API/API+1.2.2/

    Hope this helps,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • lemondbikerlemondbiker Registered Users Posts: 2 Beginner grinner
    edited April 11, 2009
    XML-RPC returns text/html, not text/xml
    It appears that the content-type of XML-RPC replies is text/html. This throws off (at the very least) the Ruby XMLRPC::Client library. This happens with the 1.2.2 API. I did not test older versions of the API.

    Since the reply is XML, shouldn't the content-type be text/xml?
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 11, 2009
    It appears that the content-type of XML-RPC replies is text/html. This throws off (at the very least) the Ruby XMLRPC::Client library. This happens with the 1.2.2 API. I did not test older versions of the API.

    Since the reply is XML, shouldn't the content-type be text/xml?

    Hey lemondbiker,

    I have fixed this bug internally....it should go live sometime towards the end of next week.

    But I thought that I would mention, if you are doing new development, I'd strongly suggest using one of the other api types...due to how verbose xml-rpc responses are compared to the others.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • SivaAnnaSivaAnna Registered Users Posts: 9 Big grins
    edited June 28, 2009
    Jsonp callback question - 1.2.2. api
    Hello,

    I am trying to use the 1.2.2 api library for my personal requirement.

    The following function used to work correctly 2,3 weeks before but now it is throwing error:

    function sm_login(user_name, user_pwd) {

    var url = "https://api.smugmug.com/services/api/json/1.2.2/?method=smugmug.login.withPassword&EmailAddress=" + user_name + "&Password=" + user_pwd + "&APIKey=FgO0UXGgJP9wkZywklmyBPl5bYb01xFB&JSONCallback=?";

    console.log("about to login " + url);
    $.getJSON(url, function (data) {

    console.log("data = " + data);
    console.log("inside function");
    if (data.stat == "ok") {
    sessionID = data.Login.Session.id;
    displayName = data.Login.User.DisplayName;
    console.log(sessionID);
    } else {
    console.log("error in login");
    }

    }

    The response contains the valid structure but, ajax call is not invoking the success function, i guess..

    =================
    about to login https://api.smugmug.com/services/api/json/1.2.2/?method=smugmug.login.withPassword&EmailAddress=XXXXXX&Password=XXXXXXX&APIKey=FgO0UXGgJP9wkZywklmyBPl5bYb01xFB&JSONCallback=?
    invalid label
    [IMG]chrome://firebug/content/blank.gif[/IMG]{"stat":"ok","method":"smugmug.login.wit...UqXh$xkMb5/879Jb3IMz.ppN1S0","AccountSta
    =============================

    if i change it to 1.2.1 this function works, but some other functions fails because the response structure is different (getImages, i guess)

    Has anything changed recently? or is this wrong?

    Thanks for your help.
  • SivaAnnaSivaAnna Registered Users Posts: 9 Big grins
    edited July 1, 2009
    Anybody can help me, please?
    SivaAnna wrote:
    Hello,

    I am trying to use the 1.2.2 api library for my personal requirement.

    The following function used to work correctly 2,3 weeks before but now it is throwing error:

    function sm_login(user_name, user_pwd) {

    var url = "https://api.smugmug.com/services/api/json/1.2.2/?method=smugmug.login.withPassword&EmailAddress=" + user_name + "&Password=" + user_pwd + "&APIKey=FgO0UXGgJP9wkZywklmyBPl5bYb01xFB&JSONCallback=?";

    console.log("about to login " + url);
    $.getJSON(url, function (data) {

    console.log("data = " + data);
    console.log("inside function");
    if (data.stat == "ok") {
    sessionID = data.Login.Session.id;
    displayName = data.Login.User.DisplayName;
    console.log(sessionID);
    } else {
    console.log("error in login");
    }

    }

    The response contains the valid structure but, ajax call is not invoking the success function, i guess..

    =================
    about to login https://api.smugmug.com/services/api/json/1.2.2/?method=smugmug.login.withPassword&EmailAddress=XXXXXX&Password=XXXXXXX&APIKey=FgO0UXGgJP9wkZywklmyBPl5bYb01xFB&JSONCallback=?
    invalid label
    [IMG]chrome://firebug/content/blank.gif[/IMG]{"stat":"ok","method":"smugmug.login.wit...UqXh$xkMb5/879Jb3IMz.ppN1S0","AccountSta
    =============================

    if i change it to 1.2.1 this function works, but some other functions fails because the response structure is different (getImages, i guess)

    Has anything changed recently? or is this wrong?

    Thanks for your help.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited July 1, 2009
    SivaAnna wrote:
    Anybody can help me, please?

    Have you tried url encoding the '?', since there is already a ? in the url denoting the start of the query string. If you have specifically chosen ? as your callback function name...I would highly recommend choosing something else.
    David Parry
    SmugMug API Developer
    My Photos
  • SivaAnnaSivaAnna Registered Users Posts: 9 Big grins
    edited July 4, 2009
    Jsonp callback question - 1.2.2. api
    devbobo wrote:
    Have you tried url encoding the '?', since there is already a ? in the url denoting the start of the query string. If you have specifically chosen ? as your callback function name...I would highly recommend choosing something else.

    David,

    As I already written in my earlier post:

    if I point my request to 1.2.1, this request works fine. the ajax call is successful and i can parse the response with no issue.

    And secondly, i have been using this for quite some time with 1.2.2 version till a month ago.

    I have not changed anything on my client side ..

    The "?" you are seeing for the jsoncallback is a mechanism to get the response processed with in this ajax call, (i believe i read this somewhere, i may be wrong)
  • AdamNAdamN Registered Users Posts: 18 Big grins
    edited July 7, 2009
    ImageUploadResponse inconsistent.
    Hi!
    When using the ImageUpload the response contains an imagestruct with the property URL. It would be neater to use OriginalURL instead, for consistency reasons (image.get etc).

    /Adam
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited July 8, 2009
    SivaAnna wrote:
    David,

    As I already written in my earlier post:

    if I point my request to 1.2.1, this request works fine. the ajax call is successful and i can parse the response with no issue.

    And secondly, i have been using this for quite some time with 1.2.2 version till a month ago.

    I have not changed anything on my client side ..

    The "?" you are seeing for the jsoncallback is a mechanism to get the response processed with in this ajax call, (i believe i read this somewhere, i may be wrong)

    try using just Callback as the parameter instead of JSONCallback.
    David Parry
    SmugMug API Developer
    My Photos
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited July 8, 2009
    AdamN wrote:
    Hi!
    When using the ImageUpload the response contains an imagestruct with the property URL. It would be neater to use OriginalURL instead, for consistency reasons (image.get etc).

    /Adam

    Hey Adam,

    I don't believe that it's inconsistent. It's returned like that so 3rd party apps can easily send a user directly to a newly uploaded image on SmugMug.

    Since both the ImageID and ImageKey are returned, it should be trivial (in most cases) for you to construct the original url...but I can't really see a high use case where someone is going to need that.

    I can potentially look at adding an Extras parameter like I have for smugmug.albums.get, etc where you could specify additional parameters that you want.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • AdamNAdamN Registered Users Posts: 18 Big grins
    edited July 8, 2009
    devbobo wrote:
    Hey Adam,

    I don't believe that it's inconsistent. It's returned like that so 3rd party apps can easily send a user directly to a newly uploaded image on SmugMug.

    Since both the ImageID and ImageKey are returned, it should be trivial (in most cases) for you to construct the original url...but I can't really see a high use case where someone is going to need that.

    I can potentially look at adding an Extras parameter like I have for smugmug.albums.get, etc where you could specify additional parameters that you want.

    Cheers,

    David

    Well your right, but for some of us who like to use the image struct, which in a perfect world would be returned, but I do se the time aspect as there's some work to be performed on the upload, it would be nice to map the response to that struct, hence the desire for OriginalUrl..


    Cheers!
  • MaRiMaRi Registered Users Posts: 21 Big grins
    edited September 16, 2009
    Hi.
    I have a question about smugmug.albums.reSort - is there any possibility that it’s missing some parameters like the direction of sorting? If not, how does it sort? In 1.2.0 there where two more parameters - String By (FileName, Caption, DateTime) and String Direction (ASC, DESC).
    Thanks.
  • DianogaDianoga Registered Users Posts: 2 Beginner grinner
    edited September 24, 2009
    So far I'm really enjoying the API. I have a couple of quick questions:
    1. Is 1.2.2 at a point where it isn't likely to break? I know it is a beta and I'm not looking for guarantees...just some reassurance :D.
    2. Is there a way to check uploads that are still processing? I'm working on an uploader and I'm trying to avoid duplicate uploading. This is one of those things that will probably never be an issue in real use, but while testing I keep running it before the previous uploads have finished processing (and thus add the images again).
    I switched to 1.2.2 from 1.2.0 as I ran into a bug with reporting the number of images in an album. Fortunately, this doesn't seem to be an issue in 1.2.2.

    Thanks!
  • pearsonartphotopearsonartphoto Registered Users Posts: 34 Big grins
    edited November 2, 2009
    Few things to add to the API
    Just been playing alot with the smugmug API, and noticed a few small
    things that sure would be nice.

    1) The ability to at least read comments, I'd love to make a comment
    analysis tool, but lacking the API calls, it's just not going to
    happen...
    2) A much simpler call, to be able to feature an image. I'd like to be
    able to upload one image, put it in the first position automatically,
    and feature it all automatically, unfortunately I just can't find a
    way to do it.
    3) It'd be nice to post a sample URL for each of the statements. That
    would have saved me alot of time, but I'm new to APIs in general.

    Thanks!

    Ben Pearson
    http://www.pearsonartphoto.com
  • darryldarryl Registered Users Posts: 997 Major grins
    edited November 2, 2009
    Just been playing alot with the smugmug API, and noticed a few small
    things that sure would be nice.

    1) The ability to at least read comments, I'd love to make a comment
    analysis tool, but lacking the API calls, it's just not going to
    happen...

    Well, there's always scraping: http://YOURSITE.smugmug.com/homepage/comments.mg?
Sign In or Register to comment.