Skip to content

Instantly share code, notes, and snippets.

@sakadon
Last active November 7, 2015 11:21
Show Gist options
  • Save sakadon/228dd5748a6abb0af810 to your computer and use it in GitHub Desktop.
Save sakadon/228dd5748a6abb0af810 to your computer and use it in GitHub Desktop.
Google APIs Client Library for PHPでgd:etagを取得する ref: http://qiita.com/sakadon/items/34552fb99669d6879466
$sheet_id = '#########';
$request = new Google_Http_Request(
"https://spreadsheets.google.com/feeds/worksheets/{$sheet_id}/private/full?alt=json",
"GET",
array(
"Authorization" => "Bearer {$this->token}",
"GData-Version" => "3.0"
)
);
stdClass Object
(
[version] => 1.0
[encoding] => UTF-8
[feed] => stdClass Object
(
[xmlns] => http://www.w3.org/2005/Atom
[xmlns$openSearch] => http://a9.com/-/spec/opensearch/1.1/
[xmlns$gs] => http://schemas.google.com/spreadsheets/2006
[xmlns$gd] => http://schemas.google.com/g/2005
[gd$etag] => W/"AAAAAAAAAAAAAAAAAAAAAAA."
[id] => stdClass Object
(
[$t] => https://spreadsheets.google.com/feeds/worksheets/シートID/private/full
)
...
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended" gd:etag='"AAAAAAAAAAAAAAAAAAAAAAA."'>
<category scheme="http://schemas.google.com/spreadsheets/2006" term="http://schemas.google.com/spreadsheets/2006#list"/>
<id>{$lineid}</id>
<link rel="self" type="application/atom+xml" href="{$selfhref}"/>
<link rel="edit" type="application/atom+xml" href="{$edithref}"/>
<gsx:headname>Update</gsx:use>
</entry>
$request = new Google_Http_Request(
$edithref,
"PUT",
array(
"Authorization" => "Bearer {$accessToken}",
"Content-Type" => "application/atom+xml",
'GData-Version' => "3.0"
),
$postBody // <= ↑のXML
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment