Return to Snippet

Revision: 54454
at December 28, 2011 01:22 by rowntreerob


Updated Code
file content 'add-geo'... used for partial update on <georss:where/>

<?xml version='1.0' encoding='UTF-8' ?><entry xmlns='http://www.w3.org/2005/Atom' 
xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" 
xmlns:gml="http://www.opengis.net/gml" gd:fields="georss:where">
<georss:where><gml:Point><gml:pos>61.104 -149.580</gml:pos></gml:Point></georss:where></entry>

--- use oauth access token retreived using playgroud 
--- get the link rel='edit' URL needed for the partial update on the photo entry...

$ curl -i -k --header "GData-Version: 2" --header "Authorization: OAuth ya29.AHES6ZSridqaPo0vR4ZJ3vfl1BzcuKCxs8cVlzW1XOytQ5Syl6iROw" 
https://picasaweb.google.com/data/feed/api/user/rowntreerob/albumid/5657647416240712401/photoid/5657647761010952722?
fields=link%5B%40rel%3D%22edit%22%5D,gd:*

HTTP/1.1 200 OK
Expires: Mon, 26 Dec 2011 02:01:50 GMT
Date: Mon, 26 Dec 2011 02:01:50 GMT
Cache-Control: private, max-age=0, must-revalidate, no-transform
Set-Cookie: _rtok=yHEV0BiXvUvr; Path=/; Secure; HttpOnly
Set-Cookie: S=photos_html=REzh7Zgo3q97CH1xEmu8pw; Domain=.google.com; Path=/; Secure; HttpOnly
Content-Type: application/atom+xml; charset=UTF-8; type=feed
Vary: Accept, X-GData-Authorization, GData-Version, Cookie
GData-Version: 2.0
ETag: W/"DUEEQX47eCp7ImA9WhRXGEg."   /* unable to match this in the subsequent If-Match header */
Last-Modified: Mon, 26 Dec 2011 00:00:00 GMT
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Transfer-Encoding: chunked

<?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/5657647416240712401/photoid/5657647761010952722'/></feed>

---- PATCH the above link with contents of the file...
---- NOTE: may have to use rel='self' and NOT the rel='edit' link as shown

$ curl -X PATCH -k -i --upload-file add-geo --header "X-HTTP-Method-Override: PATCH" 
--header "GData-Version: 2" --header 
'Authorization: OAuth ya29.AHES6ZSridqaPo0vR4ZJ3vfl1BzcuKCxs8cVlzW1XOytQ5Syl6iROw' 
--header "If-Match: *"  --header "Content-Type: application/xml" 
https://picasaweb.google.com/data/entry/api/user/rowntreerob/albumid/5657647416240712401/photoid/5657647761010952722

HTTP/1.1 200 OK
Expires: Mon, 26 Dec 2011 02:07:07 GMT
Date: Mon, 26 Dec 2011 02:07:07 GMT
Cache-Control: private, max-age=0, must-revalidate
Set-Cookie: _rtok=c8UtMEhJeoZ3; Path=/; Secure; HttpOnly
Set-Cookie: S=photos_html=LqWrxAvs7iRXYFqKQ3GKsg; Domain=.google.com; Path=/; Secure; HttpOnly
Content-Type: application/atom+xml; charset=UTF-8; type=entry
GData-Version: 2.0
ETag: "YD8qeyI."
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Transfer-Encoding: chunked

