<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1982051675575479214</id><updated>2012-01-24T14:55:00.938-08:00</updated><category term='sites'/><category term='ruby'/><category term='debug'/><category term='xml'/><category term='calendar'/><category term='proxy'/><category term='authsub'/><category term='javascript'/><category term='signed'/><category term='java'/><category term='php'/><category term='ajax'/><category term='contacts'/><category term='secure'/><category term='youtube'/><category term='labels'/><category term='http'/><category term='curl'/><category term='json-in-script'/><category term='simplexml'/><category term='spreadsheets'/><category term='godaddy'/><category term='C#'/><category term='blogger'/><category term='prettyprint'/><category term='pwa'/><category term='js'/><category term='python'/><category term='base'/><category term='gdata'/><category term='DocList'/><category term='atom feed'/><category term='ClientLogin'/><category term='oauth'/><category term='zend'/><category term='health'/><category term='app engine'/><category term='json'/><category term='google apps'/><category term='utility'/><category term='.NET'/><title type='text'>Google Data API Tips</title><subtitle type='html'>Random code snippets for the Google Data APIs.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jeff Scudder</name><uri>http://www.blogger.com/profile/10171738514445498413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>63</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-6736350102672506632</id><published>2010-03-15T14:55:00.000-07:00</published><updated>2010-03-15T15:00:50.316-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sites'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Updating a Google Site Listpage/Listitem</title><content type='html'>&lt;p&gt;Here is a quick and dirty (by fully functional) sample of updating a &lt;a href="http://www.google.com/support/sites/bin/answer.py?hl=en&amp;answer=98361"&gt;listpage&lt;/a&gt;/listitem in Google Sites using the Data API.&lt;/p&gt;

&lt;pre name="code" class="python"&gt;
#!/usr/bin/python

import getpass
import gdata.sites.client
import gdata.sites.data

USER = 'test@example.com'
SITE = 'YOUR_SITE_NAME'
DOMAIN = 'YOUR_DOMAIN'  # or 'site' if you're not using a Google Apps domain.

# Setup our client.
client = gdata.sites.client.SitesClient(source='google-SitesListeItemUpdateTest', site=SITE, domain=DOMAIN)
client.ClientLogin(USER, getpass.getpass(), client.source)
client.ssl = True
client.http_client.debug = False

# Only fetch listpages.
feed = client.GetContentFeed(uri=client.MakeContentFeedUri() + '?kind=listpage')

# Work with first listpage we found.
lp = feed.GetListPages()[0]

print 'Listpage columns:'
for col in lp.data.column:
  print 'index: %s, name: %s' % (col.index, col.name)

# Query the listpage's listems and work with first row found.
li = client.GetContentFeed(uri=lp.feed_link.href).entry[0]

print 'Row contents:'
for field in li.field:
  print 'index: %s, name: %s, value: %s' % (field.index, field.name, field.text)

# Update the first fields/column's value.
li.field[0].text = 'Someone else'
entry = client.Update(li)

# Update the listpage's column heading.
#lp.data.column[0].name = 'New Heading'
#entry2 = client.Update(lp)
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-6736350102672506632?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/6736350102672506632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=6736350102672506632' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6736350102672506632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6736350102672506632'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2010/03/updating-google-site-listpagelistitem.html' title='Updating a Google Site Listpage/Listitem'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-8399600534788836306</id><published>2010-01-13T13:18:00.000-08:00</published><updated>2010-01-13T13:33:04.734-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Download your DocList arbitrary file uploads in .NET</title><content type='html'>&lt;p&gt;The .NET client's &lt;a href="http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/src/gdocuments/docrequest.cs#594"&gt;Download() method&lt;/a&gt; currently handles exporting documents, presentations, and spreadsheets. However, it cannot download PDFs or arbitrary file types. Those types cannot be exported to different formats. Instead, you need to override the Download() method in docsrequest.cs to hit the content src link:&lt;/p&gt;

