Question

I am creating one application in java-script which fetch information form LinkedIn which we need.
My problem is that... I need company name, Experience, city, country from LinkedIn profile.
I'll try but i am only able to fetch name, surname, industry and headline.
Here is my code which fetch above details.

function loadData() {
IN.API.Profile("me")
.fields(["id", "firstName", "lastName", "pictureUrl","headline","industry"])
.params({"company-name": "Adobe", "sortCriteria" : "R", "current-company": "true"})
.result(function(result) {
  profile = result.values[0];
  profHTML = "<p><a href=\"" + profile.publicProfileUrl + "\">";
  profHTML += "<img class=img_border align=\"left\" src=\"" + profile.pictureUrl + "\"></a>";      
  profHTML += "<a href=\"" + profile.publicProfileUrl + "\">";
  profHTML += "<h2 class=myname>" + profile.firstName + " " + profile.lastName + "</a> </h2>";
  profHTML += "<span class=myheadline>" + profile.headline + "</span>";
  profHTML += "<h3>" + profile.industry + "</h3>";

  $("#profiles").html(profHTML);
});   

But i need to fetch company name, location and experience. i try lot of tag but didn't success.
Please give me any hint or direct me where i need which tag.
Thanks in Advance

Was it helpful?

Solution

Borrowing your code above, you'd have something like:

function loadData() {
  IN.API.Profile("me")
    .fields(["id","firstName","lastName","pictureUrl","headline","industry","threeCurrentPositions"])
    .params({"company-name": "Adobe", "sortCriteria" : "R", "current-company": "true"})
    .result(function(result) {
      profile = result.values[0];
      positions = profile.threeCurrentPositions;

      // call to company api to get company-specific location data?
    });
}

Just parse out the returned JSON data from the threeCurrentPositions as needed to get the position data, which includes the company name and company id. The company id can be used to pull company location data from the Company API, if you need that as well.

OTHER TIPS

       function onLinkedInLogin() {
            IN.API.Profile("me")
            .fields(["id", "firstName", "lastName", "pictureUrl", "publicProfileUrl", "industry", "location", "headline"])
            .result(function (result) {
                var firstName = result.values[0].firstName;
                var lastName = result.values[0].lastName;
                IN.parse(document.getElementById("profile"))
            })
         }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top