我試圖使用LinkedIn的JavaScript API從這個網頁JSAPI Tutorial: People Search但是當我嘗試它的JSON響應我收到的是:LinkedIn的JavaScript API - 訪問人否認
{
"errorCode": 0,
"message": "Access to people search denied.",
"requestId": "JEDHDU95PC",
"status": 403,
"timestamp": 1354094114382
}
這是我的代碼是除了將api鍵更改爲與本地主機環境相關的鍵之外,其他代碼都與其代碼相同。
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: my_key
authorize: true
</script>
<script type="text/javascript">
function loadData() {
IN.API.PeopleSearch()
.fields("firstName", "lastName", "distance", "publicProfileUrl", "pictureUrl")
.params({ "keywords": "python", "count": 10, "sort": "distance" })
.result(function (result) {
profHTML = "<h4>People search results for keyword 'python':</h4>";
for (var index in result.people.values) {
profile = result.people.values[index]
if (profile.pictureUrl) {
profHTML += "<p><a href=\"" + profile.publicProfileUrl + "\">";
profHTML += "<img class=img_border height=30 align=\"left\" src=\"" + profile.pictureUrl + "\"></a>";
profHTML += "<p>" + profile.firstName + " " + profile.lastName + " (" + profile.distance + ")</p>";
}
}
$("#search").html(profHTML);
});
}
</script>
<div id="search">
</div>
<script type="IN/Login" data-onAuth="loadData"></script>
奇怪的是,JSAPI Tutorial: Authenticating a User using JSAPI的作品。我可以驗證我的密鑰並返回數據,但它不適用於搜索,我不明白爲什麼。
r_network選項不起作用,您需要通過經審覈的API訪問表單進行請求,當他們批准後,您可以搜索更多數據。目前這項工作和人員搜索API的限制。 – Shashank