Bug: smugmug.subcategories.create fails

luke_churchluke_church Registered Users Posts: 507 Major grins
Description: Calls to smugmug.subcategories.create return an empty string value, and seemingly do not create a subcategory:

Behaviour confirmed on
XML-RPC 1.1.0 and XML-RPC 1.1.1 BETA

[php]

<?xml version="1.0"?>
<methodCall>
<methodName>smugmug.subcategories.create</methodName>
<params>
<param>
<value>
<string>...</string>
</value>
</param>
<param>
<value>
<string>SubTestCategory73703503</string>
</value>
</param>
<param>
<value>
<i4>0</i4>
</value>
</param>
</params>
</methodCall>
Header
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<string/>
</value>
</param>
</params>
</methodResponse>

[/php]

Comments

  • luke_churchluke_church Registered Users Posts: 507 Major grins
    edited February 15, 2006
    Allocated: ST00004
    Allocated bug code ST00004. Bug replicated today. (15-Feb-06)

    Workaround via HTTP Post (included in SmugTools Release 1, unless bug gets fixed before release date).

    C#, won't directly compile outside the SmugTools framework, but the meaning should be obvious.

    A real implementation would also need error handling (as always...)
    //Create a new webclient
    WebClient client = new WebClient();
    client.BaseAddress = "[URL="http://www.smugmug.com/homepage/newsubcat.mg"]http://www.smugmug.com/homepage/newsubcat.mg[/URL]";
     
    client.Headers.Add("Cookie:SMSESS=" + this.credentials.SessionID);
    NameValueCollection queryStringCollection = new NameValueCollection();
    queryStringCollection.Add("Name", name);
    queryStringCollection.Add("CategoryID", categoryID.ToString());
    queryStringCollection.Add("newsubcat", "add+subcategory");
     
    client.UploadValues(client.BaseAddress, queryStringCollection);
     
    //Now do readback to find the ID
    SubCategory[] subcats = GetSubCategories(categoryID);
    foreach (SubCategory subcat in subcats)
    if (subcat.Title == name)
    {
    return subcat.SubCategoryID; //Success breakout
    }
    

    Tested against standard, power and pro grade accounts. SmugTools development build, Microsoft .NET 2.0.

    As always with bug workarounds, this is not part of the offical Smugug API and is subject to change without notice. It is provided for your information only.

    Hope this helps,

    Luke
Sign In or Register to comment.