Use Case
As an authorized LinkedIn user
I want to post articles via the LinkedIn API
So my external services can create content on behalf of me
Description
I want to post (not share) an article on LinkedIn via the LinkedIn API v2.
So far, I have succeeded with sharing text, images, and article-URLs. However, creating an article (Publishing Article), I don't fully understand how to do this.
There is the Article API, but that API has only methods for retrieving published articles. In the documentation, the UGC Post API is referenced as the publishing mechanism.
In the documentation of the UGC Post API, I can only find documentation for sharing text, images, and article-URLs. I'm missing out completely on the article creation.
The manual way for posting such articles on the LinkedIn-website is to go to LinkedIn Publishing at https://www.linkedin.com/post/new and create the content via a visual editor.
Publishing is however not available for all users. If it's available for one user is a decision - probably automated - made by LinkedIn. This is stated in the documentation here.
Publishing isn’t currently available to all members and access to publishing isn’t determined or affected by your account type. Both free and premium accounts can have publishing access. Having a premium account doesn’t guarantee publishing access.
Questions
- Is it even possible to post an article with the LinkedIn API v2?
- How can I post an article via the LinkedIn API v2?
- Are there any additional permissions needed other than the ones specified for the UGC Post API (w_member_social)?
Existing Failing Requests
// request
{
method: 'POST',
headers: {
Authorization: `Bearer ${accessToken}`,
'X-Restli-Protocol-Version': '2.0.0'
},
uri: `${LINKEDIN_API_URL}/v2/ugcPosts`,
json: true,
body: {
author: `urn:li:person:${linkedinUserId}`,
lifecycleState: 'PUBLISHED',
specificContent: {
'com.linkedin.ugc.ShareContent': {
shareCommentary: {
text: `<strong>Let's hope this is possible</strong><br/>it would be bad if not<br/>said by me at ${new Date()}`
},
shareMediaCategory: 'URN_REFERENCE'
}
},
visibility: {
'com.linkedin.ugc.MemberNetworkVisibility': 'PUBLIC'
}
}
}
// response
{
statusCode: 500,
body: {
message: 'INTERNAL SERVER ERROR',
status: 500
}
}