Hi there,

I am trying to integrate Picasa API into my Rails application. 
I am using OAuth authentication. 
Here are the gems I use for that :
https://github.com/tokumine/GData
https://github.com/balexand/gdata_plus

I successfully can get a list of albums (including protected and private)

REQUEST:

*:method => :get, * 

*:url => https://picasaweb.google.com/data/feed/api/user/default,*
*:headers => {"User-Agent"=>"Typhoeus - 
http://github.com/dbalatero/typhoeus/tree/master";, "GData-Version"=>"2.0", 
"Authorization"=>"OAuth oauth_consumer_key=\"HERE_COMES_MY_CONSUMER_KEY\", 
oauth_nonce=\"pICdDYSRa8rpPFT47YhzYWiA0iAhy7BWhawaAeDcTY\", 
oauth_signature=\"ALx0DIc0H3J%2Bg1N8lwM%2BDg7fJWI%3D\", 
oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1299077792\", 
oauth_token=\"HERE_COMES_THE_TOKEN\", oauth_version=\"1.0\"", 
"If-Match"=>"*"}*


, get a list of photos in album. 

 
REQUEST:

*:method => :get,*
*:url => 
https://picasaweb.google.com/data/feed/api/user/default/albumid/5463273339983088929,
*
*:headers => {"User-Agent"=>"Typhoeus - 
http://github.com/dbalatero/typhoeus/tree/master";, "GData-Version"=>"2.0", 
"Authorization"=>"OAuth oauth_consumer_key=\"HERE_COMES_MY_CONSUMER_KEY\", 
oauth_nonce=\"HclGpoas0CvujB78GOZVHrqRNCb6XwcIeITWJJuQo\", 
oauth_signature=\"D83P9uri97SIavQX5yr4UEERB2c%3D\", 
oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1299078023\", 
oauth_token=\"HERE_COMES_THE_TOKEN\", oauth_version=\"1.0\"", 
"If-Match"=>"*"}*



Even uploading of a new photo works fine. 

REQUEST

*:method => :post,*
*:url => 
https://picasaweb.google.com/data/feed/api/user/default/albumid/5463273339983088929,
*
*:body => 
"\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x06\x00\x00\x00\x06\b\x02\x00\x00\x00o\xAEx\x1F\x00\x00\x00\x01sRGB\x00\xAE\xCE\x1C\xE9\x00\x00\x00\tpHYs\x00\x00\v\x13\x00\x00\v\x13\x01\x00\x9A\x9C\x18\x00\x00\x00\atIME\a\xDB\x03\x02\f\x10\x11p\xEC?\xD0\x00\x00\x00\x19tEXtComment\x00Created
 
with 
GIMPW\x81\x0E\x17\x00\x00\x00\x15IDAT\b\xD7c\xFC\xFF\xFF?\x03*`b\xC0\x00\xD4\x14\x02\x00Q\xDD\x03\t$\xAEd\x95\x00\x00\x00\x00IEND\xAEB`\x82",
*
*:headers => {"Content-Type"=>"image/png", "Content-Length"=>168, 
"Slug"=>"test.png", "User-Agent"=>"Typhoeus - 
http://github.com/dbalatero/typhoeus/tree/master";, "GData-Version"=>"2.0", 
"Authorization"=>"OAuth oauth_consumer_key=\"**HERE_COMES_**MY_CONSUMER_KEY*
*\", oauth_nonce=\"CVuTgXEYq8xerc6R5RccQvvFqlALVc5nkEetp03gmqM\", 
oauth_signature=\"E3BBYJGyYYW1LbMGcGYC1zHIUbY%3D\", 
oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1299078757\", 
oauth_token=\"HERE_COMES_THE_TOKEN\", oauth_version=\"1.0\""}*



But I can't create an album! :(

REQUEST
:method => :post,
:url => https://picasaweb.google.com/data/feed/api/user/default,
:body => "
*<entry xmlns='http://www.w3.org/2005/Atom'\n   
 xmlns:media='http://search.yahoo.com/mrss/'\n   
 xmlns:gphoto='http://schemas.google.com/photos/2007'>\n  <title 
