Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to get companies for LinkedIn API version V2

I use the Zoonman LinkedIn API PHP SDK to get information about companies an authenticated user is an admin of, using this bit of code:

$profileCompany = $client->get(
    'companies',
    ['is-company-admin' => "true"]
);

This worked perfectly with API version V1. However, with V2, it gives a 400 not found error. I came across this: Organization Lookup API but not exactly sure if this is the right endpoint, as there is no API call to exactly do what the above code snippet does.

Could someone please help with the right endpoint?

like image 289
Sayan Bhattacharyya Avatar asked Dec 19 '18 08:12

Sayan Bhattacharyya


1 Answers

If you have the access token from the user this is possible in v2 of the LinkedIn API. See:

https://developer.linkedin.com/docs/guide/v2/organizations/organization-lookup-api#acls

The full URL for the basic request would be:

https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED&projection=(*,elements*(*,organizationalTarget~(*)))

With paging:

https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED&projection=(*,elements*(*,organizationalTarget~(*)))&start=[...]&count=[...]

And you probably want the organization logo urls as well:

https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED&projection=(*,elements*(*,organizationalTarget~(*,logoV2(original~:playableStreams,cropped~:playableStreams,cropInfo))))&start=[...]&count=[...]

For linkedin-api-php-client see also: https://github.com/zoonman/linkedin-api-php-client/issues/31

like image 111
xberger Avatar answered Oct 18 '22 15:10

xberger