Search code examples
javascriptapisocial-networkinglinkedin-api

retrieve people/organization information from linked in


hi I am involved in a development of web app, where I have to retrieve information of people or organization from linkedin, dynamically.Suppose user A can search for Organization and user B can search for particular person.

I have gone the throough the linked in API's but was not able to figure it out how to implement it. I am using Linkedin javascript API

Kindly help me


Solution

  • Using the LinkedIn API is a two-step process. First, get the user of your web app to authorize the app to access their LinkedIn information. This means setting up your app on LinkedIn as follows:

    https://developer.linkedin.com/apis

    Once you have that set-up, you can then query the LinkedIn API using JavaScript (I assume JavaScript is the language/method you want to use, as you tagged it).

    You can adjust the results coming back, per the documentation, by using facets and parameters. For instance, to perform a people search that returns all user's named Barack and their profile headline and summary, you'd do something like:

    IN.API.PeopleSearch()
        .fields(["headline", "summary"])
        .params({"first-name":"Barack"})
        .result(function(result) {
            alert JSON.stringify(result)
        })
    

    headline and summary are profile fields that you specify - you can change these to pull the information you need.

    Update - including code to perform a company search.

    To perform a Company Search using the JavaScript API, you'd use the IN.API.Raw() method:

    IN.API.Raw("/company-search:(facets,companies:(id,name,universal-name,website-url))")
      .result( function(result) { /* handle result */ } )
      .error( function(error) { /* handle error */ } );