I have implemented the LinkedIn Reshare API in my application, based on the official documentation. The API requires a specific input object, which includes a mandatory commentary key, as shown below:
{
"author": "urn:li:organization:5515715",
"commentary": "Sample reshare post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false,
"reshareContext": {
"parent": "urn:li:share:6957408550713184256"
}
}
In my application, I wish to reshare a post immediately without including any commentary. I’ve attempted to bypass the requirement by setting commentary = ''
, but it results in a new post with a caption instead. Is there an official method or workaround in the API to post without any commentary?
Unfortunately, the LinkedIn API mandates the commentary
field for reshares, so leaving it blank is not officially supported. A workaround is to provide a minimal non-descriptive value like a space or a period:
{
“author”: “urn:li:organization:5515715”,
“commentary”: “.”,
“visibility”: “PUBLIC”,
“distribution”: {
“feedDistribution”: “MAIN_FEED”,
“targetEntities”: ,
“thirdPartyDistributionChannels”:
},
“lifecycleState”: “PUBLISHED”,
“isReshareDisabledByAuthor”: false,
“reshareContext”: {
“parent”: “urn:li:share:6957408550713184256”
}
}
This will appear less intrusive on the feed.
In situations like this, where an API imposes mandatory fields that you wish to leave out, it's essential to find a creative yet compliant approach. The suggestion you've mentioned of using a minimal placeholder character (such as a period or space) is a common workaround, but it comes with its own drawbacks in terms of user experience. Ideally, a period or single character might not be very noticeable, but it's not entirely invisible.
An alternative, albeit unofficial, approach you might consider is to work with LinkedIn's API and potentially communicate feedback through their developer forums or support channels. If many developers express the need for such a feature, LinkedIn might consider an update.
Meanwhile, as a temporary measure, using a non-intrusive character like "" (zero-width space) might make your reshare nearly indistinguishable from no commentary, depending on whether LinkedIn's system processes such invisible characters. Here's how you might include it in the payload:
{
“author”: “urn:li:organization:5515715”,
“commentary”: “”,
“visibility”: “PUBLIC”,
“distribution”: {
“feedDistribution”: “MAIN_FEED”,
“targetEntities”: ,
“thirdPartyDistributionChannels”:
},
“lifecycleState”: “PUBLISHED”,
“isReshareDisabledByAuthor”: false,
“reshareContext”: {
“parent”: “urn:li:share:6957408550713184256”
}
}
Implementing this approach should be tested thoroughly to ensure compliance with LinkedIn's API guidelines, and remember that it might not be foolproof and could change if LinkedIn updates its API behavior. Keep exploring the documentation and community resources for the latest developments.
To reshare LinkedIn posts using the API without adding noticeable commentary, you'll need to work within the constraints of LinkedIn's API which requires the commentary field. As a practical workaround, you can use a zero-width space character. Here's how your JSON object might look:
{
“author”: “urn:li:organization:5515715”,
“commentary”: “\u200B”,
“visibility”: “PUBLIC”,
“distribution”: {
“feedDistribution”: “MAIN_FEED”,
“targetEntities”: ,
“thirdPartyDistributionChannels”:
},
“lifecycleState”: “PUBLISHED”,
“isReshareDisabledByAuthor”: false,
“reshareContext”: {
“parent”: “urn:li:share:6957408550713184256”
}
}
This will minimize the appearance of the commentary on the feed. Be sure to test this thoroughly to ensure it meets your needs and adheres to LinkedIn's API policies. By keeping the placeholder invisible, you can maintain a cleaner look in your applications. For long-term solutions, consider providing feedback to LinkedIn for possible feature updates.