type='text'></title>\n  *
*<summary type='text'></summary>\n  *
*<gphoto:location>Italy</gphoto:location>\n *
*<gphoto:access>public</gphoto:access>\n  *
*<gphoto:timestamp>1299078987</gphoto:timestamp>\n  *
*<media:group>\n    *
*<media:keywords>test</media:keywords>\n  *
*</media:group>\n  *
*<category scheme='http://schemas.google.com/g/2005#kind'\n   
 term='http://schemas.google.com/photos/2007#album'></category>\n*
*</entry>*\n"
,
:headers => {"User-Agent"=>"Typhoeus - 
http://github.com/dbalatero/typhoeus/tree/master";, "GData-Version"=>"2.0", 
"Authorization"=>"OAuth oauth_consumer_key=\"*HERE_COMES_**MY_CONSUMER_KEY*\", 
oauth_nonce=\"5AL54ODExfuxOM66sSIGxWI7fOot4dxvx2TjZkjs\", 
oauth_signature=\"H00Qd5T2A7RdQiWKhRfJtUIjxI8%3D\", 
oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1299078987\", 
oauth_token=\"*HERE_COMES_THE_TOKEN*\", oauth_version=\"1.0\""}

RESPONSE
Typhoeus::Response:0x000000052a13b8 *@code=403*, @curl_return_code=0, 
@curl_error_message="No error", @status_message=nil, @http_version=nil, 
@headers="HTTP/1.1 403 Forbidden\r\nExpires: Wed, 02 Mar 2011 15:16:28 
GMT\r\nDate: Wed, 02 Mar 2011 15:16:28 GMT\r\nCache-Control: private, 
max-age=0, must-revalidate\r\nContent-Type: 
text/plain\r\nX-Content-Type-Options: nosniff\r\nX-Frame-Options: 
SAMEORIGIN\r\nX-XSS-Protection: 1; mode=block\r\nSet-Cookie: 
S=photos_html=gCa-9xO4f24wcR6sy6_FTw; Domain=.google.com; Path=/; Secure; 
HttpOnly\r\nServer: GSE\r\nTransfer-Encoding: chunked\r\n\r\n",*@body="Unknown 
authorization header"
*, @time=0.49083600000000005, @requested_url=nil, 
@requested_http_method=nil, @start_time=nil, 
@start_transfer_time=0.49069300000000005, @app_connect_time=3.4e-05, 
@pretransfer_time=4.0e-05, @connect_time=3.3e-05, @name_lookup_time=3.1e-05, 
@request=:method => :post,
:url => https://picasaweb.google.com/data/feed/api/user/default,
:body => "<entry xmlns='http://www.w3.org/2005/Atom'\n   
 xmlns:media='http://search.yahoo.com/mrss/'\n   
 xmlns:gphoto='http://schemas.google.com/photos/2007'>\n  <title 
type='text'></title>\n  <summary type='text'></summary>\n 
 <gphoto:location>Italy</gphoto:location>\n 
 <gphoto:access></gphoto:access>\n 
 <gphoto:timestamp>1299078987</gphoto:timestamp>\n  <media:group>\n   
 <media:keywords></media:keywords>\n  </media:group>\n  <category 
scheme='http://schemas.google.com/g/2005#kind'\n   
 term='http://schemas.google.com/photos/2007#album'></category>\n</entry>\n",
:headers => {"User-Agent"=>"Typhoeus - 
http://github.com/dbalatero/typhoeus/tree/master";, "GData-Version"=>"2.0", 
"Authorization"=>"OAuth oauth_consumer_key=\"*HERE_COMES_**MY_CONSUMER_KEY*\", 
oauth_nonce=\"5AL54ODExfuxOM66sSIGxWI7fOot4dxvx2TjZkjs\", 
oauth_signature=\"H00Qd5T2A7RdQiWKhRfJtUIjxI8%3D\", 
oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1299078987\", 
oauth_token=\"*HERE_COMES_THE_TOKEN*\", oauth_version=\"1.0\""}, 
@effective_url="https://picasaweb.google.com/data/feed/api/user/default";, 
@mock=false


Instead of new album's ID, I get 403 Forbidden, response body contains 
"Unknown authorization header"

As you can see, I don't add any Content-Type or Content-Length headers, 
doing exactly as it was described in developers guide (
http://code.google.com/apis/picasaweb/docs/2.0/developers_guide_protocol.html#AddAlbums
)
But I also tried to add those headers too. It didn't help. 

Seems the problem is in authorization header, but what exactly wrong with 
it? 
Any ideas?

Thanks, 
Dmitri.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-picasa-data-api?hl=en.

Reply via email to