« Back to the API home page

OpenCourseWare Search API from OCW Search

The OCW Search API described on this page gives you access to the full OCW Search index programmatically.

API Documentation - Basics

The API is designed to be very simple to use. You construct a URL that you retrieve the contents of, and it returns a JSON output of the search results.

The API is versioned, meaning that each API endpoint specifies the version number. This maintains backwards compatability in that when the API gets updated in a way that would break the default behavior, it gets a new version number, and your application will not break.

The API outputs only JSON. Support for XML responses are not planned unless there is significant demand for it. See the Mailing List and Getting Help section below for contact details.

Currently the API does not support JSONP but this is a planned top priority. JSONP will allow you to use the API in web browsers as it is a secure mechanism to do cross-domain scripting.

API Endpoint

The API endpoint is of this format:

http://www.ocwsearch.com/api/vX/search.json?q=QUERY&page=PAGE&contact=CONTACT

In detail:

For example, to search for the word "statistics", the URL of the results is:

http://www.ocwsearch.com/api/v1/search.json?q=statistics&contact=http%3a%2f%2fwww.ocwsearch.com%2fabout

Both QUERY and CONTACT must be URL-encoded. PAGE is always a number, so it does not matter, but QUERY and CONTACT is text and must be. If you do not URL encode, it is likely you will see some API calls fail.

JSON Response

The JSON response is divided into three sections:

Very important point: all courses will have at least the title, the description, and the URL. However, any of the remaining fields may be missing because the institution does not share it readily, if at all. The most likely field to be missing is the teaching date, but there are examples of other fields missing. When a field is unknown, it will be returned as an empty string.

Caching

Please implement results caching in your web application if possible. OCW Search index updates occur only once every 1-3 weeks and so the results for a query will not change in the meantime.

Rate Limiting

At the moment there isn't a hard rate limiter in place, but the API usage is monitored. Heavy users will be contacted (that is why we need the contact details in each API call), and abusers will be banned out-right.

Debugging

As the API output is JSON, any JSON-aware debugging tool will work. Here is a selection:

Mailing List and Getting Help

For contacting us privately, please email apicontact (at) ocwsearch (dot) com.

We also maintain a mailing list for anyone using or interested in the API. You can subscribe using this form:

Google Groups
Subscribe to OCW Search API
Email:
Visit this group

The mailing list is for pretty much anything API related: