Posts and Comments
We provide many routes to list posts of a user or a company, retrieve comments on those posts, retrieve who liked a post, like a post or a comment, or comment a post directly. You can also use search to find posts with specific keywords and filters.
LinkedIn uses multiple IDs for the same post. It is important to use the social_id of the post on all action and interaction calls to be 100% reliable. You can get it from the list of posts of a user, or, if you only have the URL of a post, take the post ID from the URL, use the retrieve-post route with that ID, and take social_id from the result to list or add any comment or reaction.
Example from URL
For the following post URL that contains activity before the ID: https://www.linkedin.com/posts/postpress_nocode-automation-solopreneurs-activity-7332661864792854528-hcGT.
You need to retrieve the ID part in the URL 7332661864792854528 to perform a retrieve-post request.
For URLs that contain ugcPost (linkedin.com/posts/xxx-ugcPost-7336013677930006817-6jfq) use this format: urn:li:ugcPost:7336013677930006817.
For URLs that contain share (linkedin.com/posts/xxx-share-7336013677930006817-6jfq) use this format: urn:li:share:7336013677930006817.
curl --request GET \
--url 'https://api.postpress.ai/api/v1/posts/7332661864792854528/?account_id=7ioiu6zHRO67yQBazvXDuQ' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}'In the result you need to use "social_id": "urn:li:activity:7332661864792854528" to add or list a comment or reaction. Example: post a comment on this post.
curl --request POST \
--url 'https://api.postpress.ai/api/v1/posts/urn:li:activity:7332661864792854528/comments' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}' \
--data '{
"account_id": "7ioiu6zHRO67yQBazvXDuQ",
"text": "Hey"
}'Mentions & thread comment
You can reply to a specific comment using the comment_id parameter and use mentions with this syntax.
Please note: to insert a line break in your text, use \n.
curl --request POST \
--url 'https://api.postpress.ai/api/v1/posts/urn:li:activity:7332661864792854528/comments' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}' \
--data '{
"account_id": "7ioiu6zHRO67yQBazvXDuQ",
"text": "Hi {{0}}, thanks",
"comment_id": "7335000001439513601",
"mentions": [
{
"name": "John Doe",
"profile_id": "ACoAASss4UBzQV9fDt_ziQ45zzpCVnAhxbW"
}
]
}'Available actions on posts
- Create a post -
POST /posts - Add reaction -
POST /posts/{social_id}/reactions - Comment a post -
POST /posts/{social_id}/comments - List reactions -
GET /posts/{social_id}/reactions - List comments -
GET /posts/{social_id}/comments - List all posts of a user or a company -
GET /users/{identifier}/posts - Retrieve a post -
GET /posts/{id}