Wednesday 9 November 2011

Howto use Picasa API with Blogger API




When you use the blogger api, the pages you get back contain a type of tag called 'gd:extendedProperty'. These contain some useful data.

Just do an http get to: <blogurl>/feeds/posts/default

So, for this blog you are reading: http://idratherhack.blogspot.com/feeds/posts/default

This will return a big mess o' xml, including the tags:

<gd:extendedProperty name='IS_PUBLIC_BLOG' value='true'/>
<gd:extendedProperty name='PICASAWEB_ALBUM_ID' value='5570923802870618657'/>

It turns out that one of these (PICASAWEB_ALBUM_ID) is a link to the Picasa album that is used by your blog.

You can use this link to upload pictures using the picasa api documented here http://code.google.com/apis/picasaweb/docs/2.0/developers_guide_protocol.html.

When you do the upload you'll get back another mess-o-html which will include a tag called 'content'. This should give you the 'web visible' link for the image, which you can now use in posts to your blog.



No comments:

Post a Comment