简体   繁体   English

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

[英]Get my own full profile with LinkedIn API

For testing purposes, I'd like to get my own full profile datas from LinkedIn API. 为了进行测试,我想从LinkedIn API获取我自己的完整个人资料数据。

So far my code looks like this : 到目前为止,我的代码如下所示:

// 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);

Although I am getting basic profile informations (firstName,headline etc...) but when it comes to full profile informations I get an object with '...' as value everytime, although the informations exist. 虽然我正在获取基本的配置文件信息(名字,标题等...),但是当涉及到完整的配置文件信息时,尽管这些信息存在,但我每次都会得到一个带有“ ...”作为值的对象。

I have r_fullprofile ticked in my LinkedIn app interface, so I don't know what I have to do to get these values. 我在LinkedIn应用程序界面中勾选了r_fullprofile,所以我不知道该怎么做才能获得这些值。

I tried your query with my own account. 我用自己的帐户尝试了您的查询。 It looks you issue is with the skills field. 看来您的问题出在技能领域。

You can see in the LinkedIn API documentation that skills are made up of a skill, and each skill has a name. 您可以在LinkedIn API 文档中看到技能是由一项技能组成的,每个技能都有一个名称。 If you only want the name returned the proper way to ask for it is skills:(skill:(name)) , whereas your request asks for skills:(name) . 如果只希望返回名称,则正确的查询方式是skills:(skill:(name)) ,而您的请求则要求输入skills:(name)

Here is an updated request for you: 这是您的更新请求:

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