Unable to get entire information from linkedIn api

2019-08-09 03:23发布

I have tried this

Html:

<a id="li_ui_li_gen_1432549871566_0-link" class="" href="javascript:void(0);" onclick="onLinkedInLoad();" style="margin-bottom: 20px;">

JS code:

function onLinkedInLoad(logintype) {

  IN.User.authorize(function(){
          callback();
  });      

}
function callback(){
        IN.Event.on(IN, "auth", OnLinkedInAuth);
        OnLinkedInAuth();
}
function OnLinkedInAuth(){     

    IN.API.Profile("me")
.fields("firstName", "lastName", "industry", "location:(name)", "picture-url", "headline", "summary", "num-connections", "public-profile-url", "distance", "positions", "email-address", "educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes)","languages:(id,language:(name),proficiency:(level,name))","skills:(id,skill:(name))", "date-of-birth")
.result(ShowProfileData)
.error(displayProfilesErrors);    
}

function ShowProfileData(profiles) {
    console.log(profiles); return false;

    //its gives me json responce 
    /*   {
        "_total": 1,
        "values": [{
          "_key": "~",
          "distance": 0,
          "emailAddress": "xxxxx@gmail.com",
          "firstName": "xxxx",
          "headline": "xxxxx",
          "industry": "Information Technology and Services",
          "lastName": "xxx",
          "location": {"name": "xxx Area, India"},
          "numConnections": 117,
          "positions": {
            "_total": 1,
            "values": [{
              "company": {
                "id": xxxxx,
                "industry": "E-Learning",
                "name": "xxxx",
                "size": "501-1000 employees",
                "type": "Privately Held"
              },
              "id": 485779823,
              "isCurrent": true,
              "startDate": {
                "month": 2,
                "year": 2013
              },
              "title": "xxxxx"
            }]
          },
          "publicProfileUrl": "https://www.linkedin.com/pub/xxxxx/xx/xx/xx"
        }]
      } */      
}
function displayProfilesErrors(error) {
    profilesDiv = document.getElementById("profiles");
    profilesDiv.innerHTML = error.message;
    console.log(error);
}

1条回答
贼婆χ
2楼-- · 2019-08-09 04:06

It looks to me that some queried fields (e.g. languages, skills, education fields) require that your application have been approved for the Apply with LinkedIn program.

See: Profile field descriptions page which lists fields that require an additional API (i.e. 'Member profile fields available to Apply with LinkedIn developers' title), and see how one can apply for using this API: Request access to this API page.

查看更多
登录 后发表回答