Sorry for mentioning REST! It is being used to get
frob/token etc
only. As you can see uploading photos, is simple post in the
code below.
--- In yws-flickr@yahoogroups.com, "Bob Boylan"
<Bob T...> wrote:
>
> could be because method should come after api_key
(alpha order)
within the post data? could be the rest api only handles
get requests
(not post)?
> ----- Original Message -----
> From: mridul
> To: yws-flickr@yahoogroups.com
> Sent: Wednesday, December 21, 2005 6:53 PM
> Subject: [yws-flickr] Problem with uploading photos
via REST
>
>
> hi,
> I have been using the following code snippet to
connect to flickr and
> upload photos. It is js and some functions in
konfabulator:
>
> .......................
> ......................
>
> //request token
>
>
sorted_params=shared_secret+'api_key'+apikey+'frob'+frob_dat
a+
> 'methodflickr.auth.getToken'
>
signature=hex_md5(sorted_params)
> url.postData =
>
"method=flickr.auth.getToken&api_key="+apikey+
"&frob="+frob_data+"&api_sig="+
> signature;
> contents =
> url.fetch("http://flickr.
com/services/rest/");
>
> print(contents);
>
> //extract token
> doc = XMLDOM.parse(contents)
> token =
doc.evaluate("string(rsp/auth/token)");
>
> print(token);
> //upload the files
>
>
sorted_params=shared_secret+'api_key'+apikey+'auth_token'+to
ken
>
signature=hex_md5(sorted_params)
>
>
uploadPhotoMetaData="api_key="+apikey+"&a
uth_token="+token+"&api_sig="+signature+&
quot;&pho
> to=yahoo.png"
> print ("Sending the
followingdata " +
> uploadPhotoMetaData)
> url.postData=
uploadPhotoMetaData
>
url.addPostFile("yahoo.png",
> "c:\mridul\yahoo.png");
> contents =
> url.fetch("http://w
ww.flickr.com/services/upload/");
> //openURL(postData);
> print (contents);
>
> ......................
> ......................
>
>
> Now while everything works,i.e I get a valid frob and
token etc
(which
> has the only small problem,that I need to generally
retry to get a
valid
> token twice)....upload photos fails and here is what
I see in the
debug
> window of konfab:
>
> Sending the followingdata
>
api_key=8XXXXXXXXXXX3e2f&auth_token=2XXXX-XXXXXXXXd3&
;api_sig=
> 162b1e542568c869559d395acda21599&photo=yahoo.png
> <?xml version="1.0"
encoding="utf-8" ?>
> <rsp stat="fail">
> <err code="96" msg="Invalid
signature" />
> </rsp>
>
>
> Could someone point what I am doing wrong?
>
> Mridul.
>
>
>
------------------------------------------------------------
------------------
> YAHOO! GROUPS LINKS
>
> a.. Visit your group "yws-flickr" on the
web.
>
> b.. To unsubscribe from this group, send an email
to:
> yws-flickr-unsubscribe@yahoogroups.com
>
> c.. Your use of Yahoo! Groups is subject to the
Yahoo! Terms of
Service.
>
>
>
------------------------------------------------------------
------------------
>
------------------------ Yahoo! Groups Sponsor
--------------------~-->
Most low income homes are not online. Make a difference this
holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/IHFolB/TM
------------------------------------------------------------
--------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://grou
ps.yahoo.com/group/yws-flickr/
<*> To unsubscribe from this group, send an email to:
yws-flickr-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|