<?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:exif='http://schemas.google.com/photos/exif/2007' xmlns:app='http://www.w
3.org/2007/app' xmlns:gphoto='http://schemas.google.com/photos/2007' xmlns:media='http://search.yahoo.com/mrss/' xmlns:gd='http://schemas.google.com/g/2005' xml
ns:gml='http://www.opengis.net/gml' xmlns:georss='http://www.georss.org/georss' gd:etag='&quot;YD8qeyI.&quot;'><id>https://picasaweb.google.com/data/entry/user/
rowntreerob/albumid/5657647416240712401/photoid/5657647761010952722</id><published>2011-09-29T05:22:49.000Z</published><updated>2011-12-26T02:07:08.115Z</update
d><app:edited>2011-12-26T02:07:08.115Z</app:edited><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/photos/2007#photo'/>
<title>ac01.jpg</title><summary/><content type='image/jpeg' src='https://lh5.googleusercontent.com/-hhk3yNxAYBM/ToQAqcNXihI/AAAAAAAACq0/Xw3QOe7cBt8/ac01.jpg'/><
link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://picasaweb.google.com/data/feed/api/user/rowntreerob/albumid/565764741
6240712401/photoid/5657647761010952722'/><link rel='alternate' type='text/html' href='https://picasaweb.google.com/113172267863552078400/Ak_sunset_up_hi_up_clos
e#5657647761010952722'/><link rel='http://schemas.google.com/photos/2007#canonical' type='text/html' href='https://picasaweb.google.com/lh/photo/xkTV2bpa8hR1ijh
QoDoGINMTjNZETYmyPJy0liipFm0'/><link rel='self' type='application/atom+xml' href='https://picasaweb.google.com/data/entry/api/user/rowntreerob/albumid/565764741
6240712401/photoid/5657647761010952722'/><link rel='edit' type='application/atom+xml' href='https://picasaweb.google.com/data/entry/api/user/rowntreerob/albumid
/5657647416240712401/photoid/5657647761010952722'/><link rel='edit-media' type='image/jpeg' href='https://picasaweb.google.com/data/media/api/user/rowntreerob/a
lbumid/5657647416240712401/photoid/5657647761010952722'/><link rel='http://schemas.google.com/photos/2007#report' type='text/html' href='https://picasaweb.googl
e.com/lh/reportAbuse?uname=rowntreerob&amp;aid=5657647416240712401&amp;iid=5657647761010952722'/><gphoto:id>5657647761010952722</gphoto:id><gphoto:albumid>56576
47416240712401</gphoto:albumid><gphoto:access>public</gphoto:access><gphoto:width>1361</gphoto:width><gphoto:height>916</gphoto:height><gphoto:size>1266131</gph
oto:size><gphoto:checksum>8b1a4092</gphoto:checksum><gphoto:timestamp>126273600000</gphoto:timestamp><gphoto:imageVersion>2733</gphoto:imageVersion><gphoto:comm
entingEnabled>true</gphoto:commentingEnabled><gphoto:commentCount>0</gphoto:commentCount><gphoto:license id='0' name='All Rights Reserved' url=''>ALL_RIGHTS_RES
ERVED</gphoto:license><gphoto:viewCount>2</gphoto:viewCount><exif:tags><exif:make>Nikon</exif:make><exif:model>LS-4000</exif:model><exif:time>126273600000</exif
:time><exif:imageUniqueID>be843f6c37732943ee24194cddbb3f94</exif:imageUniqueID></exif:tags><media:group><media:content url='https://lh5.googleusercontent.com/-h
hk3yNxAYBM/ToQAqcNXihI/AAAAAAAACq0/Xw3QOe7cBt8/ac01.jpg' height='345' width='512' type='image/jpeg' medium='image'/><media:credit>Robert Rowntree</media:credit>
<media:description type='plain'/><media:keywords/><media:thumbnail url='https://lh5.googleusercontent.com/-hhk3yNxAYBM/ToQAqcNXihI/AAAAAAAACq0/Xw3QOe7cBt8/s72/a
c01.jpg' height='49' width='72'/><media:thumbnail url='https://lh5.googleusercontent.com/-hhk3yNxAYBM/ToQAqcNXihI/AAAAAAAACq0/Xw3QOe7cBt8/s144/ac01.jpg' height=
'97' width='144'/><media:thumbnail url='https://lh5.googleusercontent.com/-hhk3yNxAYBM/ToQAqcNXihI/AAAAAAAACq0/Xw3QOe7cBt8/s288/ac01.jpg' height='194' width='28
8'/><media:title type='plain'>ac01.jpg</media:title></media:group><georss:where><gml:Point><gml:pos>61.104 -149.58</gml:pos></gml:Point></georss:where></entry>

Revision: 54453
at December 26, 2011 13:40 by rowntreerob


Initial Code
file content 'add-geo'... used for partial update on <georss:where/>