&lt;pre name="code" class="c#"&gt;
public Stream Download(Document document) {
  string queryUri = "";
  Service s = this.Service;

  string downloadUrl = document.DocumentEntry.Content.Src.ToString();
  Uri target = new Uri(downloadUrl);

  return s.Query(target);
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-8399600534788836306?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/8399600534788836306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=8399600534788836306' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8399600534788836306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8399600534788836306'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2010/01/download-your-doclist-arbitrary-file.html' title='Download your DocList arbitrary file uploads in .NET'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-8944048761819533298</id><published>2009-12-30T12:09:00.000-08:00</published><updated>2009-12-30T12:16:58.224-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='calendar'/><title type='text'>Making a Calendar public via the ACL feed</title><content type='html'>&lt;p&gt;Google Calendar allows individual calendars to be marked as public, meaning that they can be accessed either via the Calendar UI, embeded calendars, or the Calendar Data API without requiring a password.&lt;/p&gt;

&lt;p&gt;Normally, this option is enabled from within the Calendar UI. However, it can be enabled using the Calendar Data API as well. To do so, you'd send the following HTTP request:&lt;/p&gt;

&lt;pre name="code" class="xml"&gt;
POST /calendar/feeds/default/acl/full
Host: www.google.com

&lt;entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"&gt;
  &lt;category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"&gt;&lt;/category&gt;
  &lt;gAcl:role value="http://schemas.google.com/gCal/2005#read"&gt;&lt;/gAcl:role&gt;
  &lt;gAcl:scope type="default"&gt;&lt;/gAcl:scope&gt;
&lt;/entry&gt;
&lt;/pre&gt;

&lt;p&gt;In this case, this will make the default calendar as public. If you want to make a secondary calendar public, replace &lt;code&gt;default&lt;/code&gt; in the request's location with the desired calendar ID.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-8944048761819533298?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/8944048761819533298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=8944048761819533298' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8944048761819533298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8944048761819533298'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2009/12/making-calendar-public-via-acl-feed.html' title='Making a Calendar public via the ACL feed'/><author><name>Trevor Johns</name><uri>http://www.blogger.com/profile/16057630924335188659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-5506034110979249245</id><published>2009-08-24T18:55:00.000-07:00</published><updated>2009-08-31T03:48:31.376-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Update a document's content in .NET</title><content type='html'>&lt;pre name="code" class="c#"&gt;

class Demo {
  private DocumentsService service = null;

  public Demo() {
    service = new DocumentsService("google-DocUpdateTip-v1");
    service.setUserCredentials("username@gmail.com", "pa$$word");
    GDataGAuthRequestFactory reqFactory = (GDataGAuthRequestFactory)service.RequestFactory;
    reqFactory.ProtocolMajor = 3;
  }

  static void Main(string[] args) {
    Demo demo = new Demo();

    // Fetch only documents
    DocumentsListQuery query = new DocumentsListQuery("http://docs.google.com/feeds/default/private/full/-/document");
    DocumentsFeed doclistFeed = demo.service.Query(query);

    // Update first document found
    DocumentEntry entry = (DocumentEntry)doclistFeed.Entries[0];
    Console.WriteLine("Updating " + entry.Title.Text + "...");

    DocumentEntry updatedEntry = demo.UpdateDocContents(entry, "C:/Documents and Settings/replacement.doc");
    Console.WriteLine(entry.Title.Text + " Updated!, view at " + entry.AlternateUri.ToString());
  }

  public DocumentEntry UpdateDocContents(DocumentEntry entryToUpdate, String replacementFileName) {
    FileInfo fileInfo = new FileInfo(replacementFileName);
    FileStream stream = fileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

    DocumentEntry entry = null;

    try {
      // Convert the extension to caps and strip the "." off the front
      String ext = fileInfo.Extension.ToUpper().Substring(1);

      String contentType = (String)DocumentsService.GDocumentsAllowedTypes[ext];
      if (contentType == null) {
        throw new ArgumentException("File extension '" + ext + "' is not recognized as valid.");
      }
      
      // Set ETag because we're making an update
      GDataRequestFactory factory = (GDataRequestFactory)service.RequestFactory;
      factory.CustomHeaders.Add("If-Match: " + entryToUpdate.Etag);

      Uri mediaUri = new Uri(entryToUpdate.MediaUri.ToString());
      entry = service.Update(mediaUri, stream, contentType, entryToUpdate.Title.Text) as DocumentEntry;
    } finally {
      stream.Close();
    }

    return entry;
  }
}


&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-5506034110979249245?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/5506034110979249245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=5506034110979249245' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5506034110979249245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5506034110979249245'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2009/08/update-documents-content-in-net.html' title='Update a document&apos;s content in .NET'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-1023557854456961422</id><published>2009-07-27T15:01:00.000-07:00</published><updated>2009-07-27T15:35:11.668-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><title type='text'>Create a new Google Docs Spreadsheet from content using AJAX</title><content type='html'>This example shows how one could use jQuery to make an AJAX request that creates new Google Docs Spreadsheet from existing text/csv content.  This particular examples uses &lt;a href="http://code.google.com/apis/gdata/auth.html#ClientLogin"&gt;ClientLogin&lt;/a&gt;

&lt;pre name="code" class="javascript"&gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"
        type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;script type="text/javascript"&amp;gt;
var token = 'YOUR_CLIENTLOGIN_AUTH_TOKEN';

function constructContentBody(docTitle, docType, contentBody, contentType) {
  var atom = ["&amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;gt;",
              '&amp;lt;entry xmlns="http://www.w3.org/2005/Atom"&amp;gt;',
              '&amp;lt;category scheme="http://schemas.google.com/g/2005#kind"',
              ' term="http://schemas.google.com/docs/2007#', docType, '"/&amp;gt;',
              '&amp;lt;title&amp;gt;', docTitle, '&amp;lt;/title&amp;gt;',
              '&amp;lt;/entry&amp;gt;'].join('');
             
  var body = ['--END_OF_PART\r\n',
              'Content-Type: application/atom+xml;\r\n\r\n',
              atom, '\r\n',
              '--END_OF_PART\r\n',
              'Content-Type: ', contentType, '\r\n\r\n',
              contentBody, '\r\n',
              '--END_OF_PART--\r\n'].join('');
  return body;
}

function createSpreadsheetFromContent(title, content, contentType) {
  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");

  $.ajax({
    type: 'POST',
    url: 'http://docs.google.com/feeds/documents/private/full',
    contentType: 'multipart/related; boundary=END_OF_PART',
    data: constructContentBody(title, 'spreadsheet', content, contentType),
    dataType: 'xml',
    beforeSend: function(xhr) {
      $('#data').html('uploading...');
      xhr.setRequestHeader('Authorization', 'GoogleLogin auth=' + token);
    },
    success: function(resp) {
      $('#data').html('Spreadsheet created!');
    }
  });
}
&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;div id="data"&amp;gt;&amp;lt;/div&amp;gt;

&amp;lt;button onclick="createSpreadsheetFromContent('ANewTitle', '1,2,3,4', 'text/csv')"&amp;gt;Create spreadsheet w/ content&amp;lt;/button&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-1023557854456961422?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/1023557854456961422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=1023557854456961422' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1023557854456961422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1023557854456961422'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2009/07/create-new-google-docs-spreadsheet-from.html' title='Create a new Google Docs Spreadsheet from content using AJAX'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-985504519947528473</id><published>2009-07-15T13:15:00.000-07:00</published><updated>2009-08-31T03:29:39.348-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Download a Google Doc using the PHP library</title><content type='html'>&lt;p&gt;At the time of writing this tip, the &lt;code&gt;Zend_Gdata_Docs&lt;/code&gt; component of the PHP library does not contain the export/download functionality of the &lt;a href="http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#DownloadingDocs"&gt;DocList API&lt;/a&gt;.  Here is an example of using AuthSub and &lt;code&gt;file_get_contents()&lt;/code&gt; to download a document as a &lt;code&gt;.txt&lt;/code&gt; file:&lt;/p&gt;

&lt;pre name="code" class="php"&gt;
function download($client, $url, $format=null) {
  $sessionToken = $client-&amp;gt;getHttpClient()-&amp;gt;getAuthSubToken();
  $opts = array(
    'http' =&amp;gt; array(
      'method' =&amp;gt; 'GET',
      'header' =&amp;gt; "GData-Version: 3.0\r\n".
                  "Authorization: AuthSub token=\"$sessionToken\"\r\n"
    )
  );
  if ($url != null) {
    $url =  $url . "&amp;amp;exportFormat=$format";
  }
  return file_get_contents($url, false, stream_context_create($opts));
}

// TODO 1: setup a Zend_Gdata_Docs client in $docs_client
// TODO 2: fetch a $feed or $entry
$contentLink = $feed-&amp;gt;entries[0]-&amp;gt;content-&amp;gt;getSrc();
$fileContents = download($docs_client, $contentLink, 'txt');
echo 'Contents of document "' . $feed-&amp;gt;entries[0]-&amp;gt;title . '":&amp;lt;hr&amp;gt;';
echo "&amp;lt;pre&amp;gt;$fileContents&amp;lt;/pre&amp;gt;";

&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-985504519947528473?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/985504519947528473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=985504519947528473' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/985504519947528473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/985504519947528473'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2009/07/download-google-doc-using-php-library.html' title='Download a Google Doc using the PHP library'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-7563815959537939788</id><published>2009-04-06T16:46:00.000-07:00</published><updated>2009-06-08T15:38:08.635-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='app engine'/><category scheme='http://www.blogger.com/atom/ns#' term='gdata'/><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='oauth'/><title type='text'>OAuth in Google App Engine</title><content type='html'>&lt;p&gt;This sample demonstrates a basic structure that you can use to perform &lt;a href="http://code.google.com/apis/gdata/articles/oauth.html"&gt;3-legged OAuth&lt;/a&gt; using the &lt;a href="http://code.google.com/apis/gdata/articles/python_client_lib.html"&gt;Google Data Python client library&lt;/a&gt; in &lt;a href="http://code.google.com/appengine/"&gt;Google App Engine&lt;/a&gt;. This particular example talks to the &lt;a href="http://code.google.com/apis/documents/"&gt;Documents List Data API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/gdata-python-client/source/browse/#svn/trunk/samples/oauth/oauth_on_appengine"&gt;App Engine (Python) + OAuth sample&lt;/a&gt;&lt;/p&gt;

Note: The sample is available in two versions, one that signs requests with RSA-SHA1 and another that signs with HMAC-SHA1.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-7563815959537939788?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/7563815959537939788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=7563815959537939788' title='20 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/7563815959537939788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/7563815959537939788'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2009/04/oauth-in-google-app-engine.html' title='OAuth in Google App Engine'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>20</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-2219052169257999438</id><published>2009-01-05T22:00:00.000-08:00</published><updated>2009-01-06T11:06:02.881-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><title type='text'>Retrieving a document's content URL in Java</title><content type='html'>If you have a published document, its contents can be viewed by fetching the DocumentListEntry object's &amp;lt;content&amp;gt; src URL:
&lt;pre class="java" name="code"&gt;
List&amp;lt;DocumentListEntry&amp;gt; entries = resultFeed.getEntries();
for (DocumentListEntry entry : entries) {
  MediaContent content = (MediaContent)entry.getContent();
  System.out.println("View '" + entry.getTitle().getPlainText() + "' at " + content.getUri());        
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-2219052169257999438?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/2219052169257999438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=2219052169257999438' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2219052169257999438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2219052169257999438'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2009/01/retrieve-documents-content-in-java_05.html' title='Retrieving a document&apos;s content URL in Java'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-6043865128649656997</id><published>2008-12-09T12:46:00.000-08:00</published><updated>2008-12-09T12:49:37.674-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pwa'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Geo-Tagging a Picasa Photo in PHP</title><content type='html'>Assuming that $gp is a Zend_Gdata_Photos object, this will tag the $photoEntry with the specified latitude and longitude. (Note you still have to insert or update the $photoEntry.)

&lt;pre name="code" class="php"&gt;
$gp-&gt;registerPackage('Zend_Gdata_Geo');
$gp-&gt;registerPackage('Zend_Gdata_Geo_Extension');
$where = $gp-&gt;newGeoRssWhere();
$position = $gp-&gt;newGmlPos('37.0 -122.0');
$where-&gt;point = $gp-&gt;newGmlPoint($position);
$photoEntry-&gt;setGeoRssWhere($where);
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-6043865128649656997?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/6043865128649656997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=6043865128649656997' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6043865128649656997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6043865128649656997'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/12/geo-tagging-picasa-photo-in-php.html' title='Geo-Tagging a Picasa Photo in PHP'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-5867570239768784542</id><published>2008-12-05T16:13:00.000-08:00</published><updated>2008-12-05T16:41:03.186-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='base'/><title type='text'>Constructing unsupported XML elements using the PHP client library</title><content type='html'>&lt;p&gt;When a new XML element is introduced, client library support needs to be added.  At times, the services move a bit faster than the client libraries.  This means that (as per the AtomPub spec) clients must store all unknown elements returned from the server.  Clients may also wish to be able to use new functionality which isn't explicitly supported yet in the libraries, so clients can allow you to create arbitrary XML elements and attach them to entries.&lt;/p&gt;

&lt;p&gt;The PHP client library accomplishes this using extension elements, represented as instances of &lt;code&gt;Zend_Gdata_App_Extension_Element&lt;/code&gt;.  Each time the server returns an element that is unknown to the client library, the client creates an instance of that class and stores it in the &lt;code&gt;extensionElements&lt;/code&gt; array of the class representing the parent element.  In order to send arbitrary XML, you can also construct a new &lt;code&gt;Zend_Gdata_App_Extension_Element&lt;/code&gt; and place it in the &lt;code&gt;extensionElements&lt;/code&gt; array.&lt;/p&gt;

&lt;p&gt;As an example, Google Base added a &lt;a href="http://code.google.com/apis/base/starting-out.html#PubPriority"&gt;publishing priority&lt;/a&gt; option, specified by adding a &lt;code&gt;&amp;lt;gm:publishing_priority&amp;gt;&lt;/code&gt; element.  At the time of this post, the element isn't supported by a class in the PHP client library, so here's how you can add it.&lt;/p&gt;

&lt;pre name="code" class="php"&gt;
&amp;lt;?php
require_once 'Zend/Gdata/Gbase.php';
require_once 'Zend/Gdata/App/Extension/Element.php';

$base = new Zend_Gdata_Gbase();
$entry = $base-&amp;gt;newItemEntry();

// Constructing a Zend_Gdata_App_Extension_Control
$control = $base-&amp;gt;newControl(); 

// Constructing the extension element, and placing it into the array
// of extension owned by the class representing the parent app:control element.
// Arguments: 
//   element name (including prefix)
//   namespace prefix
//   namespace URI
//   text node of the new element
$control-&gt;extensionElements = array(
  new Zend_Gdata_App_Extension_Element('gm:publishing_priority', 'gm', 'http://base.google.com/ns-metadata/1.0', 'high')
);
$entry-&amp;gt;control = $control;
&lt;/pre&gt;

&lt;p&gt;Of course, if you discover missing elements, please feel free to file an issue in the &lt;a href="http://framework.zend.com/issues/"&gt;Zend Framework issue tracker&lt;/a&gt; and, since it's open source, you can also contribute a fix back to the project.  More information on contributing can be found on the &lt;a href="http://framework.zend.com/wiki/display/ZFDEV/Contributing+to+Zend+Framework"&gt;Zend Framework wiki&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-5867570239768784542?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/5867570239768784542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=5867570239768784542' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5867570239768784542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5867570239768784542'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/12/creating-extension-elements-in-php.html' title='Constructing unsupported XML elements using the PHP client library'/><author><name>api.rboyd</name><uri>http://www.blogger.com/profile/08405436280227503401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-9209631686132863009</id><published>2008-12-03T21:34:00.000-08:00</published><updated>2008-12-07T11:34:54.585-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><title type='text'>Using the JavaScript Client Library w/ non-supported Services</title><content type='html'>The &lt;a href="http://code.google.com/apis/gdata/client-js.html"&gt;JavaScript client library&lt;/a&gt; has helper methods for Calendar, Contacts, Blogger, and Google Finance.  However, you can use it with just about any Google Data API to access authenticated/private feeds.  

This example uses the &lt;a href="http://code.google.com/apis/documents/overview.html"&gt;DocList API&lt;/a&gt;.

&lt;pre name="code" class="javascript"&gt;
&amp;lt;script src="http://www.google.com/jsapi" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript"&amp;gt;
google.load('gdata', '1.x');
google.setOnLoadCallback(initialize);

function initialize() {
  var scope = 'http://docs.google.com/feeds/';
  if (google.accounts.user.checkLogin(scope)) {   
    var service = new google.gdata.client.GoogleService('writely', 'DocList-App-v1.0'); 
    service.getFeed(scope + 'documents/private/full/', handleFeed, handleError);
  } else {
    var token = google.accounts.user.login(scope); // can ignore returned token
  }
};

var handleFeed = function(response) {
  var entries = response.feed.entry;
  if (!entries.length) {
    alert('You have no entries!');
    return;
  }
  var html = [];
  for (var i = 0, entry; entry = entries[i]; i++) {
    var title = entry.title.$t;
    html.push('&amp;lt;li&amp;gt;' + title + '&amp;lt;/li&amp;gt;');
  }
  document.getElementById('data').innerHTML = html.join('');
};

var handleError = function(e) {
  alert('Error: ' + e.cause ? e.cause.statusText : e.message);
};
&amp;lt;/script&amp;gt;

&amp;lt;div id="data"&amp;gt;&amp;lt;!-- dynamically filled --&amp;gt;&amp;lt;/div&amp;gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-9209631686132863009?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/9209631686132863009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=9209631686132863009' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/9209631686132863009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/9209631686132863009'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/12/using-javascript-client-library-w-non.html' title='Using the JavaScript Client Library w/ non-supported Services'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-1667981600982072352</id><published>2008-11-23T10:05:00.000-08:00</published><updated>2009-06-09T14:33:20.864-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='signed'/><category scheme='http://www.blogger.com/atom/ns#' term='contacts'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='google apps'/><category scheme='http://www.blogger.com/atom/ns#' term='oauth'/><title type='text'>2 Legged OAuth in Python</title><content type='html'>Google Apps Premier/Education administrators can take advantage of &lt;a href="http://code.google.com/apis/accounts/docs/OAuth.html#GoogleAppsOAuth"&gt;2 legged OAuth&lt;/a&gt; to communicate with the Google Data APIs.

If you're using the &lt;a href="http://code.google.com/p/gdata-python-client/"&gt;Google Data Python client library&lt;/a&gt; 1.2.3+:

&lt;strong&gt;An updated sample is here available &lt;a href="http://code.google.com/p/gdata-python-client/source/browse/trunk/samples/oauth/2_legged_oauth.py"&gt;here&lt;/a&gt;&lt;/strong&gt;.

Otherwise, if you're stuck with an older version of the library (&amp;lt; 1.2.3), you can use the
&lt;a href="http://code.google.com/p/oauth/"&gt;Python OAuth library from oauth.net&lt;/a&gt;.

&lt;pre name="code" class="python"&gt;
import urllib
import oauth
import gdata.contacts
import gdata.contacts.service

CONSUMER_KEY = 'yourdomain.com'
CONSUMER_SECRET = 'YOUR_CONSUMER_SECRET'
CONTACTS_URL = 'http://www.google.com/m8/feeds/contacts/default/full'

# Setup 2 legged OAuth consumer based on our admin "credentials"
consumer = oauth.OAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET)

user = 'any.user@yourdomain.com'
params = {'max-results': 50, 'xoauth_requestor_id': user}

# Construct the request manually and sign it using HMAC-SHA1
# Note: The params dictionary needs to be passed in separately from the base URL
request = oauth.OAuthRequest.from_consumer_and_token(
   consumer, http_method='GET', http_url=CONTACTS_URL, parameters=params)
request.sign_request(oauth.OAuthSignatureMethod_HMAC_SHA1(), consumer, None)

# See patch @ http://code.google.com/p/oauth/issues/detail?id=31
headers = request.to_header()

client = gdata.contacts.service.ContactsService()

# Query the user's contacts and print their name &amp;amp; email
uri = '%s?%s' % (request.http_url, urllib.urlencode(params))
feed = client.GetFeed(uri, extra_headers=headers, converter=gdata.contacts.ContactsFeedFromString)
for entry in feed.entry:
 print '%s, %s' % (entry.title.text, entry.email[0].address)
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-1667981600982072352?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/1667981600982072352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=1667981600982072352' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1667981600982072352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1667981600982072352'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/11/2-legged-oauth-in-python.html' title='2 Legged OAuth in Python'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-3393962929813918136</id><published>2008-11-21T11:17:00.000-08:00</published><updated>2008-11-21T11:19:03.671-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Paging Through Feeds in Python</title><content type='html'>&lt;p&gt;If you have a feed object you use&lt;/p&gt;


&lt;pre name="code" class="python"&gt;
feed.GetNextLink().href
&lt;/pre&gt;

&lt;p&gt;to find the URL of the next page of results. Then you can use that to
query for more like so:&lt;/p&gt;


&lt;pre name="code" class="python"&gt;
nextPageFeed = service.Query(feed.GetNextLink().href) 
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-3393962929813918136?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/3393962929813918136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=3393962929813918136' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/3393962929813918136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/3393962929813918136'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/11/paging-through-feeds-in-python.html' title='Paging Through Feeds in Python'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-3051071175968775470</id><published>2008-11-20T13:32:00.000-08:00</published><updated>2008-11-24T12:43:22.430-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Dealing with YouTube videos that you can't embed</title><content type='html'>&lt;p&gt;If you are using the YouTube Player APIs you will notice that some videos will refuse to load on your site. This is because the owner of that video has requested that embedding be disabled. You can tell on the video watch page because it will say "Embedding disabled by request" in place of the standard embed code:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.youtube.com/watch?v=juPxfHO50oo"&gt;http://www.youtube.com/watch?v=juPxfHO50oo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are retrieving videos to display using the Data API you should use the &lt;a href="http://code.google.com/apis/youtube/2.0/reference.html#formatsp"&gt;format parameter&lt;/a&gt; set to 5 in order to filter out non-embeddable videos:&lt;/p&gt;

&lt;pre&gt;http://gdata.youtube.com/feeds/api/videos?v=2&amp;format=5&lt;/pre&gt;

&lt;p&gt;The Data API also has the &lt;a href="http://code.google.com/apis/youtube/2.0/reference.html#youtube_data_api_tag_yt:noembed"&gt;&lt;code&gt;&amp;lt;yt:noembed&amp;gt;&lt;/code&gt;&lt;/a&gt; tag included in the video entry when the video cannot be embedded. A video entry can be retrieved using:&lt;/p&gt;

&lt;pre&gt;http://gdata.youtube.com/feeds/api/videos/VIDEO_ID&lt;/pre&gt;

&lt;p&gt;If you are using the Player JavaScript or AS2 API you should also handle the &lt;a href="http://code.google.com/apis/youtube/js_api_reference.html#Events"&gt;onError event&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-3051071175968775470?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/3051071175968775470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=3051071175968775470' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/3051071175968775470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/3051071175968775470'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/11/dealing-with-youtube-videos-that-you.html' title='Dealing with YouTube videos that you can&apos;t embed'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-2235668476002627866</id><published>2008-11-20T09:33:00.000-08:00</published><updated>2008-12-10T13:46:47.043-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curl'/><category scheme='http://www.blogger.com/atom/ns#' term='contacts'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='oauth'/><title type='text'>2 Legged OAuth in PHP</title><content type='html'>Google Apps Premier/Education administrators can take advantage of &lt;a href="http://code.google.com/apis/accounts/docs/OAuth.html#GoogleAppsOAuth"&gt;2 legged OAuth&lt;/a&gt; to communicate with the Google Data APIs. This sample makes use of the &lt;a href="http://oauth.googlecode.com/svn/code/php/OAuth.php"&gt;PHP OAuth library&lt;/a&gt; from oauth.net.

&lt;pre name="code" class="php"&gt;
&amp;lt;?php
require_once('OAuth.php');

// Establish an OAuth consumer based on our admin 'credentials'
$CONSUMER_KEY = 'yourdomain.com'; 
$CONSUMER_SECRET = 'YOUR_CONSUMER_SECRET'; 
$consumer = new OAuthConsumer($CONSUMER_KEY, $CONSUMER_SECRET, NULL);

// Setup OAuth request based our previous credentials and query
$user= 'any.user@yourdomain.com';
$base_feed = 'http://www.google.com/m8/feeds/contacts/default/full/';
$params = array('max-results' =&amp;gt; 10, 'xoauth_requestor_id' =&amp;gt; $user);
$request = OAuthRequest::from_consumer_and_token($consumer, NULL, 'GET', $base_feed, $params);

// Sign the constructed OAuth request using HMAC-SHA1
$request-&amp;gt;sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL);

// Make signed OAuth request to the Contacts API server
$url = $base_feed . '?' . implode_assoc('=', '&amp;', $params);
echo send_request($request-&gt;get_normalized_http_method(), $url, $request-&amp;gt;to_header());
 
/**
 * Makes an HTTP request to the specified URL
 * @param string $http_method The HTTP method (GET, POST, PUT, DELETE)
 * @param string $url Full URL of the resource to access
 * @param string $auth_header (optional) Authorization header
 * @param string $postData (optional) POST/PUT request body
 * @return string Response body from the server
 */
function send_request($http_method, $url, $auth_header=null, $postData=null) {
  $curl = curl_init($url);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_FAILONERROR, false);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

  switch($http_method) {
    case 'GET':
      if ($auth_header) {
        curl_setopt($curl, CURLOPT_HTTPHEADER, array($auth_header)); 
      }
      break;
    case 'POST':
      curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/atom+xml', 
                                                   $auth_header)); 
      curl_setopt($curl, CURLOPT_POST, 1);                                       
      curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
      break;
    case 'PUT':
      curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/atom+xml', 
                                                   $auth_header)); 
      curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $http_method);
      curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
      break;
    case 'DELETE':
      curl_setopt($curl, CURLOPT_HTTPHEADER, array($auth_header)); 
      curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $http_method); 
      break;
  }
  $response = curl_exec($curl);
  if (!$response) {
    $response = curl_error($curl);
  }
  curl_close($curl);
  return $response;
}

/**
 * Joins key:value pairs by inner_glue and each pair together by outer_glue
 * @param string $inner_glue The HTTP method (GET, POST, PUT, DELETE)
 * @param string $outer_glue Full URL of the resource to access
 * @param array $array Associative array of query parameters
 * @return string Urlencoded string of query parameters
 */
function implode_assoc($inner_glue, $outer_glue, $array) {
  $output = array();
  foreach($array as $key =&amp;gt; $item) {
    $output[] = $key . $inner_glue . urlencode($item);
  }
  return implode($outer_glue, $output);
}
?&amp;gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-2235668476002627866?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/2235668476002627866/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=2235668476002627866' title='31 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2235668476002627866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2235668476002627866'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/11/2-legged-oauth-in-php.html' title='2 Legged OAuth in PHP'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>31</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-3289759483040452945</id><published>2008-11-20T07:45:00.000-08:00</published><updated>2008-11-20T07:56:58.434-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='utility'/><category scheme='http://www.blogger.com/atom/ns#' term='prettyprint'/><title type='text'>XML PHP Pretty Printer</title><content type='html'>&lt;pre name="code" class="php"&gt;
&amp;lt;?
/** Prettifies an XML string into a human-readable and indented work of art
 *  @param string $xml The XML as a string
 *  @param boolean $html_output True if the output should be escaped (for use in HTML)
 */
function xmlpp($xml, $html_output=false) {
    $xml_obj = new SimpleXMLElement($xml);
    $level = 4;
    $indent = 0; // current indentation level
    $pretty = array();
    
    // get an array containing each XML element
    $xml = explode("\n", preg_replace('/&amp;gt;\s*&amp;lt;/', "&amp;gt;\n&amp;lt;", $xml_obj-&amp;gt;asXML()));

    // shift off opening XML tag if present
    if (count($xml) &amp;&amp; preg_match('/^&amp;lt;\?\s*xml/', $xml[0])) {
      $pretty[] = array_shift($xml);
    }

    foreach ($xml as $el) {
      if (preg_match('/^&amp;lt;([\w])+[^&amp;gt;\/]*&amp;gt;$/U', $el)) {
          // opening tag, increase indent
          $pretty[] = str_repeat(' ', $indent) . $el;
          $indent += $level;
      } else {
        if (preg_match('/^&amp;lt;\/.+&amp;gt;$/', $el)) {            
          $indent -= $level;  // closing tag, decrease indent
        }
        if ($indent &amp;lt; 0) {
          $indent += $level;
        }
        $pretty[] = str_repeat(' ', $indent) . $el;
      }
    }   
    $xml = implode("\n", $pretty);   
    return ($html_output) ? htmlentities($xml) : $xml;
}

echo '&amp;lt;pre&amp;gt;' . xmlpp($xml, true) . '&amp;lt;/pre&amp;gt;';
?&amp;gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-3289759483040452945?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/3289759483040452945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=3289759483040452945' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/3289759483040452945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/3289759483040452945'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/11/xml-php-pretty-printer.html' title='XML PHP Pretty Printer'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-3457037471555119598</id><published>2008-11-14T15:20:00.000-08:00</published><updated>2008-11-21T01:24:47.056-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='ClientLogin'/><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><title type='text'>Accessing a feed using ClientLogin &amp; Ruby</title><content type='html'>Example of accessing the DocList API using ClientLogin in Ruby:

&lt;pre name="code" class="ruby"&gt;
require 'net/http'
require 'net/https'
require 'cgi'
require 'rubygems'
require 'xmlsimple'
require 'pp'

def get_feed(uri, headers=nil)
  uri = URI.parse(uri)
  Net::HTTP.start(uri.host, uri.port) do |http|
    return http.get(uri.path, headers)
  end
end

email = 'user@gmail.com'
password = CGI::escape('pa$$word')
service = 'writely'
source = 'MyCompany-MyApp-0.1'
path = '/accounts/ClientLogin'

data = ["accountType=HOSTED_OR_GOOGLE", 
        "Email=#{email}",
        "Passwd=#{password}",
        "service=#{service}",
        "source=#{source}"].join('&amp;')

http = Net::HTTP.new(host='www.google.com', port=443)
http.use_ssl = true
http.start

headers = {'Content-Type' =&amp;gt; 'application/x-www-form-urlencoded'}
resp, data = http.post(path, data, headers)

token = data[/Auth=(.*)/, 1]  # parse out the Auth token

headers['Authorization'] = "GoogleLogin auth=#{token}"
resp = get_feed('http://docs.google.com/feeds/documents/private/full', headers)

doc = XmlSimple.xml_in(resp.body, 'KeyAttr' =&amp;gt; 'name')
pp doc
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-3457037471555119598?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/3457037471555119598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=3457037471555119598' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/3457037471555119598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/3457037471555119598'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/11/accessing-feed-using-clientlogin-ruby.html' title='Accessing a feed using ClientLogin &amp; Ruby'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-257204481045003878</id><published>2008-10-31T11:00:00.000-07:00</published><updated>2008-10-31T11:14:15.503-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ClientLogin'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Force PHP to use a Google Account in ClientLogin</title><content type='html'>Sometimes you have a Google Apps account that is also registered as a Google Account and you want to make sure you are logging in as the Google Account, especially when you want to use a service like Picasa Web Albums that does not have an Apps version. 

To do this using ClientLogin you need to do something like:

&lt;pre name="code" class="php"&gt;
$serviceName = Zend_Gdata_Photos::AUTH_SERVICE_NAME;
$username = "user@gmail.com";
$pass = "password";
$accountType = "GOOGLE";


$client = Zend_Gdata_ClientLogin::getHttpClient($username, $pass, $serviceName, null, Zend_Gdata_ClientLogin::DEFAULT_SOURCE, null, null, Zend_Gdata_ClientLogin::CLIENTLOGIN_URI, $accountType);
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-257204481045003878?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/257204481045003878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=257204481045003878' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/257204481045003878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/257204481045003878'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/10/force-php-to-use-google-account-in.html' title='Force PHP to use a Google Account in ClientLogin'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-996159133901809758</id><published>2008-10-23T11:24:00.000-07:00</published><updated>2008-10-23T11:27:51.282-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='app engine'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Using AuthSub on App Engine</title><content type='html'>For a full explanation, see this article: &lt;a href="http://code.google.com/appengine/articles/gdata.html"&gt;Retrieving Authenticated Google Data Feeds with Google App Engine&lt;/a&gt;
&lt;pre name="code" class="python"&gt;    # Initialize a client to talk to Google Data API services.
    client = gdata.service.GDataService()
    gdata.alt.appengine.run_on_appengine(client)

    session_token = None
    # Find the AuthSub token and upgrade it to a session token.
    auth_token = gdata.auth.extract_auth_sub_token_from_url(self.request.uri)
    if auth_token:
      # Upgrade the single-use AuthSub token to a multi-use session token.
      session_token = client.upgrade_to_session_token(auth_token)
    if session_token and users.get_current_user():
      # If there is a current user, store the token in the datastore and
      # associate it with the current user. Since we told the client to
      # run_on_appengine, the add_token call will automatically store the
      # session token if there is a current_user.
      client.token_store.add_token(session_token)
    elif session_token:
      # Since there is no current user, we will put the session token
      # in a property of the client. We will not store the token in the
      # datastore, since we wouldn't know which user it belongs to.
      # Since a new client object is created with each get call, we don't
      # need to worry about the anonymous token being used by other users.
      client.current_token = session_token&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-996159133901809758?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/996159133901809758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=996159133901809758' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/996159133901809758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/996159133901809758'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/10/using-authsub-on-app-engine.html' title='Using AuthSub on App Engine'/><author><name>Jeff Scudder</name><uri>http://www.blogger.com/profile/10171738514445498413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-6097970451261279163</id><published>2008-10-10T11:50:00.000-07:00</published><updated>2008-10-10T11:51:45.671-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Uploading a private YouTube video in .NET</title><content type='html'>&lt;pre name="code" class="CSharp"&gt;
