Linkedin API - 获取完整数据
Linkedin API - get full data
我尝试制作一个脚本来从 LINKEDIN 获取数据,我能够获得许多关于个人资料的信息,如姓名、邮件、phone、图片 url 等等,不幸的是如何每当我尝试时,我都无法获得工作经验和许多其他信息。
我的请求看起来像:
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,interests,publications,patents,languages,skills,date-of-birth,email-address,phone-numbers,im-accounts,main-address,twitter-accounts,headline,picture-url,public-profile-url)");
这工作正常,但让我们尝试添加公司
错误:
I added it at the end of $linkedin->getProfile
and here is the
error message what I get:
[message] => Unknown field {companies} in resource {Person}
完整功能如下:
public function linkedinGetUserInfo( $requestToken='', $oauthVerifier='', $accessToken=''){
include_once 'linkedinoAuth.php';
$linkedin = new LinkedIn($this->config['linkedin_access'], $this->config['linkedin_secret']);
$linkedin->request_token = unserialize($requestToken); //as data is passed here serialized form
$linkedin->oauth_verifier = $oauthVerifier;
$linkedin->access_token = unserialize($accessToken);
try{
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,interests,publications,patents,languages,skills,date-of-birth,email-address,phone-numbers,im-accounts,main-address,twitter-accounts,headline,picture-url,public-profile-url,educations,companies)");
}
catch (Exception $o){
print_r($o);
}
return $xml_response;
}
我找到的文档(但没有帮助我)
https://developer.linkedin.com/docs/fields
我想我错过了一些非常愚蠢的东西但无法弄清楚,有人可以帮助我吗?
您必须使用 positions
关键字而不是 companies
。
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,positions)");
以下地址中的位置字段说明。
LinkedIn 在 2015 年 5 月 12 日之前提供了所有这些字段。
"positions:(id,title,summary,start-date,end-date,is-current,company:(id,name,type,size,industry,ticker)),"+
"educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes),"+
"publications:(id,title,publisher:(name),authors:(id,name),date,url,summary),"+
"languages:(id,language:(name),proficiency:(level,name)),"+
"skills:(id,skill:(name)))";
"courses:(id,name,number),"+
"recommendations-received:(id,recommendation-type,recommendation-text,recommender))";
"patents:(id,title,summary,number,status:(id,name),office:(name),inventors:(id,name),date,url))";
但是,他们已经更新了他们的 APIs link:https://developer.linkedin.com/support/developer-program-transition
据此只有这些
配置文件 API — /v1/people/~
分享 API — /v1/people/~/分享
公司 API — /v1/companies/{id}
endpoints 将处于活动状态,Rest 需要一个 Apply with Linkedin /Partner with Linked 关联。
phone-numbers,im-accounts,main-address,twitter-accounts,headline 会在 r_contactinfo 下,需要 linkedin
申请
我尝试制作一个脚本来从 LINKEDIN 获取数据,我能够获得许多关于个人资料的信息,如姓名、邮件、phone、图片 url 等等,不幸的是如何每当我尝试时,我都无法获得工作经验和许多其他信息。
我的请求看起来像:
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,interests,publications,patents,languages,skills,date-of-birth,email-address,phone-numbers,im-accounts,main-address,twitter-accounts,headline,picture-url,public-profile-url)");
这工作正常,但让我们尝试添加公司
错误:
I added it at the end of
$linkedin->getProfile
and here is the error message what I get:[message] => Unknown field {companies} in resource {Person}
完整功能如下:
public function linkedinGetUserInfo( $requestToken='', $oauthVerifier='', $accessToken=''){
include_once 'linkedinoAuth.php';
$linkedin = new LinkedIn($this->config['linkedin_access'], $this->config['linkedin_secret']);
$linkedin->request_token = unserialize($requestToken); //as data is passed here serialized form
$linkedin->oauth_verifier = $oauthVerifier;
$linkedin->access_token = unserialize($accessToken);
try{
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,interests,publications,patents,languages,skills,date-of-birth,email-address,phone-numbers,im-accounts,main-address,twitter-accounts,headline,picture-url,public-profile-url,educations,companies)");
}
catch (Exception $o){
print_r($o);
}
return $xml_response;
}
我找到的文档(但没有帮助我)
https://developer.linkedin.com/docs/fields
我想我错过了一些非常愚蠢的东西但无法弄清楚,有人可以帮助我吗?
您必须使用 positions
关键字而不是 companies
。
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,positions)");
以下地址中的位置字段说明。
LinkedIn 在 2015 年 5 月 12 日之前提供了所有这些字段。
"positions:(id,title,summary,start-date,end-date,is-current,company:(id,name,type,size,industry,ticker)),"+
"educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes),"+
"publications:(id,title,publisher:(name),authors:(id,name),date,url,summary),"+
"languages:(id,language:(name),proficiency:(level,name)),"+
"skills:(id,skill:(name)))";
"courses:(id,name,number),"+
"recommendations-received:(id,recommendation-type,recommendation-text,recommender))";
"patents:(id,title,summary,number,status:(id,name),office:(name),inventors:(id,name),date,url))";
但是,他们已经更新了他们的 APIs link:https://developer.linkedin.com/support/developer-program-transition
据此只有这些 配置文件 API — /v1/people/~ 分享 API — /v1/people/~/分享 公司 API — /v1/companies/{id}
endpoints 将处于活动状态,Rest 需要一个 Apply with Linkedin /Partner with Linked 关联。
phone-numbers,im-accounts,main-address,twitter-accounts,headline 会在 r_contactinfo 下,需要 linkedin
申请