The Lonely Planet Content API
From Lonely Planet Developer Wiki
Contents |
What is the Content API?
The Lonely Planet Content API is an application programming interface that let's you find Places that Lonely Planet has visited, and Points of Interest (POIs) within those places. The resources available will grow over time.
Right now you can:
- search for places by name
- retrieve a list of POIs in a place
- retrieve a list of POIs within a geographic bounding box
- get detailed information about a POI
The POI lists can be filtered by POI type to narrow down your search.
See Resources for details of the services.
Accessing the Content API
These read only services can be accessed anonymously over HTTP, however this access method is severely rate throttled (currently 30 requests a minute for all users). Try it now with this URL in a browser: http://api.lonelyplanet.com/api/places?name=lond
If you are seeing HTTP 503 "Service unavailable" response codes, you are being rate throttled. Anonymous access is intended for experimentation and testing/development using the API, and not for production use.
To access the API at a more usable rate, you will need to register your application and use the credentials we provide with either HTTP basic authentication or OAuth authentication to access the services from from your application.
Authenticated requests default to a throttle rate of 120 requests a minute (for each individual application), but this can be increased on a case by case basis if required.
Read Using OAuth or Using HTTP Basic for more details on how to use your application credentials to get authenticated access.
Check out this 3 minute screencast on how to register your application and use authenticated access to the Content API.
Registering your application
You must be a registered user of the Lonely Planet website to register an application. To register as a user go to: https://secure.lonelyplanet.com/members/registration/new
Once you are a registered Lonely Planet user, you can apply for an "application key" from your developer-profile page.
If you are building a gadget for LP Groups you need to set up your application credentials on your Groups account. See Accessing External Services from your Application
The first time you register an application to use Lonely Planet Content you will be asked to sign up to our Developer Terms. These terms confirm who owns what, and what we let you do with Lonely Planet content, and content that belongs to users of the Groups platform. The terms specifically limit your use of our content outside the Groups platform.
Using the Services
Check out Resources for details of the API services.
Code Samples
Here's a sample Ruby program that accesses the Lonely Planet Content API using oAuth authentication. It requires "rubgems" and the Ruby "oauth" gem. The code text is here.
