[wp-hackers] Help with the API on WordPress.org?
mikeschinkel at gmail.com
Sat Jan 3 22:51:41 GMT 2009
I've managed to get a very simple proof-of-concept of my RESTful API for
WordPress plugins online. It is based on a project I developed a year ago I
called RESTian (http://code.google.com/p/restian/) for which I had planned
to release the code but never found time. I was new to PHP then (although
with 10+ years prior experience on ASP) and looking at the code I somewhat
cringe now but it is working and I can always refactor!
As an aside, the key point of RESTian, btw, was to establish standard usage
patterns for URL design for RESTful services, to establish coding patterns
for implementing RESTful services that could transcend languages (i.e.
Python, Ruby, etc. in addition to PHP), and to provide standard modules for
decided to focus on PHP so I doubt I'd be the one to move anything forward
with Python or Ruby but the other goals remain.
Anyway, here is what I have working at the moment:
*List all plugins in text/html:
*List all plugins in application/json:
*List all plugins in application/json but serve as text/plain mimetype:
*List one plugin (in this case Akismet) in text/html:*
*List one plugin (in this case Akismet) **in application/json:
*List one plugin (in this case Akismet) **in application/**json but serve as
text/plain mimetype:** *
It works quite well if I do say so myself. :-)
I could easily implement a serialized PHP response type but I want to
rearchitect the RESTian code to make it pluggable before I do that. Also,
does anyone know if there *is* a standardized PHP response type? If not,
there should be, no?
I could easily implement the ability to create subset like the following:
Or even searching (and the RSS mimetype):
You'll note that I versioned is 0.1 to indicate that it is very rough and
certainly not ready for primetime or nor should there be any expectation
that it will continue to work at this point so please no one go writing code
for it that you depend on. For one, I still need to think a lot more about
the URL design baked into RESTian and of course I need to refactor the
entire RESTian codebase. I will do my best to keep from breaking it but I
Any comments, questions, or suggestions will be appreciated.
That said, I'll soon come to the end of my free time to devote to this as I
start a major project on the 5th to last at least a month. We'll see if I
can move it forward during January but I can't promise.
More information about the wp-hackers