Search code examples
linkedin-api

Linkedin - Getting empty elements while retrieving company posts using ugcposts api


I need to retrieve latest 3 linkedin posts of my company display in my company's webpage.

I do have the following rights for my Bearer token.

openid profile email r_organization_social r_basicprofile r_organization_admin rw_organization_admin w_member_social

But my request:

https://api.linkedin.com/v2/ugcPosts?oauth2_access_token=*accessToken*&q=authors&authors=List(urn%3Ali%3Aorganization%3A*myOrganisationId*)&count=3

returns:

{ "paging": { "start": 0, "count": 3, "links": [ { "type": "application/json", "rel": "next", "href": "/v2/ugcPosts?q=authors&oauth2_access_token=accessToken&authors=List(urn%3Ali%3Aorganization%3AmyOrganisationId)&count=3" } ], "total": 96 }, "elements": [] }


Solution

  • You could get posts with this endpoint

    https://api.linkedin.com/rest/posts?author=urn:li:organization:(your company id)&isDsc=false&q=author&count=3

    But you're using an old endpoint. My example requires to add the version in the header.