bannerColor WARNING_YELLOW templateName stackForums

Making an API Call with an OAuth Token

The first thing you'll likely want to do is retrieve the profile for the member who just gave your application access. This involves making a simple request signed with the OAuth authentication information.

As an example, let's get a very basic version of this member's profile.


This example uses the python oauth2 library.

import oauth2 as oauth
import time

url = ""

consumer = oauth.Consumer(
token = oauth.Token(

client = oauth.Client(consumer, token)

resp, content = client.request(url)
print resp
print content

With this you get a basic default profile for the currently signed-in user:

<?xml version=

"1.0" encoding="UTF-8" standalone="yes"?>
  <headline>Developer Advocate at LinkedIn</headline>


The script attached to the Getting an OAuth Token in Ruby document goes through the process of executing a basic profile call once the token is retrieved.  The basic code for making a call once you've retrieved your token looks like the following.  If you need more details, refer back to the original Ruby document.

consumer =, CONSUMER_SECRET, consumer_options)
access_token =, oauth_token, oauth_secret)
# Pick some fields
fields = ['first-name', 'last-name', 'headline', 'industry', 'num-connections'].join(',')
# Make a request for JSON data
json_txt = access_token.get("/v1/people/~:(#{fields})", 'x-li-format' => 'json').body
profile = JSON.parse(json_txt)
puts "Profile data:"
puts JSON.pretty_generate(profile)

Congratulations!  You've now successfully made a signed request to the LinkedIn API.  You can find documentation for each of the API resources on our documentation page.  Please post any questions to our forums, and let everyone know when you have a cool LinkedIn app to share.  Have fun!