Creating Professional Applications with the LinkedIn API

15,133 views
14,748 views

Published on

Presentation for the Silicon Valley Code Camp on October 9, 2011.

Walks through tutorial on how to create a search application using LinkedIn's Javascript API, and explains a more complicated faceted application made using this API.

Published in: Technology, Design
2 Comments
10 Likes
Statistics
Notes
No Downloads
Views
Total views
15,133
On SlideShare
0
From Embeds
0
Number of Embeds
103
Actions
Shares
0
Downloads
199
Comments
2
Likes
10
Embeds 0
No embeds

No notes for slide
  • \n
  • * LinkedIn APIs, REST, Javascript, Plugins\n* Love love love the developers\n* Powerful REST APIs with libraries in most programming languages\n* Focusing on the Javascript API for this example\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Javascript API\n* Fast and easy to get started\n* Handles the authentication for you \n* Just a few lines in your web page to get started\n* Lots of tutorials on our developer portal\n\n* 3 easy steps - cover quickly, then break out\n* Load the framework\n** The only variable here is your API key\n** Get an API key quickly from the developer portal\n** ... where there's also great tutorials and documentation\n* Add a login button\n** Need to give the user a way to authenticate with LinkedIn so your application can access the system\n** This tag allows you to decide where on your page to place the button\n** When the user clicks on the link, they will go through the standard LinkedIn authentication flow and the framework will be updated with the user's tokens and be ready to access the system\n* Make API Calls\nWe'll use PeopleSearch as an example. As you can see the framework is called using IN.API.function(), in this example PeopleSearch. Our framework uses the method chaining which is common in Javascript frameworks, and in this case we're using methods to tell the search what keywords we're looking for and what to do with the result.\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Creating Professional Applications with the LinkedIn API

    1. 1. Building ProfessionalApplications with the LinkedIn API Kirsten Jones Developer Advocate LinkedIn @synedra http://developer.linkedin.com
    2. 2. LinkedIn Platform• Leading platform for building the professional web• Professional profile of record• Committed to building a healthy developer ecosystem http://developer.linkedin.com
    3. 3. Javascript API•Javascript API•Simple Authentication•Convenience Methods for Common Tasks•Easy and Quick to Implement
    4. 4. What are we building? http://developer.linkedin.com
    5. 5. How will we get there?• Get an API key• Basic setup• Build a basic search• Build a faceted search• Hand wave through UI stuff http://developer.linkedin.com
    6. 6. Follow Alonghttp://tinyurl.com/linkedin-svcc http://developer.linkedin.com
    7. 7. API Key• Every application needs one• For Javascript API, bound to a single domain• “Easy” to get http://developer.linkedin.com
    8. 8. Developer Portalhttps://developer.linkedin.com http://developer.linkedin.com
    9. 9. Application List http://developer.linkedin.com
    10. 10. New Application (part 1) Company Application Name Description Javascript API Domain Application Use http://developer.linkedin.com
    11. 11. New Application (part 2) Developer Contact Email Phone Agree Add Application http://developer.linkedin.com
    12. 12. Et Voila! http://developer.linkedin.com
    13. 13. Application Setuphttp://tinyurl.com/linkedin-svcc http://developer.linkedin.com
    14. 14. Super Basic Setup Framework<script
type="text/javascript"
src="http://platform.linkedin.com/in.js">

api_key:
your_api_key_goes_here</script> Login Button<script
type="IN/Login"></script> http://developer.linkedin.com
    15. 15. Search Tutorialhttp://developer.linkedinlabs.com/tutorials/jsapi_search/ (to cheat, scroll to the bottom) http://developer.linkedin.com
    16. 16. Search Tutorial Setup Framework<script
type="text/javascript"
src="http://platform.linkedin.com/in.js">

api_key:
your_api_key_goes_here

authenticate:
true</script> Login Button<script
type="IN/Login"
data‐onAuth=
"loadData"
></script> http://developer.linkedin.com
    17. 17. People Search CallIN.API.PeopleSearch()



.result(function(result)
{








alert(JSON.stringify(result))




}
) Output{



{"numResults":79852,



"people":{







"values":[{











"headline":"President
of
the
United
States
of
America",











"id":"zto_q2QQV0",











"lastName":"Obama",











"pictureUrl":"http://media.linkedin.com/mpr/mprx/0_utI7LgNiqw5Vy87q2qVrL0XDq7rEYQxqar0rL0XjIEXsTGeNhNR_wxK1V3KvjTY4SldloZ9hVtZL",











"firstName":"Barack"



},



...]},



"_total":
1100} http://developer.linkedin.com
    18. 18. Adding ParametersIN.API.PeopleSearch()



.params({"keywords":
"princess",
"count":
10,
"sort":
"distance"})



.result(function(result)
{








alert(JSON.stringify(result))




}
){



{"numResults":31247,



"people":{







"_count":10,







"_start":0,







"_total":1100,







"values":[{











"headline":"Developer
Advocate
at
LinkedIn",











"id":"G0uYndFs07",











"lastName":"Jones",











"pictureUrl":"http://media.linkedin.com/mpr/mprx/0_8LXTPUg_‐zq6MqhxhCFtP4mpKv_nUBhxGbrOPJYy7KBQk1c02iqSjMotYRiW4K3PT66xyY8wEb9q",











"firstName":"Kirsten"



},



...]},



"_total":
1100} http://developer.linkedin.com
    19. 19. Profile Fields• http://developer.linkedin.com/ documents/profile-fields• Default fields can change (be explicit)• studlyCaps instead of hyphenated-fields• firstName, lastName, pictureUrl http://developer.linkedin.com
    20. 20. Field SelectorsIN.API.PeopleSearch()






.fields("firstName",
"lastName",
"pictureUrl")






.params({"keywords":
"princess",
"count":
10,
"sort":
"distance"})






.result(function(result)
{









alert(JSON.stringify(result));



});{



{"numResults":31247,



"people":{







"_count":10,







"_start":0,







"_total":1100,







"values":[{











"distance":"0",











"lastName":"Jones",











"pictureUrl":"http://media.linkedin.com/mpr/mprx/0_8LXTPUg_‐zq6MqhxhCFtP4mpKv_nUBhxGbrOPJYy7KBQk1c02iqSjMotYRiW4K3PT66xyY8wEb9q",











"firstName":"Kirsten"



},



...]},



"_total":
1100} http://developer.linkedin.com
    21. 21. Finished Search Apphttp://developer.linkedinlabs.com/tutorials/ jsapi_search/example.html http://developer.linkedin.com
    22. 22. Search Facets• Request facets for a member’s network• Use facets to hone search requests http://developer.linkedin.com
    23. 23. Is there a JavascriptConvenience Method for this? http://developer.linkedin.com
    24. 24. Is there a JavascriptConvenience Method for this? http://developer.linkedin.com
    25. 25. Kick it upa Notch! http://developer.linkedin.com
    26. 26. Raw REST Calls• Reach through to our powerful REST API• Leverage authentication• Deep integration• IN.API.Raw(REST_Url) http://developer.linkedin.com
    27. 27. REST People Search Javascript versionIN.API.PeopleSearch()






.fields("firstName",
"lastName",
"pictureUrl")






.params({"keywords":
"princess",
"count":
10,
"sort":
"distance"})






.result(function(result)
{









alert(JSON.stringify(result));



}); REST versionhttp://api.linkedin.com/v1/people‐search:(people:(first‐name,last‐name,picture‐url))?keywords=princess&count=10&sort=distance http://developer.linkedin.com
    28. 28. Get the Facets for the Member’s Network http://api.linkedin.com/v1/people‐search?facets=school{

"facets":
{



"_total":
1,



"values":
[{





"buckets":
{







"_total":
11,







"values":
[









{











"code":
"17939",











"count":
4196,











"name":
"University
of
California,
Berkeley",











"selected":
false









},







...







]





},





"code":
"school",





"name":
"School"



}]

}, http://developer.linkedin.com
    29. 29. People matching a facet http://api.linkedin.com/v1/people‐search?facet=school,17939{

"numResults":
4196,

"people":
{



"_count":
10,



"_start":
0,



"_total":
1100,



"values":
[





{







"firstName":
"Brian",







"id":
"2tfN8CFi1c",







"lastName":
"Karlak"





},





...





]

}} http://developer.linkedin.com
    30. 30. Field Selectors• Default values for profiles can change• Use explicit fields• “Reach inside” to get more details about requested items http://developer.linkedin.com
    31. 31. Building the Search RequestProfile Informationpeople:(






first‐name,






last‐name,






picture‐url)Parametersfacet=school,17939count=1Requesthttp://api.linkedin.com/v1/people‐search:(people:(first‐name,last‐name,picture‐url))?facet=school,17939&count=1 http://developer.linkedin.com
    32. 32. Putting it TogetherRequestIN.API.Raw("/people‐search:(people:(first‐name,last‐name,picture‐url))?facet=school,17939&count=1")



.result(function(result)
{








alert(JSON.stringify(result))




}
)Result{

"numResults":
4196,

"people":
{



"_count":
1,



"_start":
0,



"_total":
1100,



"values":
[





{







"firstName":
"Brian",







"id":
"2tfN8CFi1c",







"lastName":
"Karlak"





}
...



]

}} http://developer.linkedin.com
    33. 33. Facet ApplicationGet the Facets(and connections)IN.API.Raw("/people-search:( people:(first-name,last-name, positions:( company:(ticker,name)), educations,picture-url), ?facets=current-company,school& sort=distance&count=100")) http://developer.linkedin.com
    34. 34. Facet ApplicationGet the Peoplematching selectedfacets IN.API.Raw("/people-search:( people:(first-name,last-name, positions:( company:(ticker,name)), educations,picture-url))? sort=distance&count=25" + companyfacet + schoolfacet")) http://developer.linkedin.com
    35. 35. Learn More• Developer portal: http://developer.linkedin.com• Worksheet: http://tinyurl.com/linkedin-svcc• Twitter: @synedra http://www.princesspolymath.com• Questions? http://developer.linkedin.com

    ×