Step 3In
the FetchData function of the sample gadget, there are three changes that need to be made
Change 1Change the URL parameter
so that it calls the desired GData endpoint.
For example, the sample gadget has the line:
url = 'http://www.google.com/m8/feeds/contacts/default/base';
If you were trying to access the user's list of Google Finance portfolios you could change it to:
url = 'http://finance.google.com/finance/feeds/default/portfolios';
Change 2At the bottom of the FetchData function of the sample gadget, change the "service" parameter to load the JavaScript classes for the particular GData service that you are accessing.
For example, the sample gadget has the line:
var service = new google.gdata.contacts.ContactsService('testapp');
If you were trying to access the the Google Calendar service you could change it to:
var service = new google.gdata.calendar.CalendarService('testapp');
If you do want to access the raw results of the Google Data request, and do not want to use application specific helper classes, then use the google.gdata.client.Service function.
Change 3:Then change the service.getContactFeed function to instead use the application specific version of this function.
For example, the sample gadget has the line:
service.getContactFeed(url, callback, callback);
If you were trying to access the Google Calendar feed you could change it to:
service.getCalendarsFeed(url, callback, callback);
If you do want to access the raw results of the Google Data request,
and do not want to use application specific helper classes, then use
the service.getFeed function.
Step 4Modify
the ShowResults function of the sample gadget to parse the data
returned by the Google Data function and display the results in some basic way
so you can confirm the gadget is properly communicating with the Google Data endpoint. The sample gadget expects to get a list of a user's contacts and displays them. You can use th
e Google Data JavaScript library to make it easier to interact with the results returned by the Google Data request. That library has specific support for a few applications such as Calendar, Blogger, & Contacts. For other applications you can still use the
google.gdata.client class to provide basic helper functions.
If you are interested in JavaScript library support for other applications, please let us know because we prioritize the development of them based on developer feedback.
Step 5One common complaint is that the workflow that an end-user must go through to approve your gadget's access to the end-user's data. However you can modify your gadget so that after the user goes through that approval flow, they will be automatically redirected back to your gadget, and the gadget can them immediately load their data. To do this in iGoogle, you will redirect the user to an iGoogle URL that includes a reference to your gadget. The details of this are
TBDYou may notice that gadgets developed by Google themselves do not go through this approval process. For example, the gadget
http://dirk.balfanz.googlepages.com/contacts.xml will access your Google Mail contact list. That is because we maintain a whitelist of specific gadgets Google has built which we trust to access specific data, for example the official Google Book Search gadget is trusted to access the Google Book Search API. However as a matter of policy we do not add gadgets developed outside Google to that whitelist.