Created
May 20, 2012 09:23
-
-
Save benjaminfisher/2757473 to your computer and use it in GitHub Desktop.
Script to retrieve LinkedIn recommendations via Raw API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>Recommendations on LinkedIn</title> | |
| <script src="http://code.jquery.com/jquery-latest.js"></script> | |
| <script type="text/javascript" src="http://platform.linkedin.com/in.js"> | |
| api_key: [YOUR API KEY] | |
| authorize: true | |
| </script> | |
| <script type="text/javascript"> | |
| // Once we have an authorization, fetch the user's profile via API | |
| function onLinkedInAuth() { | |
| IN.API.Raw('/people/~:(recommendations-received)') | |
| .method('GET') | |
| .result(function(result){ | |
| var received = result.recommendationsReceived.values; | |
| $('<p>') | |
| .html('Recommendations: ' + received.length) | |
| .appendTo('#recommendations'); | |
| $.each(received, function(i, data){ | |
| $('<h3>') | |
| .html(data.recommender.firstName + " " + data.recommender.lastName) | |
| .appendTo('#recommendations'); | |
| $('<p>') | |
| .html(data.recommendationText) | |
| .appendTo('#recommendations'); | |
| }); | |
| }) | |
| }; | |
| </script> | |
| </head> | |
| <body> | |
| <script type="in/login" data-onAuth="onLinkedInAuth"> | |
| Hello, <?js= firstName ?> <?js= lastName ?>. | |
| </script> | |
| <div id="recommendations"></div> | |
| </body> | |
| </html> |
Author
Please if you can find me the issue in the below code? am getting invalid xml error :(
var payload = {
"company": {
"id": "1337"
}
};
IN.API.Raw("/people/~/following/companies?format=json").method("POST").body(JSON.stringify(payload)).result(onSuccess).error(onError);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have not fully tested this script.
It may just show the recommendations of whoever logs in, which would be pretty worthless.