我正在尝试使用此网页JSAPI 教程:人物搜索中的 LinkedIn JavaScript API,但是当我尝试它时,我收到的 json 响应是这样的:
{
"errorCode": 0,
"message": "Access to people search denied.",
"requestId": "JEDHDU95PC",
"status": 403,
"timestamp": 1354094114382
}
这是我的代码,与他们的代码相同,只是我将 api 密钥更改为与我的 localhost 环境关联的密钥。
<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 教程:使用 JSAPI 验证用户有效。我可以验证我的密钥并返回数据,但它不适用于搜索,我不明白为什么。