[wp-hackers] Help with the API on WordPress.org?

Mike Schinkel mikeschinkel at gmail.com
Thu Jan 1 23:21:32 GMT 2009


Hi All (especially DD32):

Happy New Year.

I need help understanding how to call the API on WordPress.org.

 What am I trying to do?  I love the new plugin install option found in
v2.7's admin console but I find the plugin search results are not very good
so I'm working on a plugin that will use Google Search results to order the
search results.  I've got it all working except for the fact that the search
results returned by requesting results from the API on WordPress.org doing
even include some of the top search results from Google using the same term.


I'm using the following Google search for the keyword "Category" (i.e. if
I'm looking for plugins related to categories.) Note how I'm search
for "*WordPress
Category Plug*", limiting to just http://wordpress.org/extend/plugins/,
omitting http://wordpress.org/extend/plugins/tags/ and requesting 100
results:

   -
   http://www.google.com/search?q=wordpress+category+plugins+site:http://wordpress.org/extend/plugins/+-site:http://wordpress.org/extend/plugins/tags/&num=100

The "equivalent" search on WordPress.org is here:

   - http://wordpress.org/extend/plugins/search.php?q=category

 For example, the Top 10 results on Google are:

   1. Category Page
   2. Category Cloud Widget
   3. Category Icons
   4. Front Page Excluded Categories
   5. Category Posts Widget
   6. My Category Order
   7. Category Order
   8. Advanced Category Excluder
   9. Collapsing Categories
   10. Enhanced Categories

 And the Top 10 results on WordPress.org (which appear to be the same as
returned by the API are):

   1. Simple Tags
   2. WP-Cumulus
   3. Search Everything
   4. Event Calendar 3
   5. WP Security Scan
   6. Admin Management Xtended
   7. Sidebar Widgets
   8. DMSGuestbook
   9. Wordpress Download Monitor
   10. Yet Another Related Posts Plugin

 Hopefully it is not a stretch for me to assert that the Google search
results are far more applicable than the WordPress.org search results?

What my code currently does is grab the Google search results and correlate
them to the WordPress.org API results which are ultimately returned from the
*plugins_api()* function found in */wp-admin/includes/plugin-install.php*.
The API call ultimately looks like this:

$request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/',
                          array( 'body' => array('action' => $action,
'request' => serialize($args))) );

I correlate the two result sets because the WordPress.org API results have
the metadata needed for the 2.7 admin console plugin search results such as
rating and version and Google search results has the desired order.  But as
stated I've found that many of the top search results from Google don't even
show up in WordPress.org's search results.  A serious bummer. :-(

So what I'm hoping is to find an API function that would let me in a single
POST send a list of plugin slugs and have it return me the same array of
plugin info and metadata for those identified plugins that is currently
being returned by the aforementioned line from plugins_api().  I know the
link to the API Docs at http://api.wordpress.org/plugins/info/1.0/ says "*If
only I had written some...Sorry -DD32*" but I'm hoping we can start
documenting here on the list? :-)  Minimally if someone could pastebin the
code for the API then I could figure it out myself.

Thanks in advance.

 -Mike Schinkel
http://mikeschinkel.com


More information about the wp-hackers mailing list