darryl
Oct-15-2007, 10:29 PM
Man, this is super-frustrating.
In the web UI, if you enter a keyword in "double quotes", as advised by the help pages (http://www.smugmug.com/help/keywords-tags), it ends up in the database (as retrieved by images.getInfo) as "double quotes".
Fine, I can parse for that. But when I go to write keywords back out, I'm trying to use the API like so:
$changeinfo = $browser->post('http://api.smugmug.com/hack/rest/1.2.0/',
['method'=>'smugmug.images.changeSettings',
'SessionID'=>"$sessionid",
'ImageID'=>"$updateimage",
'Keywords'=>"$newkeywordstext"],) ;
If $newkeywordstext contains double-quotes (ex. "ty"), they appear in the web UI prepended with a \, and when I go back with an images.getInfo call, it shows up as:
\"ty\"
Blech. Ok, maybe I should try to HTML encode the double-quotes myself. So I try posting: "ty"
This time images.getInfo gives me the equally ugly:
"ty"
Nasty. I don't want to use semi-colons! Double-quotes make sense to me and to the non-coders that may be editing keywords. Also, I *need* double-quotes so that keywords < 4 characters will be recognized as keywords. Argh!
Any other suggestions on getting the API to properly accept double-quote characters? It kind of sucks when functionality on the website isn't duplicated in the API.
In the web UI, if you enter a keyword in "double quotes", as advised by the help pages (http://www.smugmug.com/help/keywords-tags), it ends up in the database (as retrieved by images.getInfo) as "double quotes".
Fine, I can parse for that. But when I go to write keywords back out, I'm trying to use the API like so:
$changeinfo = $browser->post('http://api.smugmug.com/hack/rest/1.2.0/',
['method'=>'smugmug.images.changeSettings',
'SessionID'=>"$sessionid",
'ImageID'=>"$updateimage",
'Keywords'=>"$newkeywordstext"],) ;
If $newkeywordstext contains double-quotes (ex. "ty"), they appear in the web UI prepended with a \, and when I go back with an images.getInfo call, it shows up as:
\&quot;ty\&quot;
Blech. Ok, maybe I should try to HTML encode the double-quotes myself. So I try posting: "ty"
This time images.getInfo gives me the equally ugly:
&amp;quot;ty&amp;quot;
Nasty. I don't want to use semi-colons! Double-quotes make sense to me and to the non-coders that may be editing keywords. Also, I *need* double-quotes so that keywords < 4 characters will be recognized as keywords. Argh!
Any other suggestions on getting the API to properly accept double-quote characters? It kind of sucks when functionality on the website isn't duplicated in the API.