Imediava's Blog

Just another WordPress.com site

Monthly Archives: January 2012

Create a new list-item on google sites api

Here’s a quick explanation for those who are using the google sites api but can’t find the way to create a new list-item in an existing listpage.

Generally the problem is that the documentation seems to point to “CreatePage” as the method to use to create any kind of item. However list-item is one of the “more complex” kinds described in the following paragraph :

To create more complex entry kind that are populated on creation (e.g. a listpage with column headings), you’ll need to create the gdata.sites.data.ContentEntry manually, fill in the properties of interest, and call client.Post().

What means that for creating a new list-item we need to first create the entry manually and then “Post” it:

# Create new_entry
client.Post(new_entry, '/feeds/content/mydomain.com/mysites-page-name/')

It’s all about reading the fine print..

%d bloggers like this: