You are hereBlogs / Jeff Schuler's blog / Promiscuous Drupal: Building Your Site With Web APIs (DrupalCon DC 2009 notes)

Promiscuous Drupal: Building Your Site With Web APIs (DrupalCon DC 2009 notes)


Posted by Jeff Schuler - on 06 March 2009

Promiscuous Drupal: Building Your Site With Web APIs
Jeff Eaton

How many folks in this room came to Drupal after trying to build their own CMS? Quite a few... Drupal tends to emphasize homegrown, native solutions to everything.

"Drupal: the blogging software with the worst forum software built-in." -- Walkah

We love Drupal's swiss army knife -ness, but if we don't keep our minds open, and stick to the Not Invented Here -- not use existing tools -- we end up with a humungous unwieldly mess.

Drupal as one tool among many.

Enlarging the Toolbox

  • Spam Filtering (Mollom, Akismet, etc.)
  • Searching/Indexing (Solr, Google, Acquia, etc.)
  • Feed Generation (Feedburner, etc.)
  • Content Tagging (Calais, TimesTag, etc.)
  • Authentication (OpenID, etc.)
  • Sending bulk mail (Mailchimp, etc.)

Whole category of modules for Third-party integration.

Farm out stuff that:

  • Benefits from centralization
  • Requires expertise
  • Demands massive processing or sample data

Taking it up a notch:

  • Posting links? Use Delicious
  • Shoutbox? Use Twitter
  • Photos and galleries? Flickr
  • Video? YouTube, Blip.tv
  • Reviewing books? Amazon, Goodreads
  • Comments? Disqus!
  • Blogging? Use WordPress!

You will never...

  • enter product information as accurately as Amazon!
  • be as popular as Flickr.
  • write a Firefox Plugin for Link Field
  • enjoy transcoding your own video!

To take the red pill... two approaches:

  • become a crossroads
  • enhance native content
    • value add what you're already managing internally

When does this work?

  • Common on heavily social sites
  • Facebook
  • News sites
  • Personal Aggregators (FriendFeed, Tumblr)
  • External content is treated as something that lives out there

Users are active on your site even when they're not really doing something on your site.

How?

One step further: using external sources as your primary source of content...

Does this make sense?

  • How hardcore are you?
  • How badly do your content producers hate the node form?
  • External content is treated as something that lives in here
  • Drupal becomes a presentation engine
  • Drupal becomes a ... mashup?

How the...?

Our stack (LAMP + Drupal) ... and 3rd party bits.  Moving toward Drupal as one element in the rest of the services system.

Downsides

  • Filtering the firehose (tagging helps)
  • "Importing" the internet
  • 8192 auth methods (OAuth helps?)
  • Even Amazon goes down... but flipside is that there are a whole lot of others tying their fate to same:
  • Magnolia ...

Congrats, you're no longer a module developer, you're an integration specialist!

Doing it with Drupal:

If you release it

  • Support the full API.
  • Fail gracefully
  • Don't force data into nodes: store stuff in their own tables, and maintain data structure of original source as well as possible. For, say, Amazon integration, just store ISDN # in a node with a CCK field
  • Cache data whenever you can
  • Don't write an SQL query builder.. Integrate with Views
  • PHPDoc, PHPDoc, PHPDoc!

Don't forget

  • Respect API policies (Limits, Caching)
  • Don't trust the data you get back
  • There are cutting-edge options
    • CustomViews queries (Flickr?)
    • In Drupal 7, FieldAPI supports remote fields
    • NowPublic's Aggregation system: building a Drupal site on a front end to back-end APIs/processing built in C++ 

Leveraging

  • Drupal is a great tool
  • It's strengths can be weaknesses
  • Outsourcing services
  • Drupal can be a mixer
  • If you roll your own, think ahead