Deepak Goud
Deepak Goud

Reputation: 5

Fetch company posts and comments with Linkedin API

I'm trying to fetch LinkedIn company page posts using the LinkedIn API. I created my app with permissions set up, and I verified the company. Then I used this URL for which I created an authorization token:

https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=xxxxxxxxxxxxxxxx&redirect_uri=https//linkedindata.cresol.in&state=foobar&scope=r_liteprofile%20r_emailaddress%20w_member_social

and using this API:

https://www.linkedin.com/oauth/v2/accessToken

I got the accessToken and then used this in the Header like this:

Authorized : 
Bearer AQUau_EPV1RVuoclp2BXRGBXjvDDCS2fsULTeNDBD5xmRohRW3q7nbVu9FFfeeucPUYCnGub1erfCu1IUF66QJhW5JxpiTx160vZwWHjwdeykm33vOmGFr1avSRCBPDYlZS ....

It's working fine for this API:

https://api.linkedin.com/v2/me

I get the proper response.

But once I used the same thing in another API, like

https://api.linkedin.com/v2/shares?q=ownersowners=urn:li:organization:82091933&sortBy=1&sharesPerOwner=100

I get this error response:

{
    "serviceErrorCode": 100,
    "message": "Not enough permissions to access: GET-owners /shares",
    "status": 403
}

How to find the Listing of all posts of my company page?

What are the right endpoints and API for this?

Upvotes: 0

Views: 1392

Answers (1)

  • First did you grant all permission before getting the Bearer token?
  • Second to get posts of an organization try this endpoint

POST https://api.linkedin.com/v2/posts?author={author}&isDsc=false&q=author&count=10

{author} = You need the organization id, and the max count is 100
Don't forget to add 'X-Restli-Protocol-Version: 2.0.0' at the header

Please check this link for more details LINKEDIN DOCS.

Upvotes: 0

Related Questions