PDA

View Full Version : Help with smugmug.categories.create


dilbert
May-06-2005, 10:46 PM
I am trying to use smugmug.categories.create and smugmug.subcategories.create with XMLPRC::Lite and perl and neither one is working.
Currently I am able to login.withPassword and get albums, categories and subcategories, and create albums.
However, neither of the above calls seem to work, the categories.create creates categories with blank names, and the subcategories.create doesn't seem to do anything. I can't seem to get a result from either call. Below is the perl code for each that I am using:

my $picresult = XMLRPC::Lite
-> proxy($proxyurl)
-> call('smugmug.categories.create', $sessionid, "SomeCategory")
-> result;

my $picresult = XMLRPC::Lite
-> proxy($proxyurl)
-> call('smugmug.subcategories.create', $sessionid, "SomeSubCategory", 0)
-> result;

This is the album create and it does work:
my $picresult = XMLRPC::Lite
-> proxy($proxyurl)
-> call('smugmug.albums.create', $sessionid, $name, $category_id)
-> result;

dilbert
May-06-2005, 11:01 PM
here is a dump of the xml etc. I removed sessionid for security reasons, and added newline to <methodCall> section for readability, otherwise unchanged:

POST http://api.smugmug.com/hack/xmlrpc/
Accept: text/xml
Accept: multipart/*
Content-Length: 319
Content-Type: text/xml

<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>smugmug.subcategories.create</methodName>
<params>
<param>
<value>
<string>my_session_id_removed</string>
</value>
</param>
<param>
<value>
<string>SomeSubCategory</string>
</value>
</param>
<param>
<value>
<int>0</int>
</value>
</param>
</params>
</methodCall>

HTTP/1.1 200 OK
Cache-Control: private, max-age=1, must-revalidate
Date: Sat, 07 May 2005 06:55:46 GMT
Pragma:
Accept-Ranges: bytes
Server: Apache
Content-Type: text/xml
Client-Date: Sat, 07 May 2005 06:53:56 GMT
Client-Peer: 63.81.134.23:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Set-Cookie: SMSESS=removed; path=/; domain=.smugmug.com
X-Powered-By: smugmug/1.1.0

<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<string/>
</value>
</param>
</params>
</methodResponse>

dilbert
May-07-2005, 01:08 AM
XML got stripped above, not sure how to post without that happening, anyway here is my next question, what am I missing from the following for uploading pics (I get back the _msg OK but no pic posted)


my $ua = LWP::UserAgent->new(env_proxy => 1,
keep_alive => 1,
timeout => 300,
);
my $url = 'http://upload.smugmug.com/photos/xmladd.mg';

open (PIC_FP, "2005-01-03_074816.JPG");
binmode(PIC_FP);
my $picdata;
my $len = sysread(PIC_FP,$picdata,10000000);
print "$len\n";

my $result = $ua->post($url,
[ AlbumID => 275942,
SessionID => $sm->get_sessionid(),
Caption => "Test Caption",
ByteCount => $len,
Image => "Test_Image.jpg", $picdata,

]);