Having trouble creating creating albums in a subcategory

derfbergderfberg Registered Users Posts: 8 Beginner grinner
Hi,

I'm new to working with the API but I have been able to figure out how to create new albums using Mugatron's apple script (many thanks!) and re-purposing it. My problem is that when I create a new album it will be created in the correct category but the AlbumTemplateID and SubCategoryID's do not get set. Here's what I'm passing in via the API:

tell application "http://api.smugmug.com/hack/xmlrpc/1.1.1/"
call xmlrpc {method name:"smugmug.albums.create", parameters:{{|SessionID|:"211e6a0236d1c33dedec3832fdcee498", |Title|:"TEST", |CategoryID|:158817, |AlbumTemplateID|:30286, |SubCategoryID|:328649}}}
end tell

The "TEST" album gets created and assigned to the correct categoryID but not the subcategory and the template does not get applied either. Both are using valid id's that exist. What am I doing wrong?

Thanks,

Derf :dunno

Comments

  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited June 3, 2007
    Derf,

    I will check it out tomorrow for you.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • derfbergderfberg Registered Users Posts: 8 Beginner grinner
    edited June 3, 2007
    devbobo wrote:
    Derf,

    I will check it out tomorrow for you.

    Cheers,

    David
    Thanks David - I look forward to your response/help.

    Derf
  • derfbergderfberg Registered Users Posts: 8 Beginner grinner
    edited June 5, 2007
    Still stuck...
    I tried playing with this some more and thought that maybe using the changeSettings method would work to set the sub-category once I had created the new album in a category but I got a system error when I tried to use it. I tried to change a few other settings as well but I got the same error message. I'm guessing I'm doing something wrong but I can't tell what it is and I have tried many many different ways to try to get it to work to no avail. Any help would be much appreciated.

    Thanks,

    Derf
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited June 6, 2007
    Sorry Derf,

    I have been knee deep in rewriting some feed stuff the past day or so.

    I promise I will look tomorrow.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • derfbergderfberg Registered Users Posts: 8 Beginner grinner
    edited June 12, 2007
    devbobo wrote:
    Sorry Derf,

    I have been knee deep in rewriting some feed stuff the past day or so.

    I promise I will look tomorrow.

    Cheers,

    David

    David - you seem to be the only one that can help me - how's your schedule looking? :D Alternatively - is there a better protocol to use with apple script than xml-rpc? I can't find anything other than xml-rpc or SOAP for apple script - the API doesn't work with SOAP right? Do you know how to use REST with apple script or can you point me in the right direction?

    Thanks,

    Derf
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited June 12, 2007
    Derf,

    Sorry about the delay, it does work, but it needs to be configured like this...

    tell application "http://api.smugmug.com/hack/xmlrpc/1.1.1/"
    call xmlrpc {method name:"smugmug.albums.create", parameters:{{|SessionID|:"211e6a0236d1c33dedec3832fdcee498", |Title|:"TEST", |CategoryID|:158817, parameters:{|AlbumTemplateID|:30286, |SubCategoryID|:328649}}}}
    end tell

    So all parameters (other than SessionID, Title and CategoryID) need to be passed inside the parameters array.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • derfbergderfberg Registered Users Posts: 8 Beginner grinner
    edited June 12, 2007
    devbobo wrote:
    Derf,

    Sorry about the delay, it does work, but it needs to be configured like this...

    tell application "http://api.smugmug.com/hack/xmlrpc/1.1.1/"
    call xmlrpc {method name:"smugmug.albums.create", parameters:{{|SessionID|:"211e6a0236d1c33dedec3832fdcee498", |Title|:"TEST", |CategoryID|:158817, parameters:{|AlbumTemplateID|:30286, |SubCategoryID|:328649}}}}
    end tell

    So all parameters (other than SessionID, Title and CategoryID) need to be passed inside the parameters array.

    Cheers,

    David

    That was it - I knew it had to be something I was missing being new to applescript and the api. Thank you so much for straightening me out David! bowdown.gif

    My work continues...

    Derf
Sign In or Register to comment.