Unable to get companies for LinkedIn API version V2

Viewed 3338

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?

2 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

From the docs

Please note the following changes when migrating your app from v1 of the LinkedIn API Platform:

Company Pages and Showcase Pages are now surfaced as Organization and Brand resources, respectively. Both resources are considered "Organizational Entities," and share common fields and similarities in how data is accessed.

URNs uniquely identify organizational entities, and can be generated with existing company or showcase ids:

Organization: urn:li:organization:{company id}

The above code make call the rest api "List all companies that the member is an administrator of". It does not seems have a direct equivalent API available in v2.

Organisation lookup/search APIs seems nearest alternative.

Hope this helps.

Related