newEntry.Media.ExtensionElements.Add(new Google.GData.YouTube.Private()); 
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-6097970451261279163?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/6097970451261279163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=6097970451261279163' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6097970451261279163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6097970451261279163'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/10/uploading-private-youtube-video-in-net.html' title='Uploading a private YouTube video in .NET'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-2091793280527812432</id><published>2008-10-09T14:23:00.000-07:00</published><updated>2008-10-09T14:29:38.568-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Changing the default timeout for HTTP requests in PHP</title><content type='html'>If you are using the PHP client library to &lt;a href="http://code.google.com/apis/youtube/developers_guide_php.html"&gt;upload videos to YouTube&lt;/a&gt;, you may run into problems where your requests are timing out after ten seconds. The client library makes use of the &lt;a href="http://framework.zend.com/apidoc/core/Zend_Http/Client/Zend_Http_Client.html"&gt;Zend_Http_Client&lt;/a&gt; component to dispatch requests to the API server. By default the client object is initialized to time out any requests after 10 seconds. The snippet below shows how you may increase the timeout to 30 seconds:
&lt;pre name="code" class="php"&gt;
// assuming your Zend_Http_Client already exists as $httpClient
// and that you want to change the timeout from the 10 second default to 30 seconds
$config = array('timeout' =&gt; 30);
$httpClient-&gt;setConfig($config);
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-2091793280527812432?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/2091793280527812432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=2091793280527812432' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2091793280527812432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2091793280527812432'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/10/changing-default-timeout-for-http.html' title='Changing the default timeout for HTTP requests in PHP'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-4314558565493372105</id><published>2008-10-03T11:19:00.000-07:00</published><updated>2008-10-03T11:21:08.964-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Saving a Feed or Entry as XML with the .NET client library</title><content type='html'>&lt;p&gt;The SaveToXml() method takes either a Stream or a XmlWriter.&lt;/p&gt;

&lt;pre name="code" class="C#"&gt;
FileStream file = new FileStream("C:\\testxml.txt", FileMode.Create);
feed.SaveToXml(file);
file.Close();
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-4314558565493372105?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/4314558565493372105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=4314558565493372105' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4314558565493372105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4314558565493372105'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/10/saving-feed-or-entry-as-xml-with-net.html' title='Saving a Feed or Entry as XML with the .NET client library'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-269011155023172626</id><published>2008-10-03T10:12:00.001-07:00</published><updated>2008-10-03T10:17:28.963-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Getting RTSP Streams From the YouTube API Without Redirects</title><content type='html'>&lt;p&gt;So if you want RTSP streams from the YouTube API you probably looked at our &lt;a href="http://code.google.com/apis/youtube/reference.html#formatsp"&gt;documentation for the format parameter&lt;/a&gt; and made a request like&lt;/p&gt;

&lt;pre&gt;
http://gdata.youtube.com/feeds/api/videos?format=1
&lt;/pre&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;pre&gt;http://gdata.youtube.com/feeds/api/videos?format=6&lt;/pre&gt;

&lt;p&gt;or even&lt;/p&gt;

&lt;pre&gt;http://gdata.youtube.com/feeds/api/videos?format=1,6&lt;/pre&gt;

&lt;p&gt;But you may have noticed you get a lot of redirects, which may upset your RTSP player. What you should be doing is requesting the &lt;strong&gt;mobile&lt;/strong&gt; projection. So your request should look like&lt;/p&gt;

&lt;pre&gt;http://gdata.youtube.com/feeds/mobile/videos?format=1&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-269011155023172626?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/269011155023172626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=269011155023172626' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/269011155023172626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/269011155023172626'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/10/getting-rtsp-streams-from-youtube-api.html' title='Getting RTSP Streams From the YouTube API Without Redirects'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-1667051196572908506</id><published>2008-09-24T10:15:00.000-07:00</published><updated>2008-09-24T10:16:47.230-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Retrieving a user profile image in YouTube using Python</title><content type='html'>&lt;pre name="code" class="python"&gt;
import gdata.youtube
import gdata.youtube.service

yt_service = gdata.youtube.service.YouTubeService()
user_entry = yt_service.GetYouTubeUserEntry(username='GoogleDevelopers')
print user_entry.thumbnail.url
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-1667051196572908506?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/1667051196572908506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=1667051196572908506' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1667051196572908506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1667051196572908506'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/09/retrieving-user-profile-image-in.html' title='Retrieving a user profile image in YouTube using Python'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-736520671894484349</id><published>2008-09-21T20:11:00.000-07:00</published><updated>2008-09-21T20:17:39.075-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><title type='text'>Catching Exceptions from the Java Client Library</title><content type='html'>&lt;p&gt;Just like our other client libraries, if you're using the Java client library and encounter a server error, an exception will be generated. This will cause Java to stop in its tracks and print out the contents of the exception. While this is useful for debugging, in a production application you'll probably want your application to fail gracefully, perhaps displaying a nice error message to your users.&lt;/p&gt;

&lt;p&gt;You can do this by wrapping your code in a &lt;code&gt;try&lt;/code&gt; block and using an &lt;code&gt;catch&lt;/code&gt; statement:&lt;/p&gt;

&lt;pre name="code" class="java"&gt;
try {
  // Do something that accesses the network
} catch (IOError e) {
    // Insert custom error handling code here.
    System.out.println(e.toString());
} catch (ServiceException e) {
    // Insert custom error handling code here.
    System.out.println(e.toString());
}&lt;/pre&gt;

&lt;p&gt;Most errors will be instances of either &lt;code&gt;&lt;a href="http://java.sun.com/javase/6/docs/api/java/io/IOError.html"&gt;IOError&lt;/a&gt;&lt;/code&gt; or &lt;code&gt;&lt;a href="http://code.google.com/apis/gdata/javadoc/com/google/gdata/util/ServiceException.html"&gt;ServiceException&lt;/a&gt;&lt;/code&gt;, depending on the cause.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-736520671894484349?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/736520671894484349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=736520671894484349' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/736520671894484349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/736520671894484349'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/09/catching-exceptions-from-java-client.html' title='Catching Exceptions from the Java Client Library'/><author><name>Trevor Johns</name><uri>http://www.blogger.com/profile/04465221509532799738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-6283079280259059734</id><published>2008-09-21T18:17:00.000-07:00</published><updated>2008-09-21T20:16:55.168-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Catching Exceptions from the Python Client Library</title><content type='html'>&lt;p&gt;If you're using the Python client library and encounter a server error, an exception will be generated, causing Python to stop in its tracks and print out the contents of the exception. While this is useful for debugging, in a production application you'll probably want your application to fail gracefully, perhaps displaying a nice error message to your users.&lt;/p&gt;

&lt;p&gt;You can do this by wrapping your code in a &lt;code&gt;try&lt;/code&gt; block and using an &lt;code&gt;except&lt;/code&gt; statement:&lt;/p&gt;

&lt;pre name="code" class="ruby"&gt;
try:
  # Do something that accesses the network
except gdata.service.RequestError, inst:
  response = inst[0]
  status = response['status']
  reason = response['reason']
  body = response['body']
  # Handle the error here
&lt;/pre&gt;

&lt;p&gt;Other exceptions may be thrown depending on the situation. For more information, see the &lt;code&gt;&lt;a href="http://gdata-python-client.googlecode.com/svn/trunk/pydocs/gdata.service.html"&gt;gdata.service&lt;/a&gt;&lt;/code&gt; documentation.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-6283079280259059734?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/6283079280259059734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=6283079280259059734' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6283079280259059734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6283079280259059734'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/09/catching-exceptions-from-python-client.html' title='Catching Exceptions from the Python Client Library'/><author><name>Trevor Johns</name><uri>http://www.blogger.com/profile/04465221509532799738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-2099903841411917082</id><published>2008-09-19T10:39:00.000-07:00</published><updated>2008-09-19T10:47:05.682-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Adding Multiple Video Responses to a Video Entry</title><content type='html'>Note that you need to use an authenticated YouTube client object (represented as &lt;code&gt;$ytClient&lt;/code&gt;). You can only add responses that are your own videos and they may not show up immediately, depending on whether the owner of the video that you are responding to has enabled automatic acceptance of responses.

&lt;pre name="code" class="php"&gt;
// Assuming we have just instantiated a working $httpClient object.
$ytClient = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);

// The video ID that is to receive the responses.
$receiveResponses = 'ABC123';

// A few of your videos that you want to post as responses.
$videoResponses[] = 'defXYZ123';
$videoResponses[] = 'defXYZ124';
$videoResponses[] = 'defXYZ125';

function addVideoResponses($videoResponses, $receiveResponses) {
  global $ytClient;

  $receiveResponsesEntry = $yt-&gt;getVideoEntry($receiveResponses);

  foreach ($videoResponses as $videoResponse) {
    $videoResponseEntry = $yt-&gt;getVideoEntry($videoResponse);
    $responsesFeedUrl = $receiveResponsesEntry-&gt;getVideoResponsesLink()-&gt;getHref();

    try {
      $ytClient-&gt;insertEntry($videoResponseEntry, $responsesFeedUrl);
    } catch (Zend_Gdata_App_HttpException $httpException) {  
      echo 'ERROR: ' . $httpException-&gt;getRawResponseBody();
      
    }
  }
}

addVideoResponses($videoResponses, $receiveResponses);
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-2099903841411917082?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/2099903841411917082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=2099903841411917082' title='29 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2099903841411917082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2099903841411917082'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/09/adding-multiple-video-responses-to.html' title='Adding Multiple Video Responses to a Video Entry'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>29</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-8190123837846338125</id><published>2008-09-17T11:31:00.000-07:00</published><updated>2008-09-17T11:51:51.274-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='proxy'/><title type='text'>Using the PHP Client Library through a Proxy connection</title><content type='html'>To access a Google Data API through a proxy connection you will need to use the &lt;code&gt;Zend_Http_Client_Adapter_Proxy&lt;/code&gt; proxy adapter. In the snippet below, we are going to access our private Google Documents feed from the &lt;a href="http://code.google.com/apis/documents" target="_blank"&gt;DocumentsList API&lt;/a&gt; through a proxy connection:

&lt;pre name="code" class="php"&gt;
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_App_HttpException');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Docs');

Zend_Loader::loadClass('Zend_Http_Client_Exception');
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Http_Client_Adapter_Proxy');


// Configure the proxy connection
$config = array(
    'adapter'    =&gt; 'Zend_Http_Client_Adapter_Proxy',
    'proxy_host' =&gt; 'your.proxy.server.net',
    'proxy_port' =&gt; 3128
);

// We are setting http://www.google.com:443 as the initial URL since we need to perform
// ClientLogin authentication first.
$proxiedHttpClient = new Zend_Http_Client('http://www.google.com:443', $config);

$username = 'foo@example.com';
$password = 'barbaz';
$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;

// Try to perform the ClientLogin authentication using our proxy client.
// If there is an error, we exit since it doesn't make sense to go on. You may want to 
// modify this according to the needs of your application.
try {
  $httpClient = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service,
    $proxiedHttpClient);
} catch (Zend_Gdata_App_HttpException $httpException) {
  exit("An error occurred trying to connect to the proxy server\n" .        
    $httpException-&gt;getMessage() . "\n");
}

// If that worked, proceed and retrieve the documents feed.
// Remember to set your application ID.
$docsClient = new Zend_Gdata_Docs($httpClient, $yourApplicationId);
$feed = $docsClient-&gt;getDocumentListFeed();

?&gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-8190123837846338125?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/8190123837846338125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=8190123837846338125' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8190123837846338125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8190123837846338125'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/09/using-php-client-library-through-proxy.html' title='Using the PHP Client Library through a Proxy connection'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-5211974957271299979</id><published>2008-09-15T15:43:00.000-07:00</published><updated>2009-03-04T15:31:06.480-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='authsub'/><category scheme='http://www.blogger.com/atom/ns#' term='zend'/><category scheme='http://www.blogger.com/atom/ns#' term='secure'/><category scheme='http://www.blogger.com/atom/ns#' term='health'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Secure AuthSub using the Zend PHP library 1.6+</title><content type='html'>After uploading a public certificate to &lt;a href="https://www.google.com/accounts/ManageDomains"&gt;https://www.google.com/accounts/ManageDomains&lt;/a&gt;, here's how to use the Zend PHP 1.6+ library to work with secure AuthSub.  This example uses the &lt;a href="http://code.google.com/apis/health/"&gt;Google Health Data API&lt;/a&gt;

&lt;pre name="code" class="php"&gt;
&amp;lt;?
function setupClient($singleUseToken = null) { 
  $client = null;  

  // Fetch a new AuthSub token?
  if (!$singleUseToken) {
    $next = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
    $scope = 'https://www.google.com/health/feeds';
    $authSubHandler = 'https://www.google.com/health/authsub';    
    $secure = 1;
    $session = 1;
    $permission = 1;  // 1 - allows posting notices &amp;&amp; allows reading profile data
    $authSubURL =  Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session, $authSubHandler);
    
    $authSubURL .= '&amp;permission=' . $permission;
    
    echo '&amp;lt;a href="' . $authSubURL . '"&amp;gt;Link your Google Health Account&amp;lt;/a&amp;gt;';
  } else {
    $client = new Zend_Gdata_HttpClient();
    
    // This sets your private key to be used to sign subsequent requests
    $client-&gt;setAuthSubPrivateKeyFile('/path/to/myrsakey.pem', null, true);

    $sessionToken = Zend_Gdata_AuthSub::getAuthSubSessionToken(trim($singleUseToken), $client);
    // Set the long-lived session token for subsequent requests
    $client-&gt;setAuthSubToken($sessionToken);
  }
  return $client;
}
?&amp;gt;
&lt;/pre&gt;

