简体   繁体   中英

Get my own full profile with LinkedIn API

For testing purposes, I'd like to get my own full profile datas from 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.

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. 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) .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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