繁体   English   中英

使用LinkedIn API获取我自己的完整档案

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM