/ Published in: Bash
auth2 playground at https://code.google.com/oauthplayground/
series of http requests to get auth token and then to request a couple of api URL's
series of http requests to get auth token and then to request a couple of api URL's
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
2 needed URLs : picasaweb.google.com/data/feed/api/user/rowntreerob/albumid/5677569274306148065?fields=@gd:*,entry/gphoto:id,entry/gphoto:timestamp picasaweb.google.com/data/feed/api/user/rowntreerob/albumid/5677569274306148065/photoid/5677569495943071042?fields=entry/link[@rel="edit"] series of actual requests to oauth and then to the gdata api ( picasa ) authorize api: GET /oauthplayground/?code=4/UuiRSrHbrT0R4sO1Bmc5Z68UgDlY HTTP/1.1 Host: code.google.com HTTP/1.1 302 Found Location: https://accounts.google.com/o/oauth2/auth?redirect_uri=https%3A%2F%2Fcode.google.com%2Foauthplayground %2F&response_type=code&client_id=99999999999.apps.googleusercontent.com&approval_prompt=force& scope=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2F&access_type=offline == exchng authorization for access token: POST /o/oauth2/token HTTP/1.1 Host: accounts.google.com content-type: application/x-www-form-urlencoded user-agent: google-oauth-playground code=4%2FUuiRSrHbrT0R4sO1Bmc5Z68UgDlY& redirect_uri=https%3A%2F%2Fcode.google.com%2Foauthplayground%2F &client_id=999999999999.apps.googleusercontent.com&scope= &client_secret=************&grant_type=authorization_code HTTP/1.1 200 Ok status: 200 content-length: 196 x-xss-protection: 1; mode=block x-content-type-options: nosniff expires: Fri, 01 Jan 1990 00:00:00 GMT x-google-cache-control: remote-fetch server: GSE via: HTTP/1.1 GWA pragma: no-cache cache-control: no-cache, no-store, max-age=0, must-revalidate date: Mon, 12 Dec 2011 18:38:08 GMT x-frame-options: SAMEORIGIN content-type: application/json -content-encoding: gzip { "access_token" : "ya29.AHES6ZSFQemR-du82WUi0R_lqJJL74_kR2HXbB6p75Q5J28", "token_type" : "Bearer", "expires_in" : 3600, "refresh_token" : "1/Xe6b_vIViKwQiFFnTmEygoy3GzE5KfatAZqvrFtW08w" } Get a series of photo timestamps from the album == add http hdr GData-Version : 2 == GET /data/feed/api/user/rowntreerob/albumid/5677569274306148065?fields=@gd:*,entry/gphoto:id,entry/gphoto:timestamp HTTP/1.1 Host: picasaweb.google.com GData-Version: 2 Authorization: OAuth ya29.AHES6ZSFQemR-du82WUi0R_lqJJL74_kR2HXbB6p75Q5J28 HTTP/1.1 200 OK status: 200 gdata-version: 2.0 content-length: 3500 via: HTTP/1.1 GWA content-location: https://picasaweb.google.com/data/feed/api/user/rowntreerob/albumid/5677569274306148065?fields=@gd:*,entry/gphoto:id,entry/gphoto:timestamp x-content-type-options: nosniff set-cookie: _rtok=PGdAQg3s3pC8; Path=/; Secure; HttpOnly, S=photos_html=lm4SDkufb3i0PYW2lZveEQ; Domain=.google.com; Path=/; Secure; HttpOnly expires: Mon, 12 Dec 2011 18:40:50 GMT vary: Accept, X-GData-Authorization, GData-Version, Cookie x-google-cache-control: remote-fetch server: GSE last-modified: Mon, 28 Nov 2011 19:57:09 GMT x-xss-protection: 1; mode=block etag: W/"CkUGSHYyeCp7ImA9WhRRFUw." cache-control: private, max-age=0, must-revalidate, no-transform date: Mon, 12 Dec 2011 18:40:50 GMT x-frame-options: SAMEORIGIN content-type: application/atom+xml; charset=UTF-8; type=feed -content-encoding: gzip <?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:gphoto='http://schemas.google.com/photos/2007' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/"CkUGSHYyeCp7ImA9WhRRFUw."' gd:fields='@gd:*,entry/gphoto:id,entry/gphoto:timestamp'><entry><gphoto:id>5677569292818283634</gphoto:id><gphoto:timestamp>1321879579000</gphoto:timestamp></entry><entry><gphoto:id>5677569322606354754</gphoto:id><gphoto:timestamp>1321879606000</gphoto:timestamp></entry><entry><gphoto:id>5677569342889525810</gphoto:id><gphoto:timestamp>1321879621000</gphoto:timestamp></entry><entry><gphoto:id>5677569368215390914</gphoto:id><gphoto:timestamp>1321879662000</gphoto:timestamp></entry><entry><gphoto:id>5677569385204261106</gphoto:id><gphoto:timestamp>1321879673000</gphoto:timestamp></entry><entry><gphoto:id>5677569415988585282</gphoto:id><gphoto:timestamp>1321879689000</gphoto:timestamp></entry><entry><gphoto:id>5677569452195798690</gphoto:id><gphoto:timestamp>1321879719000</gphoto:timestamp></entry><entry><gphoto:id>5677569477327748130</gphoto:id><gphoto:timestamp>1321879745000</gphoto:timestamp></entry><entry><gphoto:id>5677569495943071042</gphoto:id><gphoto:timestamp>1321879755000</gphoto:timestamp></entry><entry><gphoto:id>5677569521154963874</gphoto:id><gphoto:timestamp>1321879823000</gphoto:timestamp></entry><entry><gphoto:id>5677569555161637890</gphoto:id><gphoto:timestamp>1321879970000</gphoto:timestamp></entry><entry><gphoto:id>5677569572283417122</gphoto:id><gphoto:timestamp>1321879994000</gphoto:timestamp></entry><entry><gphoto:id>5677569598786243922</gphoto:id><gphoto:timestamp>1321880064000</gphoto:timestamp></entry><entry><gphoto:id>5677569627413415234</gphoto:id><gphoto:timestamp>1321880079000</gphoto:timestamp></entry><entry><gphoto:id>5677569651000334690</gphoto:id><gphoto:timestamp>1321880106000</gphoto:timestamp></entry><entry><gphoto:id>5677569681089735218</gphoto:id><gphoto:timestamp>1321880122000</gphoto:timestamp></entry><entry><gphoto:id>5677569713514297042</gphoto:id><gphoto:timestamp>1321880152000</gphoto:timestamp></entry><entry><gphoto:id>5677569735745025490</gphoto:id><gphoto:timestamp>1321880185000</gphoto:timestamp></entry><entry><gphoto:id>5677569753823258866</gphoto:id><gphoto:timestamp>1321880197000</gphoto:timestamp></entry><entry><gphoto:id>5677569772786575762</gphoto:id><gphoto:timestamp>1321880217000</gphoto:timestamp></entry><entry><gphoto:id>5677569793580534338</gphoto:id><gphoto:timestamp>1321880229000</gphoto:timestamp></entry><entry><gphoto:id>5677569813572766594</gphoto:id><gphoto:timestamp>1321880259000</gphoto:timestamp></entry><entry><gphoto:id>5677569838368234674</gphoto:id><gphoto:timestamp>1321880275000</gphoto:timestamp></entry><entry><gphoto:id>5677569873165421890</gphoto:id><gphoto:timestamp>1321880423000</gphoto:timestamp></entry><entry><gphoto:id>5677569894754579810</gphoto:id><gphoto:timestamp>1321880438000</gphoto:timestamp></entry><entry><gphoto:id>5677569920666655794</gphoto:id><gphoto:timestamp>1321880456000</gphoto:timestamp></entry><entry><gphoto:id>5677569953023433986</gphoto:id><gphoto:timestamp>1321880609000</gphoto:timestamp></entry><entry><gphoto:id>5677569975211866754</gphoto:id><gphoto:timestamp>1321880729000</gphoto:timestamp></entry><entry><gphoto:id>5677569989539929186</gphoto:id><gphoto:timestamp>1321880748000</gphoto:timestamp></entry><entry><gphoto:id>5677570015121770610</gphoto:id><gphoto:timestamp>1321880966000</gphoto:timestamp></entry></feed> == Get the edit link that will b needed in order to do the update on one of the photos returned in the album data GET /data/feed/api/user/rowntreerob/albumid/5677569274306148065/photoid/5677569495943071042?fields=link[@rel="edit"] HTTP/1.1 Host: picasaweb.google.com GData-Version: 2 Authorization: OAuth ya29.AHES6ZSFQemR-du82WUi0R_lqJJL74_kR2HXbB6p75Q5J28 HTTP/1.1 200 OK status: 200 gdata-version: 2.0 content-length: 257 via: HTTP/1.1 GWA content-location: https://picasaweb.google.com/data/feed/api/user/rowntreerob/albumid/5677569274306148065/photoid/5677569495943071042?fields=link[@rel="edit"] x-content-type-options: nosniff set-cookie: _rtok=kPSn48gXeSnP; Path=/; Secure; HttpOnly, S=photos_html=8cS2J49BJYEhf4aV5_8Z4w; Domain=.google.com; Path=/; Secure; HttpOnly expires: Mon, 12 Dec 2011 18:43:53 GMT vary: Accept, X-GData-Authorization, GData-Version, Cookie x-google-cache-control: remote-fetch server: GSE last-modified: Mon, 12 Dec 2011 16:00:00 GMT x-xss-protection: 1; mode=block etag: W/"D0EEQX47eCp7ImA9WhRQF00." cache-control: private, max-age=0, must-revalidate, no-transform date: Mon, 12 Dec 2011 18:43:53 GMT x-frame-options: SAMEORIGIN content-type: application/atom+xml; charset=UTF-8; type=feed -content-encoding: gzip <?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom'><link rel='edit' type='application/atom+xml' href='https://picasaweb.google.com/data/entry/api/user/rowntreerob/albumid/5677569274306148065/photoid/5677569495943071042'/></feed> last call as json request GET /data/feed/api/user/default/albumid/5677569274306148065/photoid/5677569495943071042?fields=link[@rel="edit"]&alt=json HTTP/1.1 Host: picasaweb.google.com GData-Version: 2 Authorization: OAuth ya29.AHES6ZSo--0s1tAGgpj3yfwTDj0mRrisANazdXnmTvUdfp8 HTTP/1.1 200 OK status: 200 gdata-version: 2.0 content-length: 263 via: HTTP/1.1 GWA content-location: https://picasaweb.google.com/data/feed/api/user/default/albumid/5677569274306148065/photoid/5677569495943071042?fields=link[@rel="edit"]&alt=json x-content-type-options: nosniff set-cookie: _rtok=oOOYRM4s39zE; Path=/; Secure; HttpOnly, S=photos_html=22xA5sTTzwmbDsLJN5QofQ; Domain=.google.com; Path=/; Secure; HttpOnly expires: Tue, 13 Dec 2011 01:40:22 GMT vary: Accept, X-GData-Authorization, GData-Version, Cookie x-google-cache-control: remote-fetch -content-encoding: gzip server: GSE last-modified: Tue, 13 Dec 2011 00:00:00 GMT x-xss-protection: 1; mode=block etag: W/"DkMEQX47eCp7ImA9WhRQF04." cache-control: private, max-age=0, must-revalidate, no-transform date: Tue, 13 Dec 2011 01:40:22 GMT access-control-allow-origin: * content-type: application/json; charset=UTF-8 x-frame-options: SAMEORIGIN {"version":"1.0","encoding":"UTF-8","feed":{ "xmlns":"http://www.w3.org/2005/Atom","link":[{"rel":"edit","type":"application/atom+xml", "href":"https://picasaweb.google.com/data/entry/api/user/rowntreerob/albumid/5677569274306148065/photoid/5677569495943071042"}]}} == do a partial update using the href in the above response