Options

Need help with smugmug.images.changeSettings

elyobelyobelyobelyob Registered Users Posts: 53 Big grins
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>

Comments

  • Options
    elyobelyobelyobelyob Registered Users Posts: 53 Big grins
    edited August 20, 2005
    More info ...
    Just print_r'd the output from the script ...

    xmlrpcval Object ( [me] => Array ( [string] => ) [mytype] => 1 )

    Any help?
  • Options
    elyobelyobelyobelyob Registered Users Posts: 53 Big grins
    edited August 22, 2005
    Bugger, no replies. 27 views, and no help out there. At least, how can I check that the correct information is being sent? Am I correctly structuring my sent information?

    $get_images_struct = new xmlrpcval(Array(SessionID => new xmlrpcval($session_id), ImageID => new xmlrpcval(32827392, "int"), Array (AlbumID => new xmlrpcval(745010, "int"), Caption => new xmlrpcval("MyCaption"), Keywords => new xmlrpcval("MyKeywords"), "struct")));

    Thanks (this group is my final hope to get this working).
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited August 22, 2005
    elyobelyob wrote:
    Bugger, no replies. 27 views, and no help out there. At least, how can I check that the correct information is being sent? Am I correctly structuring my sent information?

    $get_images_struct = new xmlrpcval(Array(SessionID => new xmlrpcval($session_id), ImageID => new xmlrpcval(32827392, "int"), Array (AlbumID => new xmlrpcval(745010, "int"), Caption => new xmlrpcval("MyCaption"), Keywords => new xmlrpcval("MyKeywords"), "struct")));

    Thanks (this group is my final hope to get this working).
    Hey Dude,

    My PHP is a bit rusty, are yuo able to output the contents of $get_images_struct after you create it ? perhaps print $get_images_struct ? That way I will be able to determine if what is being generated is correct.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    elyobelyobelyobelyob Registered Users Posts: 53 Big grins
    edited August 23, 2005
    xmlrpcval Object ( [me] => Array ( [string] => Array ( [SessionID] => xmlrpcval Object ( [me] => Array ( [string] => c9dcb72bdbc81b6852e4ab9b97fc512c ) [mytype] => 1 ) [ImageID] => xmlrpcval Object ( [me] => Array ( [int] => 32827392 ) [mytype] => 1 ) [0] => Array ( [AlbumID] => xmlrpcval Object ( [me] => Array ( [int] => 745010 ) [mytype] => 1 ) [Caption] => xmlrpcval Object ( [me] => Array ( [string] => MyCaption ) [mytype] => 1 ) [Keywords] => xmlrpcval Object ( [me] => Array ( [string] => MyKeywords ) [mytype] => 1 ) [0] => struct ) ) ) [mytype] => 1 )

    ---GOT---
    HTTP/1.1 200 OK
    Date: Tue, 23 Aug 2005 14:52:09 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: Tue, 23 Aug 2005 14:52:09 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>
Sign In or Register to comment.