Skip to content

Instantly share code, notes, and snippets.

@jsjohnst
Created May 13, 2011 17:10
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jsjohnst/970913 to your computer and use it in GitHub Desktop.
Save jsjohnst/970913 to your computer and use it in GitHub Desktop.
Example of getting recommendations from LinkedIn JSAPI
<html>
<head><title>Your Recommendations</title></head>
<body>
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: <your API key>
authorize: true
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="IN/Login" data-onAuth="authSuccess"></script>
<script>
function authSuccess() {
var recos_element = $("#recos");
IN.API.Raw("/people/~/recommendations-received").result(function(result) {
for(var key in result.values) {
var reco = result.values[key];
recos_element.append($('<p><i><b>' + reco.recommender.firstName + ' ' + reco.recommender.lastName + '</b> says,</i><br>&nbsp;&nbsp;&nbsp;' + reco.recommendationText + '</p>'));
}
});
}
</script>
<h1>Your Recommendations</h1>
<ul id="recos"></ul>
</body>
</html>
@Mark-H
Copy link

Mark-H commented May 17, 2011

Is there anyway to use this without forcing the visiting user to sign in with linkedIn?

@jsjohnst
Copy link
Author

No, user authentication is required to be able to access their LinkedIn data. LinkedIn is obsessive about insuring user's privacy of their data.

@Mark-H
Copy link

Mark-H commented May 17, 2011

Maybe I'm misunderstanding this gist then..
I'm trying to display my own recommendations, or do those limits also affect that?

@jsjohnst
Copy link
Author

Hello Mark,

Yes, there is a confusion then over what this gist is showing. I will make another gist which shows how you could do that. :)

-Jeremy

@Mark-H
Copy link

Mark-H commented May 18, 2011

If you could, that would be amazing :)

@varunkumar
Copy link

Hi Jeremy,

I am also interested in showing my own recommendations on my personal site.

Thanks,
Varun

@amdbuilder
Copy link

I'm with Mark and Varun, I would love the ability to show other's recommendations of me on my website.

@raulriera
Copy link

I tried editing this to show my own recommendations but it doesn't work :(

@iaminawe
Copy link

iaminawe commented May 8, 2012

I am also very interested in being able to pull recommendations from my profile in linkedin and display it on my site. Thanks in advance for any assistance.

@cisnerosebastian
Copy link

me too. Any news on this?

@cisnerosebastian
Copy link

Jeremy, where you able to accomplish this? i've been checking all your gits but haven't found the solution you "promised" on https://gist.github.com/970913#gistcomment-31449

@TheAshwanik
Copy link

Hi Jeremy,
I have tried to use your solution, and it works well when I use my own credentials. It shows all the recommendations I had recieved.
But when some other user is trying to see my recommendations:

  1. He is asked to Login. (Which would be great to avoid)
  2. One he logs in I see the error as follows
    Error: t.recommendationsReceived.values is undefined

I am guessing the error is Because this user does not have any recommendations, and the API is trying to load the recommendation from the logged in users account.
Could you please share the solution you mentioned on https://gist.github.com/970913#gistcomment-31449
, that is to be able to show my own recommendations without anyone to login.

Thanks

@jahdakine
Copy link

Thanks for this gist!
I found that it doesn't work unless you add this:
scope: r_fullprofile
between lines 4 and 7...

Hopefully that helps some of the rest of you asking questions about this.

@ankitjaiswal25
Copy link

Hi Jeremy,
I have tried this API code but not worked for me,I just want to extract all our website user's linkedin recommendation like you have shown in example & show it to their profile.
Please help me out..
Thanks!!!!!

@agnihotriketan
Copy link

{
"errorCode": 0,
"message": "Access to recommendations-received denied",
"requestId": "xxxxxxxxxxxxxx",
"status": 403,
"timestamp": xxxxxxxxxxxx
}

I am not able to access the recommendation. Anyone faced this ? any solution

@thecherrytree
Copy link

@agnihotriketan, it looks like you need to be a member partner to do this now, or did you have any luck?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment