LinkedIn Get Posts API is restricted to partners?

Viewed 5

I'm making a request to LinkedIn's get posts by post urn endpoint, here my function:

async function getPost(accessToken, postUrn) {
    const url = `https://api.linkedin.com/rest/posts/${encodeURIComponent(
      postUrn
    )}?viewContext=AUTHOR`;
    const response = await fetch(url, {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "Content-Type": "application/x-www-form-urlencoded",
        "X-Restli-Protocol-Version": "2.0.0",
        "LinkedIn-Version": "202209",
      },
    });
    if (response.status == 200) {
      return await response.json();
    } else {
      console.log(response.status);
      console.log(response.statusText);
      console.log(await response.json());
      throw new Error(JSON.stringify(response));
    }
  }

The response I get is:

403
Forbidden
{
  serviceErrorCode: 100,
  code: 'ACCESS_DENIED',
  message: 'Not enough permissions to access: partnerApiPosts.GET.20220901'
}

So what's going on? I enabled all the products the were available for the app in the products section (Share on LinkedIn, Sign in with LinkedIn and Marketing Developer Platform) on developers LinkedIn page.

Microsoft documentation doesn't state that this is available only to LinkedIn partners. Is it?

0 Answers
Related