出于测试目的,我想从LinkedIn API 获取我自己的完整配置文件数据。
到目前为止,我的代码如下所示:
// Fill the keys and secrets you retrieved after registering your app
$oauth = new OAuth("APIKEY", "SECRETKEY");
$oauth->setToken("Token OAuth", "Secret User OAuth");
$oauth->disableSSLChecks();
$params = array();
$headers = array();
$method = OAUTH_HTTP_METHOD_GET;
// Specify LinkedIn API endpoint to retrieve your own profile
$url = "https://api.linkedin.com/v1/people/~:(first-name,last-name,headline,location:(name),skills:(name),educations:(id,school-name,field-of-study))?format=json";
// By default, the LinkedIn API responses are in XML format. If you prefer JSON, simply specify the format in your call
// $url = "https://api.linkedin.com/v1/people/~?format=json";
// Make call to LinkedIn to retrieve your own profile
$oauth->fetch($url, $params, $method, $headers);
$oProfile = json_decode($oauth->getLastResponse());
var_dump($oProfile);
虽然我正在获得基本的个人资料信息(名字,标题等...),但是当涉及到完整的个人资料信息时,我得到一个带有"..."的对象每次都作为价值,尽管信息存在。
我已经在我的LinkedIn应用程序界面中勾选了r_fullprofile,所以我不知道我必须做什么才能获得这些值。
我用自己的帐户尝试了您的查询。看起来你的问题是技能领域。
您可以在 LinkedIn API 文档中看到,技能由一项技能组成,并且每个技能都有一个名称。如果您只想返回名称的正确要求方式是 skills:(skill:(name))
,而您的请求要求skills:(name)
.
以下是对您的更新请求:
GET https://api.linkedin.com/v1/people/~:(first-name,last-name,headline,location:(name),skills:(skill:(name)),educations:(id,school-name,field-of-study))?format=json