Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linkedin Api how to get groups details through people search

I need to get the groups of an user,

IN.API.Raw("/people-search:(people:(id,first-name,last-name,email-address,industry,summary,num-connections,headline,group-memberships:(group:(id)))?first-name=ramesh&last-name=kotha&count="+25).result(function(result, metadata) {
//got the details here
}

when i use result.values[0].person.groupMembership.group.id it is saying undefined. How to get the groups of a user.

like image 565
Ramesh Kotha Avatar asked Nov 15 '13 08:11

Ramesh Kotha


1 Answers

Nesting the requests to build the objects would work:

IN.API.Raw("/people-search:(people:(id,first-name,last-name,email-address,industry,summary‌,group-memberships,num-connections,headline))?first-name=ramesh&last‌​-name=kotha&count="+25)
.result(function(result, metadata) {
     console.log(result);

     for(person in result.people.values){
        console.log(person);
       IN.API.Raw()
          .url("/people/" + result.people.values[person].id + "/group-memberships:(group:(id,name),membership-state)")

         .result(function(result, metadata){

            console.log(result);
          });

    }


})
like image 197
Sam Nunnally Avatar answered Oct 03 '22 06:10

Sam Nunnally