Taglets.org API examples and sample code

January 22, 2009
By

Taglets.org is founded on the idea that no matter how brilliant you and your coworkers are (or think you are), there are always going to be smarter people outside of your company. That’s why it’s an API and platform first, so that people smarter than we are can exploit the platform in ways we would never think of. Originally, we weren’t even going to build a user-interface at all, but then we decided we needed something to demonstrate the platform and as a quick-start for non-developer end-users, and thus, we built the www.taglets.org website.

However, the platform and API are still the focus. Twitter, Friendfeed, Facebook, and even the iPhone, have all demonstrated that an API is a powerful way to facilitate prototyping and innovation.  The openness of the Internet itself is perhaps the world’s most successful example.

It is with that in mind, that we have been working to provide some tools to jump-start development with the Taglets API.

Taglets API for Java Developers

Mark has released an open-source package that makes it easy for Java developers to use the Taglets API. It works with the Groovy scripting language. Download it here: http://code.google.com/p/tagletsapi/

PHP POST Outlet Example

Mark also built a very simple PHP script that demonstrates how to write an HTTP POST Taglets outlet script. In the settings for a tag, there is an option called HTTP:

taglets_tagset

In the data entry field, you put the url of a script on your web site, such as http://myserver.com/myscript.php. When a comment is posted to that tag, the Taglets.org platform will invoke that script using HTTP POST with the tag name and comment as parameters (as though a user had typed them into a form and clicked ‘Submit’). The example shows how a script can capture the tag comments to store them, and later display them to users. Most importantly, it shows how to write a script that interfaces to the Taglets platform as a HTTP POST outlet. Get the PHP code here.

Taglets.org WordPress Plugin

We’ve also put together a simple WordPress plugin called Taglets Feeder that will send comments to tags when you publish a blog post.  As every WP user knows, when creating a blog post, you can specify tags associated with the post, as shown below:

wp_addtags

For each tag specified (“taglets” and “wordpress” in the above screenshot), when you publish the post, the Taglets Feeder plugin will send a comment on that tag to Taglets.org that looks like: “[post title] [short url]”

Everyone (and every “thing”) following those tags at Taglets.org will receive the comment via the “outlets” they have specified, email, twitter, or HTTP POST.

In addition, the plugin has a setting for a “fixed tag” as shown below:

taglets-feeder-settings

This “fixed tag” setting causes the plugin to send a comment to that specified tag, in addition to the tags specified with the blog post. This can be used, for instance, to always send a comment to a tag named for your blog (e.g. “mrblog”), whenever you publish a new blog post.

Of course the plugin includes the PHP source code and is released under the GPL to use as a base for anyone wishing to expand on it.

Get the plugin from WordPress.org:  http://wordpress.org/extend/plugins/taglets-feeder/ or type following directly on your WP blog: /wp-admin/plugin-install.php?tab=plugin-information&plugin=taglets-feeder

Tags: ,

One Response to Taglets.org API examples and sample code

Buy Me A Beer

css.php