Use this function like this:
&lt;pre name="code" class="php"&gt;
$client = setupClient(@$_GET['token']);
if ($client) {
  // Query a feed
} else {
  exit(); // Just display the AuthSub link
}
&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;Read the &lt;a href="http://code.google.com/apis/gdata/authsub.html"&gt;new documentation on using AuthSub&lt;/a&gt; for PHP as well as all the other client libraries.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-5211974957271299979?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/5211974957271299979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=5211974957271299979' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5211974957271299979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5211974957271299979'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/09/secure-authsub-using-zend-php-library.html' title='Secure AuthSub using the Zend PHP library 1.6+'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-6090429274504753851</id><published>2008-09-15T07:25:00.001-07:00</published><updated>2008-09-15T07:25:56.711-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Sending custom headers in the .NET client library</title><content type='html'>Assume that "service" is an instance of an API-specific service object.

&lt;pre name="code" class="CSharp"&gt;
GDataRequestFactory requestFactory = (GDataRequestFactory) service.RequestFactory;
requestFactory.CustomHeaders.Add("X-MyHeader: HeaderValue");
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-6090429274504753851?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/6090429274504753851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=6090429274504753851' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6090429274504753851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6090429274504753851'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/09/sending-custom-headers-in-net-client.html' title='Sending custom headers in the .NET client library'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-1158389047551476036</id><published>2008-09-09T18:18:00.000-07:00</published><updated>2008-09-09T18:34:24.310-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curl'/><category scheme='http://www.blogger.com/atom/ns#' term='contacts'/><title type='text'>Editing contact photos using curl</title><content type='html'>&lt;p&gt;You can use curl to modify Contacts API contact photos from the command line.&lt;/p&gt;

&lt;p&gt;To start, you'll need to get the photo edit link from the contacts feed. This is expressed in the feed as the following XML element:&lt;/p&gt;

