elyobelyob
Aug-20-2005, 03:34 PM
Hi,
I'm just playing about with the API again. I think I've got a fair amount of it sussed. I am just trying to get the changeSettings to work so I can move photos from one album to another. I've got as far as getting an OK from the debug, but no movement. I'm not sure I've got the struct sedning correct, and how to view the output boolean. Thanks for any help.
The PHP code is ..
function changeAlbumSettings($session_id, $images_id) {
$get_images_struct = new xmlrpcval(array(
SessionID => new xmlrpcval($session_id, "String"),
ImageID => new xmlrpcval(32827392, "int"),
array (AlbumID => new xmlrpcval(745010, "int"),
Caption => new xmlrpcval("MyCaption", "string"),
Keywords => new xmlrpcval("MyKeywords", "string"), "struct")));
$xmlrpc_client = new xmlrpc_client("/hack/xmlrpc/", "api.smugmug.com", "443");
$xmlrpc_client->setDebug(1);
$get_images_msg = new xmlrpcmsg('smugmug.images.changeSettings', $get_images_struct);
$get_images_response = $xmlrpc_client->send($get_images_msg, '0', 'https');
if (!$get_images_response) { die("getimages failed"); }
$get_images_value = $get_images_response->value();
if (!$get_images_response->faultCode()) {
$images_array = php_xmlrpc_decode($get_images_value);
return $images = $images_array;
} else {
print "Fault: Code: " . $get_images_response->faultCode() . " Reason: " .$get_images_response->faultString()."<br />";
return 0;
}
}
The Debug output is ..
---GOT---
HTTP/1.1 200 OK
Date: Sat, 20 Aug 2005 22:22:46 GMT
Server: Apache
X-Powered-By: smugmug/1.2.0
Cache-Control: private, max-age=1, must-revalidate
Pragma:
Set-Cookie: SMSESS=; path=/; domain=.smugmug.com
ETag: sm-2beab780519903ae9dbbddf8df287383-sm
Content-Length: 151
Content-Type: text/xml
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<string/>
</value>
</param>
</params>
</methodResponse>
---END---
</pre>
HEADER: Date: Sat, 20 Aug 2005 22:22:46 GMT
HEADER: Server: Apache
HEADER: X-Powered-By: smugmug/1.2.0
HEADER: Cache-Control: private, max-age=1, must-revalidate
HEADER: Pragma:
HEADER: Set-Cookie: SMSESS=; path=/; domain=.smugmug.com
HEADER: ETag: sm-2beab780519903ae9dbbddf8df287383-sm
HEADER: Content-Length: 151
HEADER: Content-Type: text/xml
</pre>
---EVALING---[17 chars]---
new xmlrpcval("");
---END---</pre>
I'm just playing about with the API again. I think I've got a fair amount of it sussed. I am just trying to get the changeSettings to work so I can move photos from one album to another. I've got as far as getting an OK from the debug, but no movement. I'm not sure I've got the struct sedning correct, and how to view the output boolean. Thanks for any help.
The PHP code is ..
function changeAlbumSettings($session_id, $images_id) {
$get_images_struct = new xmlrpcval(array(
SessionID => new xmlrpcval($session_id, "String"),
ImageID => new xmlrpcval(32827392, "int"),
array (AlbumID => new xmlrpcval(745010, "int"),
Caption => new xmlrpcval("MyCaption", "string"),
Keywords => new xmlrpcval("MyKeywords", "string"), "struct")));
$xmlrpc_client = new xmlrpc_client("/hack/xmlrpc/", "api.smugmug.com", "443");
$xmlrpc_client->setDebug(1);
$get_images_msg = new xmlrpcmsg('smugmug.images.changeSettings', $get_images_struct);
$get_images_response = $xmlrpc_client->send($get_images_msg, '0', 'https');
if (!$get_images_response) { die("getimages failed"); }
$get_images_value = $get_images_response->value();
if (!$get_images_response->faultCode()) {
$images_array = php_xmlrpc_decode($get_images_value);
return $images = $images_array;
} else {
print "Fault: Code: " . $get_images_response->faultCode() . " Reason: " .$get_images_response->faultString()."<br />";
return 0;
}
}
The Debug output is ..
---GOT---
HTTP/1.1 200 OK
Date: Sat, 20 Aug 2005 22:22:46 GMT
Server: Apache
X-Powered-By: smugmug/1.2.0
Cache-Control: private, max-age=1, must-revalidate
Pragma:
Set-Cookie: SMSESS=; path=/; domain=.smugmug.com
ETag: sm-2beab780519903ae9dbbddf8df287383-sm
Content-Length: 151
Content-Type: text/xml
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<string/>
</value>
</param>
</params>
</methodResponse>
---END---
</pre>
HEADER: Date: Sat, 20 Aug 2005 22:22:46 GMT
HEADER: Server: Apache
HEADER: X-Powered-By: smugmug/1.2.0
HEADER: Cache-Control: private, max-age=1, must-revalidate
HEADER: Pragma:
HEADER: Set-Cookie: SMSESS=; path=/; domain=.smugmug.com
HEADER: ETag: sm-2beab780519903ae9dbbddf8df287383-sm
HEADER: Content-Length: 151
HEADER: Content-Type: text/xml
</pre>
---EVALING---[17 chars]---
new xmlrpcval("");
---END---</pre>