Friday, January 28, 2011

Introducing the Avvo API

Moved here

As we announced on the Avvo Blog, we're formally introducing the Avvo API. This means that developers can integrate with the data in our professional directory in a way that makes sense for their sites and applications. The API is RESTful, and returns all responses in JSON, so it should be simple to integrate into your own apps.

For Ruby developers, we went one step further—we released a gem that makes it even simpler to integrate the information on Avvo into your own sites and applications. The Avvo API gem is available on github and can be installed easily into your own apps.

Installing the gem is as simple as

gem install avvo_api

If you use Bundler in your app, you just need to put the following in your Gemfile:

source "http://rubygems.org"
gem 'avvo_api', "~>0.1"

And you should be ready to go. It's easy to get started with the API—all you need is an Avvo account and an API key from Josh King. Here's a short example:

require 'avvo_api'
AvvoApi.setup('user@avvo.com', 'password')
lawyer_id = AvvoApi::Lawyer.search(:q => 'tax', :loc => 'Seattle, WA')["results"].first["id"]

lawyer = AvvoApi::Lawyer.find(lawyer_id)

review = lawyer.reviews.first
puts "#{review.overall_rating} - #{review.title}"    

For more documentation and examples, take a look at the Readme on github and the rdoc built from the gem. The API gem uses another project, Reactive Resource, which you should check out if you're wrapping other REST APIs with ActiveResource.

You can find full documentation and try the API on the API documentation site. We're excited to see what you come up with!

No comments: