WP-APP: Atom Publisher Protocol for WordPress

Last year in March when my son Noah was born I deployed Wiki Central (a JSPWiki-based multi-wiki service inside IBM). Now here I am waiting at home for my third child to be born any minute now and as I read a post from Danny on making gadgets viral I felt I needed to do something about it. I figured APP would be an integral part of that realization and I needed yet another cheezy platform to make it happen, so I wrote a second one, except this time for WordPress.

Simply drop app.php into your root wordpress install directory and have some Atom/APP fun.

If you don’t have wordpress installed, I’ve setup a demo server for you to try it out. First, register to get your own account, since you won’t be able to post/put/delete entries without a valid username and password. The rest is all curl geekiness for those who care.

  • You may get the introspection service via http://torrez.us/code/wp-app/demo/app.php
  • You may get the main entries feed via http://torrez.us/code/wp-app/app.php/entries
  • Save a sample entry.xml from my demo site.
  • Login:
    curl -X POST -v -d "log=username&pwd=password" -c cookies.txt http://torrez.us/code/wp-app/demo/wp-login.php
  • POST a new entry:
    curl -v -X POST --data-binary @entry.xml -b cookies.txt http://torrez.us/code/wp-app/demo/app.php/entries
  • PUT a modified entry:
    curl -v -X PUT --data-binary @entry.xml -b cookies.txt http://torrez.us/code/wp-app/demo/app.php/entry/{$post_ID}
  • DELETE an entry:
    curl -X DELETE -v http://torrez.us/code/wp-app/demo/app.php/entry/{$post_ID}

Maybe I’ll start my own series on this short PHP excursion with Atom. It was a good coding experience but unfortunately I didn’t take a lot of notes, except a few bookmarks here and there. Anyhow, there’s definitely a lot to talk about: the state of XML parsing in PHP5, issues with PHP in hosted environments, developing with WordPress, Atom/APP in general, REST, crashing APE, etc.

Please give it a try and let me know how it works. It definitely only works in PHP5 due to poor namespace support in SAX/expat in PHP4. If you find any bugs please let me know and I’ve already started talking to Matt to integrate into WordPress once APP is finalized. A wp-plugins.org workspace coming soon!

UPDATE: I forgot to mention all of the things I didn’t do, but that are coming:

  • Media support
  • HEAD support
  • Caching/ETags support
  • Better Atom mapping to WordPress DB
  • Figure out the I18N status
  • POST tunneling

  • co.mments
  • connotea
  • del.icio.us
  • digg
  • Ma.gnolia
  • Reddit
  • scuttle
  • Technorati
  • YahooMyWeb

About this entry