&lt;pre name="code" class="xml"&gt;&amp;lt;link rel="http://schemas.google.com/contacts/2008/rel#photo-edit type="image/*" href="http://www.google.com/m8/feeds/photos/media/user/id/version" /&amp;gt;&lt;/pre&gt;

&lt;p&gt;The photo edit link is contained inside the &lt;code&gt;href&lt;/code&gt; attribute. For this example, it would be &lt;code&gt;http://www.google.com/m8/feeds/photos/media/user/id/version&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Once you have this, you can add or update a photo by running:&lt;/p&gt;

&lt;pre name="code" class="sh"&gt;curl -H "Authorization: GoogleLogin ..." \
-H "Content-Type: image/jpeg" \
-X PUT \
--binary-data "@/path/to/image.jpg" \
http://www.google.com/m8/feeds/photos/media/user/id/version&lt;/pre&gt;

&lt;p&gt;Be sure to replace the Content-Type and file path with appropriate values for your new photo.&lt;/p&gt;

&lt;p&gt;To delete a photo, run:&lt;/p&gt;

&lt;pre name="code" class="sh"&gt;curl -H "Authorization: GoogleLogin ..." \
-X DELETE \
http://www.google.com/m8/feeds/photos/media/user/id/version&lt;/pre&gt;

&lt;p&gt;You'll need to make sure that the Authorization header contains a valid ClientLogin token, as explained in the tip "&lt;a href="http://gdatatips.blogspot.com/2008/08/perform-clientlogin-using-curl.html"&gt;Perform ClientLogin using curl&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-1158389047551476036?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/1158389047551476036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=1158389047551476036' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1158389047551476036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1158389047551476036'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/09/editing-contact-photos-using-curl.html' title='Editing contact photos using curl'/><author><name>Trevor Johns</name><uri>http://www.blogger.com/profile/04465221509532799738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-82440431918592686</id><published>2008-09-09T18:12:00.001-07:00</published><updated>2008-09-09T18:19:15.566-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='contacts'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Deleting contact photos using .NET</title><content type='html'>&lt;p&gt;If you want to delete a contact photo from the Contacts API using the .NET client library, you can just call &lt;code&gt;ContactsService.Delete(photoURI)&lt;/code&gt;, like so:&lt;/p&gt;

&lt;pre name="code" class="c#"&gt;
ContactsService service = new ContactsService("exampleCo-exampleApp-1");
service.setUserCredentials("user@example.com", "secretPassword");
ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("default"));

ContactsFeed feed = service.Query(query);
foreach (ContactEntry entry in feed.Entries)
{
  service.Delete(entry.PhotoEditUri);
}&lt;/pre&gt;

&lt;p&gt;Be careful, the above code will delete &lt;strong&gt;every&lt;/strong&gt; contact photo in your contact list. Run this against a test account only.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-82440431918592686?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/82440431918592686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=82440431918592686' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/82440431918592686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/82440431918592686'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/09/deleting-contact-photos-using-net.html' title='Deleting contact photos using .NET'/><author><name>Trevor Johns</name><uri>http://www.blogger.com/profile/04465221509532799738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-4778876693115008858</id><published>2008-09-03T13:08:00.001-07:00</published><updated>2008-09-03T13:08:32.499-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><title type='text'>Retrieving a single document entry using the Java client library</title><content type='html'>The snippet below demonstrates how to retrieve a single DocumentListEntry using the Java client library:

&lt;pre name="code" class="java"&gt;
import java.net.URL;

import com.google.gdata.client.docs.DocsService;
import com.google.gdata.data.docs.DocumentListEntry;

public class DocumentListGetEntry {

  public static void main(String[] args) {
    try {
      DocsService docsService = new DocsService("Document List Demo");
      docsService.setUserCredentials("foobar@example.com", "secret");
   
      URL documentURI = new URL("http://docs.google.com/feeds/documents/private/full/spreadsheet%3Apc6ppXdYxYkSSOvE8tCUELw");
      DocumentListEntry entry = docsService.getEntry(documentURI, DocumentListEntry.class);
   
      System.out.println(entry.getTitle().getPlainText());  
  
    } catch (Exception e) {
      System.err.println(e.toString());
    }
  }
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-4778876693115008858?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/4778876693115008858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=4778876693115008858' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4778876693115008858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4778876693115008858'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/09/retrieving-single-document-entry-using.html' title='Retrieving a single document entry using the Java client library'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-8362952486222135668</id><published>2008-08-25T15:54:00.000-07:00</published><updated>2008-08-26T10:53:55.749-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><category scheme='http://www.blogger.com/atom/ns#' term='simplexml'/><title type='text'>Finding the previous and next links using SimpleXml</title><content type='html'>If you find yourself in a situation where you need to page through a large feed of entries with &lt;a href="http://us.php.net/manual/en/book.simplexml.php" target="_blank"&gt;SimpleXML&lt;/a&gt;, you can use the below snippet to retrieve the 'previous' and 'next' links:
&lt;pre name="code" class="php"&gt;
// assuming you have read your XML string into the $sxml object
$links = $sxml-&gt;children('http://www.w3.org/2005/Atom'); 
foreach($links as $link) {
  foreach($link-&gt;attributes() as $key =&gt; $value) {
    if ($key == 'rel') {
      print "$key =&gt; $value\n";
    }
  }
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-8362952486222135668?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/8362952486222135668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=8362952486222135668' title='32 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8362952486222135668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8362952486222135668'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/finding-previous-and-next-links-using.html' title='Finding the previous and next links using SimpleXml'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>32</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-5141213486524034166</id><published>2008-08-25T11:54:00.001-07:00</published><updated>2008-08-25T14:50:24.154-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Finding the total number of comments for a Video Entry with the Python Client Library</title><content type='html'>The snippet below shows how to retrieve the total number of comments for a video entry by examining the comment feed object using the interactive shell:
&lt;pre name="code" class="python"&gt;
&gt;&gt;&gt; import gdata.youtube.service
&gt;&gt;&gt; client = gdata.youtube.service.YouTubeService()
&gt;&gt;&gt; feed = client.GetRecentlyFeaturedVideoFeed()
&gt;&gt;&gt; # fetching the first entry from the recently featured video feed
&gt;&gt;&gt; entry = feed.entry[0]
&gt;&gt;&gt; entry.title.text
"Follow Obama's nomination week: youtube.com/2008conventions"
&gt;&gt;&gt; # fetching the comment feed
&gt;&gt;&gt; comments = client.GetYouTubeVideoCommentFeed(video_id='9N4GOpSt5OI')
&gt;&gt;&gt; # printing the text contents of the total_results element
&gt;&gt;&gt; # note that this element is part of every feed
&gt;&gt;&gt; comments.total_results.text
'578'
&lt;/pre&gt;
Alternatively, if you want to eliminate the actual request to catch the comment feed itself, you can parse out the number of comments by examining the 'countHint' attribute of the comment feedLink:
&lt;pre name="code" class="python"&gt;
&gt;&gt;&gt; entry.comments.feed_link[0].count_hint
'50'
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-5141213486524034166?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/5141213486524034166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=5141213486524034166' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5141213486524034166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5141213486524034166'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/finding-total-number-of-comments-for.html' title='Finding the total number of comments for a Video Entry with the Python Client Library'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-2920970755552304320</id><published>2008-08-19T13:41:00.000-07:00</published><updated>2008-08-19T13:53:45.054-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Uploading a video to YouTube using an older version of the Zend Framework, prior to 1.5.3</title><content type='html'>We have recently added convenience methods that make uploading video entries to the YouTube API much easier than before. For those that are still using older versions of the PHP Client Library, prior to 1.5.3 of the Zend Framework, the snippet below explains how to upload a video entry. Note that this still works in version 1.5.3 and will continue to work in future revisions:

&lt;pre name="code" class="php"&gt;
// assuming that $yt is a fully authenticated YouTube service object

// create a new Zend_Gdata_YouTube_VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();

// create a new Zend_Gdata_App_MediaFileSource object for your video file (if using direct upload)
$filesource = $yt-&amp;gt;newMediaFileSource('/path/to/mytestmovie.mov');
$filesource-&amp;gt;setContentType('video/quicktime');

// set slug header
$filesource-&amp;gt;setSlug('mytestmovie.mov');

// add the filesource to the video entry
$myVideoEntry-&amp;gt;setMediaSource($filesource);

// create a new Zend_Gdata_YouTube_Extension_MediaGroup object
$mediaGroup = $yt-&amp;gt;newMediaGroup();
$mediaGroup-&amp;gt;title = $yt-&amp;gt;newMediaTitle()-&amp;gt;setText('My Test Movie');
$mediaGroup-&amp;gt;description = $yt-&amp;gt;newMediaDescription()-&amp;gt;setText('My description');

// the category must be a valid YouTube category
// optionally set some developer tags*
$mediaGroup-&amp;gt;category = array(
$yt-&amp;gt;newMediaCategory()-&amp;gt;setText('Autos')-&amp;gt;setScheme('http://gdata.youtube.com/schemas/2007/categories.cat'),
$yt-&amp;gt;newMediaCategory()-&amp;gt;setText('mydevelopertag')-&amp;gt;setScheme('http://gdata.youtube.com/schemas/2007/developertags.cat'),
$yt-&amp;gt;newMediaCategory()-&amp;gt;setText('anotherdevelopertag')-&amp;gt;setScheme('http://gdata.youtube.com/schemas/2007/developertags.cat')
);

// set keywords, please note that they cannot contain white-space
$mediaGroup-&amp;gt;keywords = $yt-&amp;gt;newMediaKeywords()-&amp;gt;setText('cars, funny');
$myVideoEntry-&amp;gt;mediaGroup = $mediaGroup;

// optionally set video location
$yt-&amp;gt;registerPackage('Zend_Gdata_Geo');
$yt-&amp;gt;registerPackage('Zend_Gdata_Geo_Extension');
$where = $yt-&amp;gt;newGeoRssWhere();
$position = $yt-&amp;gt;newGmlPos('37.0 -122.0');
$where-&amp;gt;point = $yt-&amp;gt;newGmlPoint($position);
$myVideoEntry-&amp;gt;setWhere($where);


// upload URL for the currently authenticated user
$uploadUrl = 'http://uploads.gdata.youtube.com/feeds/users/default/uploads';

try {
$newEntry = $yt-&amp;gt;insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
} catch (Zend_Gdata_App_HttpException $httpException) {
echo $httpException-&gt;getRawResponseBody();
} catch (Zend_Gdata_App_Exception $e) {
echo $e-&amp;gt;getMessage();
}
&lt;/pre&gt;
* Find out more about &lt;a href="http://code.google.com/apis/youtube/developers_guide_php.html#SearchingVideosDeveloperTags"&gt;developer tags&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-2920970755552304320?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/2920970755552304320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=2920970755552304320' title='28 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2920970755552304320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2920970755552304320'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/uploading-video-to-youtube-using-older.html' title='Uploading a video to YouTube using an older version of the Zend Framework, prior to 1.5.3'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>28</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-6296156671346538260</id><published>2008-08-19T11:35:00.000-07:00</published><updated>2008-08-19T11:51:06.339-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curl'/><category scheme='http://www.blogger.com/atom/ns#' term='gdata'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Performing a GET with a POST using a Data API</title><content type='html'>Sometimes you can only do a GET when you need to do a DELETE, since some systems don't support all of the HTTP verbs. Also since Flash doesn't let you set a custom Authorization header on a GET, sometimes you need to do a GET with a POST.

How can you do this? With the X-HTTP-Method-Override header:

&lt;pre name="code" class="xml"&gt;
X-HTTP-Method-Override: GET
&lt;/pre&gt;

For example, say you want to perform a video search in YouTube using a POST request:

&lt;pre name="code" class="xml"&gt;
POST /feeds/api/videos HTTP/1.1
Host: gdata.youtube.com
X-HTTP-Method-Override: GET
Content-Length: 23
Content-Type: application/x-www-form-urlencoded

vq=kitten&amp;max-results=1
&lt;/pre&gt;

This is the same as performing a GET on 

http://gdata.youtube.com/feeds/api/videos?vq=kitten&amp;max-results=1

The POST body is used as the set of query parameters. You can also do this using the curl command:

&lt;pre name="code" class="bash"&gt;
curl -H "X-HTTP-Method-Override: GET" -X POST http://gdata.youtube.com/feeds/api/videos -d "vq=kitten&amp;max-results=1"
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-6296156671346538260?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/6296156671346538260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=6296156671346538260' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6296156671346538260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6296156671346538260'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/performing-get-with-post-using-data-api.html' title='Performing a GET with a POST using a Data API'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-4631231328694374756</id><published>2008-08-18T10:43:00.001-07:00</published><updated>2008-08-18T10:45:28.885-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='pwa'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Create a public album for Picasa Web Albums</title><content type='html'>This is how to do it in .NET:

&lt;pre name="code" class="CSharp"&gt;
AlbumEntry newEntry = new AlbumEntry();
newEntry.Title.Text = "My New album";
newEntry.Summary.Text = "This is an album";
AlbumAccessor ac = new AlbumAccessor(newEntry);
ac.Access = "public";
&lt;/pre&gt;

This is how to do it in PHP:

&lt;pre name="code" class="php"&gt;
$entry = new Zend_Gdata_Photos_AlbumEntry();
$entry-&gt;setTitle($gp-&gt;newTitle('title'));
$entry-&gt;setGphotoAccess($gp-&gt;newAccess("public"));
$createdEntry = $gp-&gt;insertAlbumEntry($entry);
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-4631231328694374756?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/4631231328694374756/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=4631231328694374756' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4631231328694374756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4631231328694374756'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/create-private-album-for-picasa-web.html' title='Create a public album for Picasa Web Albums'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-6134627244780334346</id><published>2008-08-15T18:15:00.000-07:00</published><updated>2008-08-15T18:22:02.867-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='base'/><title type='text'>Link a Google Base item to your website</title><content type='html'>Here is how you can set the alternate link using the PHP client library.  When someone clicks on your item in Google Base, he/she will be redirected to your site.

&lt;pre name="code" class="php"&gt;
&amp;lt;?
$link = new Zend_Gdata_App_Extension_Link(); 
$link-&gt;setHref('http://www.example.com'); 
$link-&gt;setRel('alternate'); 
$link-&gt;setType('text/html');  
$linkArray[] = $link; 

$entry-&gt;setLink($linkArray); 
?&amp;gt;
&lt;/pre&gt;

Here is the underlying XML:
&lt;pre name="code" class="xml"&gt;
&amp;lt;link rel='alternate' type='text/html' href='http://www.example.com'/&amp;gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-6134627244780334346?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/6134627244780334346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=6134627244780334346' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6134627244780334346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6134627244780334346'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/link-google-base-item-to-your-website.html' title='Link a Google Base item to your website'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-8138973184593279875</id><published>2008-08-11T16:37:00.000-07:00</published><updated>2008-11-05T15:50:13.874-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='base'/><title type='text'>Setting publishing_priority attribute in .NET</title><content type='html'>For items to be published immediately using the Google Base API, you must set the publishing_priority to 'high'.  The default is 'low'.  
&lt;br&gt;&lt;br&gt;
If you're using 1.2.3+ of the .NET client:
&lt;pre name="code" class="C#"&gt;
GBaseEntry entry = new GBaseEntry();
entry.PublishingPriority = new PublishingPriority("high");
GBaseEntry myEntry = service.Insert(GBaseUriFactory.Default.ItemsFeedUri, entry); 
&lt;/pre&gt;

Older versions:
&lt;pre name="code" class="C#"&gt;
GBaseEntry entry = new GBaseEntry();

XmlDocument xmlDocument = new XmlDocument();
XmlNode node = xmlDocument.CreateNode(XmlNodeType.Element, 
  "app", "control", "http://purl.org/atom/app#");
XmlNode pp = xmlDocument.CreateNode(XmlNodeType.Element, 
  "gm", "publishing_priority", "http://base.google.com/ns-metadata/1.0");

pp.InnerText = "high";
node.AppendChild(pp);

entry.ExtensionElements.Add(node);
GBaseEntry myEntry = service.Insert(GBaseUriFactory.Default.ItemsFeedUri, entry);
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-8138973184593279875?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/8138973184593279875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=8138973184593279875' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8138973184593279875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8138973184593279875'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/setting-publishingpriority-attribute-in.html' title='Setting publishing_priority attribute in .NET'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-5077670553987917101</id><published>2008-08-07T08:59:00.000-07:00</published><updated>2008-08-11T11:39:23.574-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spreadsheets'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Getting the worksheet feed for a given spreadsheet</title><content type='html'>This code snippet demonstrates how to obtain a feed of worksheet entries, given an authenticated gdata.spreadsheet.service.SpreadsheetsService() client object and a worksheet key. For the sake of the example, we are going to extract the worksheets feed for the first spreadsheet in our spreadsheets feed. The example uses the interactive Python interpreter.

To obtain the worksheet feed for a private spreadsheet:
&lt;pre name="code" class="python"&gt;
&gt;&gt;&gt; import gdata
&gt;&gt;&gt; import gdata.docs
&gt;&gt;&gt; import gdata.spreadsheet
&gt;&gt;&gt; import gdata.spreadsheet.service
&gt;&gt;&gt; client = gdata.spreadsheet.service.SpreadsheetsService()
&gt;&gt;&gt; client.email = 'me@gmail.com'
&gt;&gt;&gt; client.password = 'mypassword'
&gt;&gt;&gt; client.ProgrammaticLogin()
&gt;&gt;&gt; spreadsheet_feed = client.GetFeed('http://spreadsheets.google.com/feeds/spreadsheets/private/full')
&gt;&gt;&gt; first_entry = spreadsheet_feed.entry[0]
&gt;&gt;&gt; key = first_entry.id.text.rsplit('/')[-1]
&gt;&gt;&gt; worksheets_feed = client.GetWorksheetsFeed(key)
&gt;&gt;&gt; for entry in worksheets_feed.entry:
...     print entry.title.text
... 
&lt;/pre&gt;

To do the same without authentication for public spreadsheets:
To obtain the worksheet feed for a private spreadsheet:
&lt;pre name="code" class="python"&gt;
&gt;&gt;&gt; import gdata.spreadsheet
&gt;&gt;&gt; import gdata.spreadsheet.service
&gt;&gt;&gt; client = gdata.spreadsheet.service.SpreadsheetsService()
&gt;&gt;&gt; key = 'p123345abcDEF'
&gt;&gt;&gt; worksheets_feed = client.GetWorksheetsFeed(key, visibility='public', projection='values')
&gt;&gt;&gt; for entry in worksheets_feed.entry:
...     print entry.title.text
... 
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-5077670553987917101?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/5077670553987917101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=5077670553987917101' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5077670553987917101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5077670553987917101'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/getting-worksheet-feed-for-given.html' title='Getting the worksheet feed for a given spreadsheet'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-5206879750837366704</id><published>2008-08-05T10:19:00.001-07:00</published><updated>2008-08-05T10:21:08.662-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Catching Exceptions from the PHP Client Library</title><content type='html'>If you are using the PHP client library and see an error like

"Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with
message 'Expected response code 200, got 400' in ..." 

What you should really do is surround your code in a try block and use a catch statement like this:

&lt;pre name="code" class="php"&gt;
catch(Zend_Gdata_App_HttpException $exception) {
    echo "Error: " . $exception-&gt;getResponse()-&gt;getRawBody();
}
&lt;/pre&gt;

Usually this will print a more informative message describing the reason for failure.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-5206879750837366704?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/5206879750837366704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=5206879750837366704' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5206879750837366704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5206879750837366704'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/catching-exceptions-from-php-client.html' title='Catching Exceptions from the PHP Client Library'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-5268553013225653568</id><published>2008-08-04T17:55:00.000-07:00</published><updated>2008-08-05T10:44:40.659-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Getting Blogger Post URLs Using C#</title><content type='html'>&lt;p&gt;Want to look up the URL for a post retrieved using the &lt;a href="http://code.google.com/apis/blogger/"&gt;Blogger API&lt;/a&gt;? If you're using the &lt;a href="http://code.google.com/p/google-gdata/"&gt;.NET client library&lt;/a&gt;, you can do it with one line of C# code:&lt;/p&gt;
&lt;pre name="code" class="c#"&gt;string postUrl = entry.AlternateUri.Content;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-5268553013225653568?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/5268553013225653568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=5268553013225653568' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5268553013225653568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5268553013225653568'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/getting-blogger-post-urls-using-c.html' title='Getting Blogger Post URLs Using C#'/><author><name>Trevor Johns</name><uri>http://www.blogger.com/profile/04465221509532799738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-5749939840309869536</id><published>2008-08-04T15:16:00.000-07:00</published><updated>2008-08-04T16:55:32.784-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curl'/><category scheme='http://www.blogger.com/atom/ns#' term='blogger'/><title type='text'>Post on Blogger using curl</title><content type='html'>This command line curl script reads an XML file containing the blog post's XML and uses curl to authenticate and post to Blogger.

Here is the XML for an example post:&lt;pre name="code" class="xml"&gt;&amp;lt;entry xmlns="http://www.w3.org/2005/Atom"&amp;gt;
  &amp;lt;title type="text"&gt;Knock knock&amp;lt;/title&amp;gt;
  &amp;lt;content type="xhtml"&amp;gt;
    &amp;lt;div xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
      &amp;lt;p&amp;gt;Who's there?&amp;lt;/p&amp;gt;
      &amp;lt;p&amp;gt;Orange.&amp;lt;/p&amp;gt;
      &amp;lt;p&amp;gt;Orange who?&amp;lt;/p&amp;gt;
      &amp;lt;p&amp;gt;Orange you glad you know how to post using curl?!? (lol!)&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/content&amp;gt;
  &amp;lt;category scheme="http://www.blogger.com/atom/ns#" term="joke"/&amp;gt;
  &amp;lt;category scheme="http://www.blogger.com/atom/ns#" term="curl"/&amp;gt;
&amp;lt;/entry&amp;gt;&lt;/pre&gt;With the above stored in &lt;code&gt;blog_post.xml&lt;/code&gt;, we can now post it using the following shell script:&lt;pre name="code"&gt;#!/bin/sh

# Authenticate
# Requires $GDATA_PASSWORD to be set as an environment variable.
G_AUTH_TOKEN=`curl 2&gt;/dev/null https://www.google.com/accounts/ClientLogin \
    -d Email=YOUR_EMAIL_ADDRESS@example.com \
    -d Passwd=$GDATA_PASSWORD  \
    -d accountType=GOOGLE \
    -d source=curlExample \
    -d service=blogger \
  | grep '^Auth=' | cut -c 6-`

# Post on my blog.
curl -v --request POST -H "Content-Type: application/atom+xml" \
    -H "Authorization: GoogleLogin auth=$G_AUTH_TOKEN" \
    "http://www.blogger.com/feeds/YOUR_BLOGS_ID/posts/default" --data "@blog_post.xml"&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-5749939840309869536?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/5749939840309869536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=5749939840309869536' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5749939840309869536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5749939840309869536'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/post-on-blogger-using-curl.html' title='Post on Blogger using curl'/><author><name>Jeff Scudder</name><uri>http://www.blogger.com/profile/10171738514445498413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-1154226637562538026</id><published>2008-08-04T15:07:00.000-07:00</published><updated>2008-08-04T16:56:03.392-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curl'/><category scheme='http://www.blogger.com/atom/ns#' term='ClientLogin'/><title type='text'>Perform ClientLogin using curl</title><content type='html'>Requests an authorization token for one of the Google Data API services and stores it in the shell environment variable &lt;code&gt;GDATA_AUTH&lt;/code&gt;. This shell script takes three command line parameters, the email address for the desired account, password, and the &lt;a href="http://code.google.com/apis/gdata/faq.html#clientlogin"&gt;service name&lt;/a&gt; of the service which the token will be used to access.&lt;pre name="code"&gt;#!/bin/sh
export GDATA_AUTH=`curl 2&gt;/dev/null https://www.google.com/accounts/ClientLogin \
  -d Email=$1 -d Passwd=$2 -d accountType=HOSTED_OR_GOOGLE -d source=curlExample \
  -d service=$3 | grep '^Auth=' | cut -c 6-`
echo $GDATA_AUTH
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-1154226637562538026?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/1154226637562538026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=1154226637562538026' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1154226637562538026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1154226637562538026'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/perform-clientlogin-using-curl.html' title='Perform ClientLogin using curl'/><author><name>Jeff Scudder</name><uri>http://www.blogger.com/profile/10171738514445498413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-3745270509165397724</id><published>2008-08-04T15:03:00.000-07:00</published><updated>2008-08-04T16:57:51.992-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='calendar'/><title type='text'>Create Calendar Gadget using the Google Data Java client library.</title><content type='html'>Create Calendar Gadget (WebContent event) using the Google Data Java client library.

&lt;pre name="code" class="java"&gt;  public DateTime getToday() {

  Date today = new Date();

  DateTime datetime = new DateTime(today);

  datetime.setDateOnly(true);

  return datetime;  
}

public DateTime getTomorrow() {

  long oneDay = 24 * 60 * 60 * 1000;

  Date today = new Date();

  DateTime datetime = new DateTime(new Date(today.getTime() + oneDay));

  datetime.setDateOnly(true);

  return datetime;
}

public void createWebContent() throws Exception {
  URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/private/full");

  CalendarEventEntry entry = new CalendarEventEntry();

  entry.setTitle(new PlainTextConstruct("create web content"));
  entry.setContent(new PlainTextConstruct("This event is created by Java client library"));

  DateTime startTime = getToday();
  DateTime endTime = getTomorrow();

  When eventTimes = new When();
  eventTimes.setStartTime(startTime);
  eventTimes.setEndTime(endTime);
  entry.addTime(eventTimes);

  WebContent wc = new WebContent();

  wc.setTitle("title");
  wc.setType("text/html");
  wc.setIcon("http://www.google.com/intl/en_ALL/images/logo.gif");
  wc.setUrl("http://www.google.com");
  wc.setWidth("800");
  wc.setHeight("600");

  entry.setWebContent(wc);

  // Send the request and receive the response:

  calendarService.insert(feedUrl, entry);
  System.out.println("Calendar Gadget is created");
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-3745270509165397724?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/3745270509165397724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=3745270509165397724' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/3745270509165397724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/3745270509165397724'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/create-calendar-gadget-using-google.html' title='Create Calendar Gadget using the Google Data Java client library.'/><author><name>Austin Chau (Google)</name><uri>http://www.blogger.com/profile/15644867667545141875</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-7502067598476880109</id><published>2008-08-04T15:01:00.000-07:00</published><updated>2008-08-04T16:56:35.169-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='contacts'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Edit contact phone numbers using Python</title><content type='html'>This sample shows the creation of a contact using the Google Contacts API. The phone number for the contact is then removed by editing the local contact entry object and uploading. At the ned, the script asks you to press enter before deleting the test contact.
&lt;pre name="code" class="python"&gt;
import gdata.contacts.service
import atom
import gdata.contacts
import getpass

client = gdata.contacts.service.ContactsService()
client.email = raw_input('Please enter your email address')
client.password = getpass.getpass()
client.source = 'Google-ContactsGetTest-1.0'
client.ProgrammaticLogin()

name = 'Fred'
notes = 'Test entry'
primary_email = 'test2903488769871632@example.com'
new_contact = gdata.contacts.ContactEntry(title=atom.Title(text=name))
new_contact.content = atom.Content(text=notes)
new_contact.email.append(gdata.contacts.Email(address=primary_email,
                         primary='true', rel=gdata.contacts.REL_WORK))
new_contact.phone_number.append(gdata.contacts.PhoneNumber(
    rel=gdata.contacts.REL_OTHER, text='555-1212-3242'))
entry = client.CreateContact(new_contact)

if entry:
  print 'Creation successful!'
  print 'Edit link for the new contact:', entry.GetEditLink().href
else:
  print 'Upload error.'

# Remove the phone number
del entry.phone_number[0]

updated = client.UpdateContact(entry.GetEditLink().href, entry)
if updated:
  print 'Update successful!'
  print 'Edit link for the updated contact:', updated.GetEditLink().href
else:
  print 'Upload error.'

raw_input('enter to delete')
client.Delete(updated.GetEditLink().href)&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-7502067598476880109?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/7502067598476880109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=7502067598476880109' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/7502067598476880109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/7502067598476880109'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/edit-contact-phone-numbers-using-python.html' title='Edit contact phone numbers using Python'/><author><name>Jeff Scudder</name><uri>http://www.blogger.com/profile/10171738514445498413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-9029852378561045846</id><published>2008-08-04T14:55:00.000-07:00</published><updated>2008-08-04T16:55:45.850-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spreadsheets'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Batch update spreadsheet cells using Python</title><content type='html'>Using the gdata-python-client, you can change the value in multiple cells with one HTTP request. Here is an example:&lt;pre name="code" class="python"&gt;import gdata.spreadsheet
import gdata.spreadsheet.service

client = gdata.spreadsheet.service.SpreadsheetsService()
client.email = 'your email address'
client.password = 'your password'
client.ProgrammaticLogin()

# Use the spreadsheet key and worksheet ID for the worksheet you want to edit.
cells = client.GetCellsFeed('pKq0C...', wksht_id='od6')

batchRequest = gdata.spreadsheet.SpreadsheetsCellsFeed()

# This sample changes the first four cells in the spreadsheet.
cells.entry[0].cell.inputValue = 'x'
batchRequest.AddUpdate(cells.entry[0])
cells.entry[1].cell.inputValue = 'y'
batchRequest.AddUpdate(cells.entry[1])
cells.entry[2].cell.inputValue = 'z'
batchRequest.AddUpdate(cells.entry[2])
cells.entry[3].cell.inputValue = '=sum(3,5)'
batchRequest.AddUpdate(cells.entry[3])

updated = client.ExecuteBatch(batchRequest, cells.GetBatchLink().href)&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-9029852378561045846?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/9029852378561045846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=9029852378561045846' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/9029852378561045846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/9029852378561045846'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/08/batch-update-spreadsheet-cells-using.html' title='Batch update spreadsheet cells using Python'/><author><name>Jeff Scudder</name><uri>http://www.blogger.com/profile/10171738514445498413</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-2031679608546622391</id><published>2008-07-31T13:22:00.000-07:00</published><updated>2008-07-31T13:28:33.948-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Printing out Video thumbnails for a user's upload feed</title><content type='html'>A quick helper function to print thumbnails for all entries in a user's upload feed.

&lt;pre name="code" class="php"&gt;
&amp;lt;php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');

function printThumbnails($username)
{
  $yt = new Zend_Gdata_YouTube();
  $userVideoFeed = $yt-&gt;getUserUploads($username);

  foreach($userVideoFeed as $videoEntry) {
    print "&lt;h1&gt;Thumbnails for entry $videoEntry-&gt;title &lt;/h1&gt;";
    $videoThumbnails = $videoEntry-&gt;getVideoThumbnails();
    foreach($videoThumbnails as $videoThumbnail) {
      echo $videoThumbnail['time'] . ' -- ' . 
        '&amp;lt;img src="' . $videoThumbnail['url']. '" height=' .
        $videoThumbnail['height'] . ' width=' . $videoThumbnail['width'] . ' /&amp;gt;';
    }
  }
}
?&amp;gt;

&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-2031679608546622391?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/2031679608546622391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=2031679608546622391' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2031679608546622391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2031679608546622391'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/printing-out-video-thumbnails-for-users.html' title='Printing out Video thumbnails for a user&apos;s upload feed'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-1184492630986285303</id><published>2008-07-29T14:43:00.000-07:00</published><updated>2008-07-29T14:46:33.597-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='DocList'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Save A Google Docs Document As A File In .NET</title><content type='html'>Given a DocumentEntry, save to local file "C:\example.html"

&lt;pre name="code" class="CSharp"&gt;
Uri documentUri = new Uri(entry.Content.AbsoluteUri);
Stream stream = service.Query(documentUri);
StreamReader streamReader = new StreamReader(stream);
StreamWriter streamWriter = new StreamWriter("C:\\example.html");
string line = "";
while( (line = streamReader.ReadLine()) != null) {
    streamWriter.WriteLine(line);
}
streamReader.Close();
streamWriter.Close();
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-1184492630986285303?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/1184492630986285303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=1184492630986285303' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1184492630986285303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/1184492630986285303'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/save-google-docs-document-as-file-in.html' title='Save A Google Docs Document As A File In .NET'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-4731940046170019111</id><published>2008-07-28T12:59:00.001-07:00</published><updated>2008-07-28T13:00:39.229-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Deleting Video Entrys based on Video ID and Developer Key</title><content type='html'>A quick helper function explaining how to delete Video Entry's from YouTube based on a Developer Tag and based on an array of Video ID's to delete. Please note that this example assumes the use of the PHP Client Library.

&lt;pre name="code" class="php"&gt;
/**
 * Delete a video matching a developer tag and a video id.
 *
 * @param $youTubeService Zend_Gdata_YouTube An authenticated YouTube service object.
 * @param $developerTag string A developer tag for which to retrieve videos.
 * @param $videoIdsToDelete array An array of video ids to be deleted.
 * @return void
 */
