-
Vincent RABAH
-
Wynn Netherland
-
Vincent RABAH
-
Wynn Netherland
Hey there, I'm Wynn!
I'm a front-end designer & developer, CSS & JavaScript framework fanboy Razorback living in Texas.
Featured
-
Recently
Archives
Links
The Changelog – Open Source moves fast. Keep up.- NoRM - Bringing MongoDB to .NET, LINQ, and Mono
- Episode 0.1.6 - Ajax.org frameworks with Ruben Daniels and Rik Arends
- Git clone some nostalgia - NCSA Mosiac
- Ghost means never having to touch /etc/hosts again
- Prism - command line and Ruby library parser for Microformats
- Pull! Skeet - Twitter Extension for Google Chrome
- QR - Easy Redis queues with Python
- Faye - dirt simple pub/sub for Rack and Node.js
- FOWA 2010: David Recordon on Facebook Open Source Projects
- Mongrations - migrations for MongoMapper






Link LinkedIn into your next Ruby application
LinkedIn launched its new API last week, allowing any developer brave enough to implement OAuth to integrate with one of the largest social networks around. Seeking an opportunity to really understand OAuth more fully and play around with the LinkedIn API at the same time, I created the LinkedIn Ruby Gem.
What’s exposed?
The LinkedIn API documentation could use some organization. To save you some digging, here are the main aspects of the REST API.
Getting started
Before you can use the API, you’ll need to set up your API keys.
Ruby gem installation
Usage
Start by authenticating via OAuth. To play around from
irb, you’ll need to authenticate via the PIN method.require 'rubygems' require 'linkedin' # get your api keys at https://www.linkedin.com/secure/developer client = LinkedIn::Client.new('your_consumer_key', 'your_consumer_secret') rtoken = client.request_token.token rsecret = client.request_token.secret # to test from your desktop, open the following url in your browser # and record the pin it gives you client.request_token.authorize_url => "https://api.linkedin.com/uas/oauth/authorize?oauth_token=<generated_token>" # then fetch your access keys client.authorize_from_request(rtoken, rsecret, pin) => ["OU812", "8675309"] # <= save these for future requests # or authorize from previously fetched access keys client.authorize_from_access("OU812", "8675309") # you're now free to move about the cabin, call any API methodBe sure and save those access keys and just call
authorize_from_accessin subsequentirbsessions.Grabbing a profile
Once authenticated via OAuth, you can grab the profile for the authenticated user simply by calling
profileYou can also grab the profile for another user via the member id or public profile url:
If you want to see more than
first-name,last-name, andheadline, you’ll need to pass in a list of fields to return:For the full list of possible fields, check the docs.
More examples
For examples using the other API methods, check out the examples folder in the source on GitHub.
Summary
I want to give a big hat tip to John Nunemaker for helping me implement OAuth in this gem and for inspiring me with his ultra-popular Twitter gem.
Once you navigate the documentation, I believe you’ll find the LinkedIn API to be a powerful platform to integrate into your Ruby applications. Install the gem and go build somethting cool.
Related posts: