Linkedin在java脚本api中显示403禁止错误

时间:2014-06-04 13:54:31

标签: javascript api linkedin

我正在尝试搜索具有公司名称的人,但它在控制台中显示为

获取https://api.linkedin.com/v1/people-search:(num-results,people:(first-name,last-name,distance))?company-name=infosys 403(禁止)xdrpc.html?v = 0.0.2000-RC8.35784-1413:1651

我的代码:

 <html>
<head>
 <script type="text/javascript" src="http://platform.linkedin.com/in.js">
        api_key: --api-key-here--
        onLoad: onLinkedInLoad
        authorize: true
</script> 

<script type="text/javascript">

   function onLinkedInLoad() {
     alert("authenticating..");
     // Listen for an auth event to occur
     IN.Event.on(IN, "auth", onLinkedInAuth);
}

        function onLinkedInAuth() {

            IN.API.PeopleSearch()
            .fields("firstName", "lastName", "distance")
            .params({"company-name":"infosys"})
            .result(displayPeopleSearch)
            .error();

        }

    function displayPeopleSearch(peopleSearch){

        var peopleSearchDiv = document.getElementById("peoplesearch");

        var members = peopleSearch.people.values;


        for (var member in members) {
        // but inside the loop, everything is the same
        // extract the title from the members first position
            peopleSearchDiv.innerHTML += "<p>" + members[member].firstName + " " + members[member].lastName + " is a " + members[member].positions.values[0].title + ".</p>";

        }
    }
    </script>
</head>
<!-- need to be logged in to use Search; if not, offer a login button -->
<script type="IN/Login"></script>
<body>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

经过一场大战后发现,Linked IN已经创建了经过审查的API访问人员搜索只有注册到该流程的开发人员可以访问人员搜索功能