我需要获取用户的组
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
}
当我使用 result.values [0] .person.groupMembership.group.id 时,它表示未定义。 如何获取用户组。
答案 0 :(得分:5)
嵌套构建对象的请求将起作用:
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);
});
}
})