如何使用LinkedIn javascript sdk检索包括所有字段的位置列表?

时间:2015-02-24 01:26:19

标签: javascript linkedin linkedin-jsapi

我想获取LinkedIn会员在其个人资料中输入的每个职位的ID,头衔,摘要,开始日期,结束日期,当前和公司名称。

我在REST Console上测试了一个查询,我得到了理想的结果。查询为“https://api.linkedin.com/v1/people/~/positions:(id,title,summary,start-date,end-date,is-current,company)?format=json”。

问题在于,当我尝试使用LinkedIn javascript SDK做同样的事情时,我没有得到每个位置的整个字段列表。我得到了完整的职位列表,但不是每个职位的所有领域。

这是我正在使用javascript SDK进行的调用:

//in this function I'm specifying the list of fields that I want to retrieve for each position
//but I'm getting only some fields (id, start-date and end-date)
function getProfileData() {
        IN.API.Raw("/people/~/positions:(id,title,summary,start-date,end-date,is-current,company)?format=json").result(onSuccess).error(onError);
}

有人知道我需要做些什么来获得与使用REST控制台相同的结果?

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

如果您想检索您的个人资料数据,请使用此

   IN.API.Profile("me")
        .fields([
                "firstName","lastName","headline","positions:(company,title,summary,startDate,endDate,isCurrent)","industry",
                "location:(name,country:(code))","pictureUrl","publicProfileUrl","emailAddress",
                "educations","dateOfBirth"])
        .result(onSuccess)
        .error(onError);

(或)如果您想要检索其他个人资料数据,请替换&#34; me&#34;与&#34; <public profile url>&#34;

   IN.API.Profile("url=https://nl.linkedin.com/in/williamhgates")
        .fields([
                "firstName","lastName","headline","positions:(company,title,summary,startDate,endDate,isCurrent)","industry",
                "location:(name,country:(code))","pictureUrl","publicProfileUrl","emailAddress",
                "educations","dateOfBirth"])
        .result(onSuccess)
        .error(onError);