Fetching Organizational Pages in LinkedIn new versioned APIS

48 Views Asked by At

The LinkedIn Unversion APIs will be sunset by June 30th this month so I am trying to migrate my unversioned calls as soon as possible but the LinkedIn Docs are not very much clear.

Here is my current unversioned API call to fetch the pages for an account

    let url = 'https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&projection=(elements*(organizationalTarget~(id,localizedName,logoV2(original~:playableStreams))))';

The above returns a valid response with elements that are not empty

Now, I am trying to migrate to the versioned API as shown below:

let url = 'https://api.linkedin.com/rest/organizationAcls?q=roleAssignee&role=ADMINISTRATOR&projection=(elements*(organizationalTarget~(id,localizedName,logoV2(original~:playableStreams))))';
let response = await axios.get(url, {
    headers: {
        'Authorization': `Bearer ${access_token}`,
        'X-Restli-Protocol-Version': '2.0.0',
        'LinkedIn-Version': '202206',
        'Content-Type': 'application/json'
    }
});
let responseData = response.data;
let elements = responseData['elements']; //Elements is now always empty, this was never the case in the unversioned APIs

And now the returned elements are always empty.

Please how do I fix this?

0

There are 0 best solutions below