[英]Get my own full profile with LinkedIn API
為了進行測試,我想從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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.