I tried to insert new image to google-picasa album using Gdata api
authenticate via oauth2.0 from request.js node.js module.
*My Function:*
insertPhoto(options,callback){
fs.readFile('C:/Users/Public/Pictures/Sample
Pictures/Chrysanthemum.jpg',"base64",function(error,data){
var userId=options.userId || 'default';
var
rootUrl='https://picasaweb.google.com/data/feed/api/user/'+userId+'/albumid/'+options.albumId+'';
var body_data=gen_multipart('testing.jpg','sss',data,'image/jpeg');
request({
method:'GET',
headers:{ 'GData-Version': '2','Authorization':'Bearer' + ' ' +
'my_access_token',"Content-Type":'multipart/related;
boundary="END_OF_PART"','Content-Length':body_data.length,"MIME-version":"1.0"},
body:body_data,
uri:rootUrl
},callback);
}); }
*Passing options and callback to my function*
insertPhoto({albumId:'5917473565459053457'},function(error,success){
if(error){
console.log(error);
}else{
console.log(success);
}});
*The following is my output*
{
status: 400,
message: '<!DOCTYPE html>\n<html lang=en>\n <meta charset=utf-8>\n <meta
nam
e=viewport content="initial-scale=1, minimum-scale=1,
width=device-width">\n <t
itle>Error 400 (Bad Request)!!1</title>\n <style>\n
*{margin:0;padding:0}htm
l,code{font:15px/22px
arial,sans-serif}html{background:#fff;color:#222;padding:1
5px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0
15px}*
> body{background:url(//www.google.com/images/errors/robot.png) 100% 5px
no-rep
eat;padding-right:205px}p{margin:11px 0
22px;overflow:hidden}ins{color:#777;text
-decoration:none}a img{border:0}@media screen and
(max-width:772px){body{backgro
und:none;margin-top:0;max-width:none;padding-right:0}}\n </style>\n <a
href=//
www.google.com/><img src=//www.google.com/images/errors/logo_sm.gif
alt=Google><
/a>\n <p><b>400.</b> <ins>That's an error.</ins>\n <p>Your client has
issued a
malformed or illegal request. <ins>That's all we know.</ins>\n' }
Your client has issued a malformed or illegal request.
what error is this my header and request body which i made is same as in google
documentation.
refer:
https://developers.google.com/picasa-web/docs/2.0/developers_guide_protocol#PostPhotos
what i did wrong can any one help me!!
--
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-picasa-data-api.
For more options, visit https://groups.google.com/groups/opt_out.