<?xml version='1.0' encoding='UTF-8' ?><entry xmlns='http://www.w3.org/2005/Atom' 
xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" 
xmlns:gml="http://www.opengis.net/gml" gd:fields="georss:where">
<georss:where><gml:Point><gml:pos>61.104 -149.580</gml:pos></gml:Point></georss:where></entry>

--- use oauth access token retreived using playgroud 
--- get the link rel='edit' URL needed for the partial update on the photo entry...

$ curl -i -k --header "GData-Version: 2" --header "Authorization: OAuth ya29.AHES6ZSridqaPo0vR4ZJ3vfl1BzcuKCxs8cVlzW1XOytQ5Syl6iROw" 
https://picasaweb.google.com/data/feed/api/user/rowntreerob/albumid/5657647416240712401/photoid/5657647761010952722?
fields=link%5B%40rel%3D%22edit%22%5D,gd:*

HTTP/1.1 200 OK
Expires: Mon, 26 Dec 2011 02:01:50 GMT
Date: Mon, 26 Dec 2011 02:01:50 GMT
Cache-Control: private, max-age=0, must-revalidate, no-transform
Set-Cookie: _rtok=yHEV0BiXvUvr; Path=/; Secure; HttpOnly
Set-Cookie: S=photos_html=REzh7Zgo3q97CH1xEmu8pw; Domain=.google.com; Path=/; Secure; HttpOnly
Content-Type: application/atom+xml; charset=UTF-8; type=feed
Vary: Accept, X-GData-Authorization, GData-Version, Cookie
GData-Version: 2.0
ETag: W/"DUEEQX47eCp7ImA9WhRXGEg."   /* unable to match this in the subsequent If-Match header */
Last-Modified: Mon, 26 Dec 2011 00:00:00 GMT
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Transfer-Encoding: chunked

<?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/5657647416240712401/photoid/5657647761010952722'/></feed>

---- PATCH the above link with contents of the file...

$ curl -X PATCH -k -i --upload-file add-geo --header "X-HTTP-Method-Override: PATCH" 
--header "GData-Version: 2" --header 
'Authorization: OAuth ya29.AHES6ZSridqaPo0vR4ZJ3vfl1BzcuKCxs8cVlzW1XOytQ5Syl6iROw' 
--header "If-Match: *"  --header "Content-Type: application/xml" 
https://picasaweb.google.com/data/entry/api/user/rowntreerob/albumid/5657647416240712401/photoid/5657647761010952722

HTTP/1.1 200 OK
Expires: Mon, 26 Dec 2011 02:07:07 GMT
Date: Mon, 26 Dec 2011 02:07:07 GMT
Cache-Control: private, max-age=0, must-revalidate
Set-Cookie: _rtok=c8UtMEhJeoZ3; Path=/; Secure; HttpOnly
Set-Cookie: S=photos_html=LqWrxAvs7iRXYFqKQ3GKsg; Domain=.google.com; Path=/; Secure; HttpOnly
Content-Type: application/atom+xml; charset=UTF-8; type=entry
GData-Version: 2.0
ETag: "YD8qeyI."
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Transfer-Encoding: chunked

<?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:exif='http://schemas.google.com/photos/exif/2007' xmlns:app='http://www.w
3.org/2007/app' xmlns:gphoto='http://schemas.google.com/photos/2007' xmlns:media='http://search.yahoo.com/mrss/' xmlns:gd='http://schemas.google.com/g/2005' xml
ns:gml='http://www.opengis.net/gml' xmlns:georss='http://www.georss.org/georss' gd:etag='&quot;YD8qeyI.&quot;'><id>https://picasaweb.google.com/data/entry/user/
rowntreerob/albumid/5657647416240712401/photoid/5657647761010952722</id><published>2011-09-29T05:22:49.000Z</published><updated>2011-12-26T02:07:08.115Z</update
d><app:edited>2011-12-26T02:07:08.115Z</app:edited><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/photos/2007#photo'/>
<title>ac01.jpg</title><summary/><content type='image/jpeg' src='https://lh5.googleusercontent.com/-hhk3yNxAYBM/ToQAqcNXihI/AAAAAAAACq0/Xw3QOe7cBt8/ac01.jpg'/><
link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://picasaweb.google.com/data/feed/api/user/rowntreerob/albumid/565764741
6240712401/photoid/5657647761010952722'/><link rel='alternate' type='text/html' href='https://picasaweb.google.com/113172267863552078400/Ak_sunset_up_hi_up_clos
e#5657647761010952722'/><link rel='http://schemas.google.com/photos/2007#canonical' type='text/html' href='https://picasaweb.google.com/lh/photo/xkTV2bpa8hR1ijh
QoDoGINMTjNZETYmyPJy0liipFm0'/><link rel='self' type='application/atom+xml' href='https://picasaweb.google.com/data/entry/api/user/rowntreerob/albumid/565764741
6240712401/photoid/5657647761010952722'/><link rel='edit' type='application/atom+xml' href='https://picasaweb.google.com/data/entry/api/user/rowntreerob/albumid
/5657647416240712401/photoid/5657647761010952722'/><link rel='edit-media' type='image/jpeg' href='https://picasaweb.google.com/data/media/api/user/rowntreerob/a
lbumid/5657647416240712401/photoid/5657647761010952722'/><link rel='http://schemas.google.com/photos/2007#report' type='text/html' href='https://picasaweb.googl
e.com/lh/reportAbuse?uname=rowntreerob&amp;aid=5657647416240712401&amp;iid=5657647761010952722'/><gphoto:id>5657647761010952722</gphoto:id><gphoto:albumid>56576
47416240712401</gphoto:albumid><gphoto:access>public</gphoto:access><gphoto:width>1361</gphoto:width><gphoto:height>916</gphoto:height><gphoto:size>1266131</gph
oto:size><gphoto:checksum>8b1a4092</gphoto:checksum><gphoto:timestamp>126273600000</gphoto:timestamp><gphoto:imageVersion>2733</gphoto:imageVersion><gphoto:comm
entingEnabled>true</gphoto:commentingEnabled><gphoto:commentCount>0</gphoto:commentCount><gphoto:license id='0' name='All Rights Reserved' url=''>ALL_RIGHTS_RES
ERVED</gphoto:license><gphoto:viewCount>2</gphoto:viewCount><exif:tags><exif:make>Nikon</exif:make><exif:model>LS-4000</exif:model><exif:time>126273600000</exif
:time><exif:imageUniqueID>be843f6c37732943ee24194cddbb3f94</exif:imageUniqueID></exif:tags><media:group><media:content url='https://lh5.googleusercontent.com/-h
hk3yNxAYBM/ToQAqcNXihI/AAAAAAAACq0/Xw3QOe7cBt8/ac01.jpg' height='345' width='512' type='image/jpeg' medium='image'/><media:credit>Robert Rowntree</media:credit>
<media:description type='plain'/><media:keywords/><media:thumbnail url='https://lh5.googleusercontent.com/-hhk3yNxAYBM/ToQAqcNXihI/AAAAAAAACq0/Xw3QOe7cBt8/s72/a
c01.jpg' height='49' width='72'/><media:thumbnail url='https://lh5.googleusercontent.com/-hhk3yNxAYBM/ToQAqcNXihI/AAAAAAAACq0/Xw3QOe7cBt8/s144/ac01.jpg' height=
'97' width='144'/><media:thumbnail url='https://lh5.googleusercontent.com/-hhk3yNxAYBM/ToQAqcNXihI/AAAAAAAACq0/Xw3QOe7cBt8/s288/ac01.jpg' height='194' width='28
8'/><media:title type='plain'>ac01.jpg</media:title></media:group><georss:where><gml:Point><gml:pos>61.104 -149.58</gml:pos></gml:Point></georss:where></entry>

Initial URL
http://code.google.com/apis/gdata/docs/2.0/reference.html#PartialUpdate

Initial Description
using Docs for gdata v 2 api

per the docs, there are multiple requests required and there are ETAG dependencies

in the partial update, the contents of the file 'add-geo' are added to the entity

Initial Title
GData ver. 2 & Curl - Partial update using Oauth version 2 . Add georss:where to photos

Initial Tags

                                

Initial Language
Bash