[wp-hackers] Help with the API on WordPress.org?
wordpress at dd32.id.au
Fri Jan 2 01:24:12 GMT 2009
(sorry for my replies being all over the place, Gmail is absolutely
horrible for replying to mailing lists in Opera..)
2009/1/2 Mike Schinkel <mikeschinkel at gmail.com>
> On Thu, Jan 1, 2009 at 7:29 PM, DD32 <wordpress at dd32.id.au> wrote:
> > Also, For future reference, I've stored my reply of the API here:
> > http://dd32.id.au/wordpressorg-plugin-information-api-docs/
> Just a quick related question, any reason the API is not more RESTful?
Because it has no need to be?
> In case you'll not familar with the arcane details of RESTfulness, instead
> of using $_POST['action'] why not instead use URLs as nouns and use GET to
> retrieve? For example, instead of POSTing to
> http://api.wordpress.org/plugins/info/1.0/ with an action of 'query_plugins'
> instead you would simple GET a URL like this:
> http://restapi.wordpress.org/info/1.0/plugins.json?q=category where this
> would hypothetically return a list of plugins by category in JSON format.
Well.. Just checking, It can accept $_GET too, but since it was
originally spec'd for POST, i thought it'd be simpler to just not
mention it.. And keep all the params tied together (since passing a
serialised string via GET would break standards - the url would reach
maximum length quickly)
As for the multiple output formats.. That'd complicate the output
stages, Not something that was needed, So it was skipped. Generally JS
cannot access files on different domains too, so theres no real need
for a JS output given that it'd not be useable to the majority.
> Without putting my "RESTful Zealot" hat on (which I do have :-) and
> preaching all the benefits of real RESTfulness (vs. RPC over HTTP) I'll just
> say that what I just proposed would be a lot easier to work with by people
> wanting to use the API because they could do their testing using the
Well, The fact its not a human-use API really.. It accepts PHP, it
gives back PHP, It makes sense to test from within PHP, And since the
primary use of it is for WP, calling plugins_api('action',
(object)array('test'= > 'a')); makes a lot more sense than allowing
I'm not against any of those ideas, just dont see the benefit for the
purpose of the API, If you want to have a json output, you're going to
have to run through a middleman on your own server anyway, you might
as well use PHP to request and output in the format you want. (Yes,
i'm aware JSON can be used in multiple languages)
More information about the wp-hackers