function deleteVideosByDeveloperTag($youTubeService, $developerTag, $videoIdsToDelete)
{
 $devTagUrl = 'http://gdata.youtube.com/feeds/videos/-/%7B' .
   'http%3A%2F%2Fgdata.youtube.com%2Fschemas%2F2007%2F' .
   'developertags.cat%7D' . $developerTag;

  $devTagFeed = $youTubeService-&gt;getVideoFeed($devTagUrl);

  foreach($developerTagFeed as $videoEntry) {
    if ($entry instanceof Zend_Gdata_YouTube_VideoEntry) {
      $videoIdsToBeDeleted[] = $videoEntry-&gt;getVideoId();
    }
  }

  // Then use a read-write feed to actually perform the deletion(s)
  $myVideoFeed = $youTubeService-&gt;getUserUploads('default');

  foreach($myVideoFeed as $videoEntry) {
    $id = $videoEntry-&gt;getVideoId();
     if (in_array($id, $videoIdsToBeDeleted) {
       $youTubeService-&gt;delete($videoEntry);
    }
  }
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-4731940046170019111?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/4731940046170019111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=4731940046170019111' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4731940046170019111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4731940046170019111'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/deleting-video-entrys-based-on-video-id.html' title='Deleting Video Entrys based on Video ID and Developer Key'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-4819608049861685698</id><published>2008-07-27T22:33:00.000-07:00</published><updated>2008-07-27T22:48:31.996-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='labels'/><title type='text'>Labeling Blogger Posts</title><content type='html'>&lt;p&gt;When posting to Blogger, it's useful to organize your posts using using labels. When using the normal Blogger interface, this is done by adding a comma-separated list of labels to a text field at the bottom of the post. To achieve the same effect using the Blogger API, add an individual &lt;code&gt;&amp;lt;atom:category&amp;gt;&lt;/code&gt; element for each label to your post's entry. Set the scheme to &lt;code&gt;'http://www.blogger.com/atom/ns#'&lt;/code&gt;, and set the term to your desired label.&lt;/p&gt;

&lt;p&gt;For example, the following code for the Zend_Gdata PHP client library would add the labels "foo" and "bar" to a post (stored in &lt;code&gt;$entry&lt;/code&gt;):&lt;/p&gt;
&lt;pre name="code" class="php"&gt;$label1 = new Zend_Gdata_App_Extension_Category(
     'foo', 'http://www.blogger.com/atom/ns#');
$label2 = new Zend_Gdata_App_Extension_Category(
     'bar', 'http://www.blogger.com/atom/ns#');
$entry-&gt;setCategory(array($label1, $label2));&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-4819608049861685698?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/4819608049861685698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=4819608049861685698' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4819608049861685698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4819608049861685698'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/labeling-blogger-posts.html' title='Labeling Blogger Posts'/><author><name>Trevor Johns</name><uri>http://www.blogger.com/profile/04465221509532799738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-6279632030844008128</id><published>2008-07-26T17:44:00.000-07:00</published><updated>2008-08-02T18:10:49.102-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='signed'/><category scheme='http://www.blogger.com/atom/ns#' term='authsub'/><category scheme='http://www.blogger.com/atom/ns#' term='secure'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Secure AuthSub in PHP</title><content type='html'>A helper for sending a signed HTTP GET request in PHP.
&lt;p&gt;
// upgrade a single-use AuthSub token&lt;br&gt;
$response = signedGET('https://www.google.com/accounts/AuthSubSessionToken', $singleUseToken);
&lt;/p&gt;
&lt;p&gt;
// fetch Calendar data&lt;br&gt;
$response = signedGET('http://www.google.com/calendar/feeds/default/allcalendars/full', $sessionToken);
&lt;/p&gt;

&lt;pre name="code" class="php"&gt;
&amp;lt;?php
function signedGET($requestURL, $token) { 
  $privKeyFilePath = "../myrsakey.pem";
  $timestamp = time();
  $nonce = md5(microtime() . mt_rand()); 
  $sigalg = 'rsa-sha1';
  
  // construct the data string
  $data = "GET $requestURL $timestamp $nonce";
  
  // get rsa private key
  $fp = fopen($privKeyFilePath, "r");  
  $priv_key = fread($fp, 8192);
  fclose($fp);                                

  // compute signature
  $privatekeyid = openssl_get_privatekey($priv_key);
  openssl_sign($data, $signature, $privatekeyid, OPENSSL_ALGO_SHA1);
  openssl_free_key($privatekeyid);

  $curl = curl_init($requestURL);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_FAILONERROR, true);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  
  // Set Authorization header 
  $sig = base64_encode($signature);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
      "Authorization: AuthSub token=\"$token\" data=\"$data\" sig=\"$sig\" sigalg=\"$sigalg\"")
  ); 
  
  $result = curl_exec($curl);
  curl_close($curl);

  return $result;
}
?&amp;gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-6279632030844008128?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/6279632030844008128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=6279632030844008128' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6279632030844008128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/6279632030844008128'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/secure-authsub-in-php.html' title='Secure AuthSub in PHP'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-917639828270079359</id><published>2008-07-18T12:12:00.000-07:00</published><updated>2008-12-09T12:30:16.929-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>Retrieving private Videos using the PHP Client Library</title><content type='html'>To retrieve private videos you will need to pass the full URI of the video entry as the $location parameter to the getVideoEntry method. Assuming we have a fully authenticated YouTube service object as $service:

&lt;pre name="code" class="php"&gt;
$videoIdOfPrivateVideo = 'ABC123xyz';
$location = 'http://gdata.youtube.com/feeds/api/users/default/uploads/' . $videoIdOfPrivateVideo;
$privateEntry = $youTubeService-&gt;getVideoEntry(null, $location);
&lt;/pre&gt;

&lt;strong&gt;Update:&lt;/strong&gt; Version 1.7.1 and higher of the PHP Client Library has a new method "getFullVideoEntry()" that should take care of this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-917639828270079359?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/917639828270079359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=917639828270079359' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/917639828270079359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/917639828270079359'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/retrieving-private-videos-using-php.html' title='Retrieving private Videos using the PHP Client Library'/><author><name>Jochen Hartmann (Google)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-8612766103872581923</id><published>2008-07-18T12:07:00.000-07:00</published><updated>2008-07-18T12:08:03.624-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Enable Request Debugging in PHP client library</title><content type='html'>&lt;pre name="code" class="php"&gt;
$service-&gt;enableRequestDebugLogging('/tmp/foo.txt');
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-8612766103872581923?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/8612766103872581923/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=8612766103872581923' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8612766103872581923'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/8612766103872581923'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/enable-request-debugging-in-php-client.html' title='Enable Request Debugging in PHP client library'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-910543213401236185</id><published>2008-07-13T01:35:00.000-07:00</published><updated>2008-07-13T02:04:08.662-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>Inject parameters into a string</title><content type='html'>&lt;pre name="code" class="javascript"&gt;
/* 
 * Formats a string with the given parameters. The string to format must have
 * placeholders that correspond to the index of the arguments passed and surrounded 
 * by curly braces (e.g. 'Some {0} string {1}').
 *
 * @param {string} var_args The string to be formatted should be the first 
 *     argument followed by the variables to inject into the string
 * @return {string} The string with the specified parameters injected
 */
format = function(var_args){
    var args = Array.prototype.slice.call(arguments, 1);
    return var_args.replace(/\{(\d+)\}/g, function(m, i){
        return args[i];
    });
};

format("Is it {0}-&gt;{1} or {1}-&gt;{0}?", "chicken", "egg") == "Is it chicken-&gt;egg or egg-&gt;chicken?"
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-910543213401236185?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/910543213401236185/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=910543213401236185' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/910543213401236185'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/910543213401236185'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/inject-parameters-into-string.html' title='Inject parameters into a string'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-5183789178542024878</id><published>2008-07-13T01:14:00.000-07:00</published><updated>2008-07-13T01:33:08.069-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='json'/><category scheme='http://www.blogger.com/atom/ns#' term='json-in-script'/><title type='text'>JSON-in-script  loader</title><content type='html'>&lt;pre name="code" class="javascript"&gt;

/**
 * Loads an external javascript source by creating a &amp;lt;script&amp;gt; tag
 * and injecting it into the DOM.
 * @param {string} src Url of the js source 
 * @param {string} opt_id An optional id for the &amp;lt;script&amp;gt; tag
 */ 
function load(src, opt_id) {
  var scripts = document.getElementsByTagName('script');
  
  // prevent from loading same script twice
  var alreadyLoaded = false;
  for (var i = 0, script; script = scripts[i]; i++) {
    if (script.src == src) {
      alreadyLoaded = true;
      break;
    }
  }
  
  if (!alreadyLoaded) {
    var scriptElement = document.createElement('script');
    if (opt_id) {
      scriptElement.setAttribute('id', opt_id);
    }
    scriptElement.setAttribute('type', 'text/javascript');
    scriptElement.setAttribute('src', src);
    document.documentElement.firstChild.appendChild(scriptElement);
  }
};
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-5183789178542024878?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/5183789178542024878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=5183789178542024878' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5183789178542024878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5183789178542024878'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/json-in-script-loader.html' title='JSON-in-script  loader'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-697840489176797412</id><published>2008-07-11T15:40:00.001-07:00</published><updated>2008-07-11T15:41:27.768-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pwa'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='youtube'/><title type='text'>SimpleXML and accessing MediaRSS / other namespaces</title><content type='html'>&lt;pre name="code" class="php"&gt;
print_r($xml-&gt;getDocNamespaces());

foreach ($xml-&gt;entry as $entry)
{

  //All the media namespaced items under an entry
  $media = $entry-&gt;children("http://search.yahoo.com/mrss/%27%29;"');
  echo "Title: " . $media-&gt;group-&gt;title;
  echo "Keywords: " . $media-&gt;group-&gt;keywords;

  //There are multiple thumbnail fields, so loop through and print out
  all the attributes
  foreach($media-&gt;group-&gt;thumbnail as $thumb)
  {
    foreach ($thumb-&gt;attributes() as $a =&gt; $b)
    {
      print $a . " " . $b . "\n";
    }
  }
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-697840489176797412?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/697840489176797412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=697840489176797412' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/697840489176797412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/697840489176797412'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/simplexml-and-accessing-mediarss-other.html' title='SimpleXML and accessing MediaRSS / other namespaces'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-4244605331877542146</id><published>2008-07-11T14:38:00.000-07:00</published><updated>2008-07-21T16:40:19.277-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curl'/><category scheme='http://www.blogger.com/atom/ns#' term='atom feed'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Fetch a Google Data feed using PHP &amp; Curl</title><content type='html'>As a continuation from my last post, here's how you get a feed.

&lt;pre name="code" class="php"&gt;
&amp;lt?
// Note: this function assumes secure=0 AuthSub tokens
function getFeed($feedUri, $sessionToken) {
  $curl = curl_init($feedUri);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/atom+xml',
    'Authorization: AuthSub token="' . trim($sessionToken) . '"'
  ));
  $response = curl_exec($curl);

  if (!$response) {
    die('Error: ' . curl_error($curl) . "\n");
  }
  curl_close($curl);
  
  return $response;
}
?&amp;gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-4244605331877542146?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/4244605331877542146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=4244605331877542146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4244605331877542146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4244605331877542146'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/fetch-google-data-feed-using-php-curl.html' title='Fetch a Google Data feed using PHP &amp; Curl'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-4642170539891557469</id><published>2008-07-11T14:11:00.000-07:00</published><updated>2008-07-11T14:37:33.676-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='curl'/><category scheme='http://www.blogger.com/atom/ns#' term='authsub'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>AuthSub using PHP's libcurl</title><content type='html'>&lt;pre name="code" class="php"&gt;

&amp;lt;?
$secure = 0;
$session = 1;
$scope = 'http://www.google.com/calendar/feeds';
$next = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}";

$token = @$_GET['token'];  // only a single use token

if(!$token) {
 echo "&amp;lt;a href=\"https://www.google.com/accounts/AuthSubRequest?scope=$scope&amp;session=$session&amp;secure=$secure&amp;next=$next\"&amp;gt;Sign in to Google&amp;lt;/a&amp;gt;";
 exit;
}

$sessionToken = upgradeToken($token);
echo "Single use token: $token\n";
echo "Session token: $sessionToken";

// TODO: get a feed

function upgradeToken($token) {
  $ch = curl_init("https://www.google.com/accounts/AuthSubSessionToken");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_FAILONERROR, true);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Authorization: AuthSub token="' . trim($token) . '"'
  ));

  $result = curl_exec($ch);
  curl_close($ch);

  $splitStr = split("=", $result);

  return trim($splitStr[1]);
}
?&amp;gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-4642170539891557469?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/4642170539891557469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=4642170539891557469' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4642170539891557469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/4642170539891557469'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/authsub-using-phps-libcurl.html' title='AuthSub using PHP&apos;s libcurl'/><author><name>Eric (Google)</name><uri>http://www.blogger.com/profile/13033421744122011068</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-2000767857609631114</id><published>2008-07-09T10:54:00.000-07:00</published><updated>2008-07-09T10:55:57.245-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spreadsheets'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Access Spreadsheets list feed elements in Python</title><content type='html'>&lt;pre name="code" class="python"&gt;
# print out dictionary of row information for each row
for entry in worksheet_list_feed.entry:
  for key in entry.custom:
    print '%s: %s' % (key, entry.custom[key].text)
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-2000767857609631114?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/2000767857609631114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=2000767857609631114' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2000767857609631114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/2000767857609631114'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/access-spreadsheets-list-feed-elements.html' title='Access Spreadsheets list feed elements in Python'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-750345317759613054</id><published>2008-07-03T10:32:00.000-07:00</published><updated>2008-07-03T10:40:13.166-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='signed'/><category scheme='http://www.blogger.com/atom/ns#' term='authsub'/><category scheme='http://www.blogger.com/atom/ns#' term='secure'/><title type='text'>Signed AuthSub in Ruby</title><content type='html'>&lt;a href="http://groups.google.com/group/google-help-dataapi/tree/browse_frm/thread/5893816ff68a689e/f8689d7a9bf611bc?rnum=1&amp;_done=%2Fgroup%2Fgoogle-help-dataapi%2Fbrowse_frm%2Fthread%2F5893816ff68a689e%3Ftvc%3D1%26#doc_2cea553921272a53"&gt;Example code for signing an AuthSub request in Ruby&lt;/a&gt;.

Contributed by an awesome guy named Immad. Watch out for the groups linebreak in his line that starts with header =, though.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-750345317759613054?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/750345317759613054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=750345317759613054' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/750345317759613054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/750345317759613054'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/signed-authsub-in-ruby.html' title='Signed AuthSub in Ruby'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1982051675575479214.post-5531983620452945884</id><published>2008-07-03T10:25:00.000-07:00</published><updated>2008-07-03T10:36:54.419-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='zend'/><category scheme='http://www.blogger.com/atom/ns#' term='godaddy'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>GoDaddy SSL Proxy with Zend Framework</title><content type='html'>&lt;pre name="code" class="php"&gt;
$client = new Zend_Http_Client('https://www.example.com/', array(
       'adapter'      =&gt; 'Zend_Http_Client_Adapter_Proxy',
       'proxy_host'   =&gt; 'proxy.shr.secureserver.net',
       'proxy_port'   =&gt; 3128
)); 

        $sessionToken = Zend_Gdata_AuthSub::getAuthSubSessionToken($singleUseToken, $client);
&lt;/pre&gt;

This can also be used with ClientLogin:

&lt;pre name="code" class="php"&gt;
$clientLoginClient = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, 'cl', $client);
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1982051675575479214-5531983620452945884?l=gdatatips.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gdatatips.blogspot.com/feeds/5531983620452945884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1982051675575479214&amp;postID=5531983620452945884' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5531983620452945884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1982051675575479214/posts/default/5531983620452945884'/><link rel='alternate' type='text/html' href='http://gdatatips.blogspot.com/2008/07/godaddy-ssl-proxy-with-zend-framework.html' title='GoDaddy SSL Proxy with Zend Framework'/><author><name>Jeff Fisher</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
