Linkedin second degree connections API

2019-03-31 08:47发布

问题:

I got the linkedin authenticated user's profile information and connection details as per the codeigniter/linkedin api method.But my final need is to get the connections of my connections.The linkedin documentation says that if we have the 'r_network' permission we will get the 1st and 2nd degree connections,but I couldn't. Please suggest a solution for fetching the second degree connections.The following is my code.

$profile_connections = $this->linkedin->profile('~/connections:(id,first-name,last-name,picture-url,industry,location,public-profile-url,positions:(company:(name)))');
$profile_connections = json_decode($profile_connections['linkedin']);

foreach ($profile_connections->values as $connections){
            $sub_connections = $this->linkedin->profile("url=".urlencode($connections->publicProfileUrl)."/connections:(id,first-name,last-name,picture-url,industry,location)");
            $sub_connections = json_decode($sub_connections['linkedin']);
        }

But while fetching the 2nd degree connection got an error message like "Access to connections denied".

回答1:

Quoted from linkedin developer forum:

API to be more explicit in terms of what is returned by the API. Only 1st degree connections are returned by the Connections API. While the r_network member permissions does grant your application access to both 1st and 2nd degree connections (this member permissions is required for both Connections API and People Search API), it's only through the People Search API which allows you access to 2nd degree connections. The Connections API has always only been restricted to 1st degree connections.

So, that's pretty much your problem.