最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Get company name from Linkedin api - Stack Overflow

programmeradmin1浏览0评论

Im trying to get the pany name from a specific url and ID. So, I need to get the pany someone is currently at and displaying that. Here's my code so far:

> <script type="text/javascript">   function OnLinkedInFrameworkLoad() { 
> IN.Event.on(IN, "auth", OnLinkedInAuth); }
> 
>   function OnLinkedInAuth() {
>     IN.API.Profile("me").result(ShowProfileData);
>     IN.API.Raw("/people/~/picture-urls::(original)").result(highRes); }
> 
>     function highRes(images) {
>       var img = images.values[0];
>       $('#user').append('<img src="' + img + '">');
>     }
> 
>   function ShowProfileData(profiles) {
>     var member = profiles.values[0];
>     var id=member.id;
>     var firstName=member.firstName; 
>     var lastName=member.lastName; 
>     var imgSrc=member.pictureUrl; 
>     var headline=member.headline;
> 
>     var url = "/" + id + "/picture-url";
>     console.log(member)
>     console.log(url)
>     console.log(pany)
>     //use information captured above
> 
>     $("p").append("You are logged in as: ")
>     $('#firstName').append(firstName);
>     $('#lastName').append(lastName);
>     $('#pany').append(pany);
> 
>     var url_2 = "/" + id + "~:(positions:(is-current,pany:(name)))";
>     console.log(url_2);
>     } </script>

The trouble I have is that I only get the basic member data and trying to fetch the pany name with another url but the url is not working..

Im trying to get the pany name from a specific url and ID. So, I need to get the pany someone is currently at and displaying that. Here's my code so far:

> <script type="text/javascript">   function OnLinkedInFrameworkLoad() { 
> IN.Event.on(IN, "auth", OnLinkedInAuth); }
> 
>   function OnLinkedInAuth() {
>     IN.API.Profile("me").result(ShowProfileData);
>     IN.API.Raw("/people/~/picture-urls::(original)").result(highRes); }
> 
>     function highRes(images) {
>       var img = images.values[0];
>       $('#user').append('<img src="' + img + '">');
>     }
> 
>   function ShowProfileData(profiles) {
>     var member = profiles.values[0];
>     var id=member.id;
>     var firstName=member.firstName; 
>     var lastName=member.lastName; 
>     var imgSrc=member.pictureUrl; 
>     var headline=member.headline;
> 
>     var url = "http://api.linkedin./v1/people/" + id + "/picture-url";
>     console.log(member)
>     console.log(url)
>     console.log(pany)
>     //use information captured above
> 
>     $("p").append("You are logged in as: ")
>     $('#firstName').append(firstName);
>     $('#lastName').append(lastName);
>     $('#pany').append(pany);
> 
>     var url_2 = "http://api.linkedin./v1/people/" + id + "~:(positions:(is-current,pany:(name)))";
>     console.log(url_2);
>     } </script>

The trouble I have is that I only get the basic member data and trying to fetch the pany name with another url but the url is not working..

Share Improve this question asked Sep 23, 2014 at 9:44 user2850509user2850509
Add a ment  | 

1 Answer 1

Reset to default 6

Ok, I solved it like this:

    <script type="text/javascript">

    function OnLinkedInFrameworkLoad() {
    IN.Event.on(IN, "auth", OnLinkedInAuth);
    // Use a larger login icon.
    $('a[id*=li_ui_li_gen_]').html('<img src="images/linkButton.png" height="40" width="130" border="0" class="linkButton" />');}

    function OnLinkedInAuth() {
    IN.API.Profile("me").fields(["firstName","headline","positions:(is-current,pany:(name))"])
    .result(function(result) {
       var firstName = result.values[0].firstName;
       var pany = result.values[0].positions.values[0].pany.name;
       $('#firstName').append(firstName);
       $('#pany').append(pany);
    })
    IN.API.Raw("/people/~/picture-urls::(original)").result(highRes);
}

    function highRes(images) {
      var img = images.values[0];
      $('.linkedin').append('<img src="' + img + '" class="profile">');
      $('.mobile-linkedin').append('<img src="' + img + '"class="profile">');
      $("#guest").hide();
      $("#hide").hide();
    }

    function ShowProfileData(profiles) {
    var member = profiles.values[0];
    var id=member.id;
    var firstName=member.firstName;

    var url = "http://api.linkedin./v1/people/" + id + "/picture-url";
    //use information captured above
    }
    </script>
发布评论

评论列表(0)

  1. 暂无评论