The Ohloh API is a free, REST-based programming interface to the Ohloh open source directory. You can use the Ohloh API to create your own applications and web services based on Ohloh data.
This page contains important summary information to help you get started. In-depth online documentation is available in the table of contents at left.
Some sample code can be found on the Examples page.
For questions not covered in the documenation, the Ohloh API forum can provide additional help.
Send bug reports to info@ohloh.net.
The Ohloh API has some restrictions. Please review the complete Terms of Use before you begin.
We ask that you cite Ohloh in publications that use our data. Please include a link to www.ohloh.net on your web pages.
Our terms require you to provide a link back to our site. While you're free to use any method you'd prefer, we've provided this small button for your convenience:
. We recommend linking to our home page. The following html will link the small badge to our home page:
<a href ="http://www.ohloh.net"><img src="http://www.ohloh.net/images/badges/mini.gif" width="80" height="15" /></a>
We are still very early in the design process. We've invited you to participate now to maximize your opportunity for input.
Be warned that we may make breaking changes at any time!
Before you can access the Ohloh API, you must obtain an API key. Bandwidth will initially be limited to 1,000 requests per API key per day.
Apply online for a new API key.
View the status of your existing API key.
If you have special requirements or are interested in building a large-scale application, please contact us at info@ohloh.net.
The Ohloh API returns XML-formatted data in response to HTTP GET requests.
The design concept is that for each web page on Ohloh, there may be an equivalent XML-formatted version of the page. Currently, only a small subset of the Ohloh site is available as XML, but more data will become available over time.
You must do three things to receive an XML-formatted response:
Append a .xml extension to the basic URL. For example, instead of http://www.ohloh.net/projects/1, which returns an HTML page, you would request http://www.ohloh.net/projects/1.xml.
Provide your API Key as an HTTP parameter. Your request will be forbidden without a valid api_key.
Provide the API version as an HTTP parameter. Only v=1 is supported.
For example, to view the project with ID=1 as XML, using an example API key, the complete URL would be:
http://www.ohloh.net/projects/1.xml?api_key=0123456789012345678901234567890123456789&v=1
For the sake of brevity, the API Key and version parameters will be omitted from the examples in this documentation. Remember to always include them in your actual queries.
A sample response to a project request might be:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>success</status>
<result>
<project>
<id>1</id>
<name>Subversion</name>
<created_at>2006-10-10T15:51:31Z</created_at>
<updated_at>2007-08-22T17:31:17Z</updated_at>
<description>Subversion has rapidly become the version control standard....</description>
<homepage_url>http://subversion.tigris.org/</homepage_url>
<download_url>http://subversion.tigris.org/project_packages.html</download_url>
<irc_url></irc_url>
<stack_count>1096</stack_count>
<analysis_id>51898</analysis_id>
<analysis>
<id>51898</id>
<project_id>1</project_id>
<updated_at>2007-07-12T12:21:11Z</updated_at>
<logged_at>2007-07-12T12:18:54Z</logged_at>
<min_month>2001-08-01T00:00:00Z</min_month>
<max_month>2007-07-01T00:00:00Z</max_month>
<twelve_month_contributor_count>55</twelve_month_contributor_count>
<total_code_lines>319283</total_code_lines>
<main_language_id>7</main_language_id>
<main_language_name>C/C++</main_language_name>
</analysis>
</project>
</result>
</response>
All XML returned from the Ohloh API will be contained within a root element called <response>, which will always contain a <status> element.
The <status> element will contain either success or failed.
When the <status> value is success, the HTTP response code will be 200, and the <result> element contains the data you requested.
If the status is failed, then the HTTP response code will be set appropriately (usually Bad Request or Not Found), and an <error> element will be present containing human-readable help text. For example:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>failed</status>
<error>A valid api_key is required to access this URL.</error>
</response>
Details about this project response can be found in the Ohloh API Reference project page.
Some results will contain a collection of values. When this happens, the <response> element will contain some additional elements:
For example, the response to http://www.ohloh.net/projects.xml might begin:
<response>
<status>success</status>
<items_returned>25</items_returned>
<items_available>7056</items_available>
<first_item_position>0</first_item_position>
<result>
<project>
<id>9</id>
<name>Mozilla Firefox</name>
....
Below are some common parameters you can pass when requesting any collection. These parameters control filtering, sorting, and pagination.
name, created_at, and updated_at. Most sort options are also available in a reversed order, such as name_reverse. The specific sort options available depend on the type of object requested, so check to the reference documentation for specifics.
For example, to get the most recently created accounts on Ohloh, you would request:
GET http://www.ohloh.net/accounts.xml?sort=created_at_reverse
To get the second page of projects containing "java" or "Java" in their titles, descriptions, or tags, you would request:
GET http://www.ohloh.net/projects.xml?query=java&page=2