Network Update Social Actions
Warning
Deprecation Notice
The Marketing Version 202308 (Marketing August 2023) and earlier versions (excluding 202306 and 202307) have been sunset. Additionally, the unversioned APIs will be sunset soon. We recommend that you migrate to the versioned APIs as well as migrate to the new Content and Community Management APIs to avoid disruptions. See the Migration page for more details.
If you haven’t yet migrated and have questions, submit a request on the LinkedIn Developer Support Portal.
Some shares may have social actions such as likes or comments attached to them. The socialActions
API enables you to create and read likes and comments on shares.
Permissions
Permission | Description |
---|---|
w_organization_social | Post, comment and like posts on behalf of an organization. Restricted to organizations in which the authenticated member has one of the following company page roles.
|
r_organization_social | Retrieve organizations' posts, comments, and likes. Restricted to organizations in which the authenticated member has one of the following company page roles.
|
w_member_social | Post, comment and like posts on behalf of an authenticated member. |
r_member_social | Restricted Retrieve posts, comments, and likes on behalf of an authenticated member. This permission is granted to select developers only. |
r_compliance | Retrieve posts, comments, and likes on behalf of an authenticated member for compliance monitoring and archiving. This is a private permission and access is granted to select developers. |
w_compliance | Manage and delete data on behalf of an authenticated member for compliance requirements. This is a private permission and access is granted to select developers. |
Access to Social Actions APIs
Deprecation/Note: Today, all the Social Actions APIs identified are part of the permissions shown in the above table. We plan to deprecate these APIs from these permissions in June 2023.
Every Community Management developer must perform the following:
- Request Development tier access to the new API through developer.linkedin.com and then upgrade to the Standard Tier.
- Update the existing OAuth access token permissions scope to include the new permissions above. This will warrant a new consent text to be shown to your member, and a re-auth process.
APIs | Old Permission Name | New Permission Name | Deprecation Date |
---|---|---|---|
/reactions /socialActions/comments /socialActions/likes /socialMetadata | r_organization_social | r_organization_social_feed | June 2023 |
/reactions /socialActions/comments /socialActions/likes /socialMetadata | w_organization_social | w_organization_social_feed | June 2023 |
/reactions /socialActions/comments /socialActions/likes /socialMetadata | w_member_social | w_member_social_feed | June 2023 |
See Organization Access Control for more information on company page roles.
Note
You may never store profile information, other than person URNs retrieved from the shares
API.
Social Action Types
The socialActions
API allows access to both personal and organization social actions. The type of URN specified in the actor
field of a social action indicates the type:
URN Type | Social Action Type | Description |
---|---|---|
urn:li:person |
Personal | Social action was created by a member. The member is displayed as the publisher. |
urn:li:organization urn:li:organizationBrand |
Organization | Social action was created by a member on behalf of an organizational entity. The organization or brand is displayed as the publisher. |
Retrieve Social Actions
Retrieve a Summary of Social Actions
Sample Request Example
Sample Response
{
"likesSummary": {
"selectedLikes": [],
"aggregatedTotalLikes": 0,
"likedByCurrentUser": false,
"totalLikes": 0
},
"commentsSummary": {
"selectedComments": [],
"totalFirstLevelComments": 0,
"commentsState": "OPEN",
"aggregatedTotalComments": 0
},
"target": "urn:li:ugcPost:7096760097833439232"
}
{
"commentsSummary": {
"totalFirstLevelComments": 4,
"aggregatedTotalComments": 9
},
"$URN": "urn:li:activity:6296748651834277888",
"likesSummary": {
"aggregatedTotalLikes": 226
"likedByCurrentUser": false,
"totalLikes": 226
}
}
Note
Shares without likes or comments do not show likesSummary
or commentsSummary
respectively. A share without any social action activity returns an empty JSON response.
Batch_GET Summary of Social Actions
Sample Request
GET https://api.linkedin.com/rest/socialActions?ids=List({shareUrn1|ugcPostUrn1|commentUrn1}, {shareUrn2|ugcPostUrn2|commentUrn2},..)
Sample Request Example
Sample Response
{
"results": {
"urn:li:ugcPost:7096754084929548288": {
"likesSummary": {
"selectedLikes": [],
"aggregatedTotalLikes": 0,
"likedByCurrentUser": false,
"totalLikes": 0
},
"commentsSummary": {
"selectedComments": [],
"totalFirstLevelComments": 0,
"commentsState": "OPEN",
"aggregatedTotalComments": 0
},
"target": "urn:li:ugcPost:7096754084929548288"
},
"urn:li:ugcPost:7096760097833439232": {
"likesSummary": {
"selectedLikes": [],
"aggregatedTotalLikes": 0,
"likedByCurrentUser": false,
"totalLikes": 0
},
"commentsSummary": {
"selectedComments": [],
"totalFirstLevelComments": 0,
"commentsState": "OPEN",
"aggregatedTotalComments": 0
},
"target": "urn:li:ugcPost:7096760097833439232"
}
},
"statuses": {},
"errors": {}
}```
{
"statuses": {},
"results": {
"urn:li:share:6297772917862207488": {
"commentsSummary": {
"totalFirstLevelComments": 9,
"aggregatedTotalComments": 11
},
"$URN": "urn:li:activity:6297772917849616384",
"likesSummary": {
"likedByCurrentUser": false,
"totalLikes": 287
},
"target": "urn:li:activity:6297772917849616384"
},
"urn:li:share:6296748651846864896": {
"commentsSummary": {
"totalFirstLevelComments": 4,
"aggregatedTotalComments": 9
},
"$URN": "urn:li:activity:6296748651834277888",
"likesSummary": {
"likedByCurrentUser": false,
"totalLikes": 226
},
"target": "urn:li:activity:6296748651834277888"
}
},
"errors": {}
}
Retrieve Likes on Shares
Sample Request
Sample Request Example
Sample Response
{
"paging": {
"start": 0,
"count": 10,
"links": [],
"total": 1
},
"elements": [
{
"actor": "urn:li:organization:79988552",
"agent": "urn:li:person:_74NULPy7d",
"lastModified": {
"actor": "urn:li:organization:79988552",
"impersonator": "urn:li:person:_74NULPy7d",
"time": 1693481466739
},
"id": "urn:li:like:(urn:li:organization:79988552,urn:li:ugcPost:7096760097833439232)",
"created": {
"actor": "urn:li:organization:79988552",
"impersonator": "urn:li:person:_74NULPy7d",
"time": 1693481466739
},
"object": "urn:li:ugcPost:7096760097833439232"
}
]
}```
{
"elements": [
{
"actor": "urn:li:person:ub1n1QYzp_",
"created": {
"actor": "urn:li:person:ub1n1QYzp_",
"time": 1501914549125
},
"lastModified": {
"actor": "urn:li:person:ub1n1QYzp_",
"time": 1501914549125
},
"$URN": "urn:li:like:(urn:li:person:ub1n1QYzp_,urn:li:activity:6297772917849616384)",
"object": "urn:li:activity:6297772917849616384"
}
],
"paging": {
"total": 287,
"count": 10,
"start": 0,
"links": [
{
"rel": "next",
"href": "/v2/socialActions/urn:li:activity:6297772917849616384/likes?count=10&start=10",
"type": "application/json"
}
]
}
}
Note
To prevent timeouts, set the page count
to less than 600 when you fetch likes.
Retrieve Comments on Shares
Sample Request
If your request exceeds the maximum length requirement, please utilize query tunneling:
curl -X POST 'https://api.linkedin.com/rest/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
--data 'projection=(...)'
Sample Request Example
If your request exceeds the maximum length requirement, please utilize query tunneling:
curl -X POST 'https://api.linkedin.com/v2/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted'
--data 'projection=(...)'
Sample Response
{
"paging": {
"start": 0,
"count": 10,
"links": [],
"total": 1
},
"elements": [
{
"actor": "urn:li:organization:79988552",
"commentsSummary": {
"selectedComments": [
"urn:li:comment:(urn:li:ugcPost:7096760097833439232,7102979086045638657)"
],
"totalFirstLevelComments": 1,
"commentsState": "OPEN",
"aggregatedTotalComments": 1
},
"agent": "urn:li:person:_74NULPy7d",
"commentUrn": "urn:li:comment:(urn:li:ugcPost:7096760097833439232,7102976128625123328)",
"created": {
"actor": "urn:li:organization:79988552",
"impersonator": "urn:li:person:_74NULPy7d",
"time": 1693481475980
},
"id": "7102976128625123328",
"lastModified": {
"actor": "urn:li:organization:79988552",
"impersonator": "urn:li:person:_74NULPy7d",
"time": 1693481475980
},
"message": {
"attributes": [],
"text": "Test comment"
},
"object": "urn:li:ugcPost:7096760097833439232"
}
]
}
{
"elements":[
{
"actor":"urn:li:person:A8xe03Qt10",
"created":{
"actor":"urn:li:person:A8xe03Qt10",
"time":1582160678569
},
"id":"6636062862760562688",
"lastModified":{
"actor":"urn:li:person:A8xe03Qt10",
"time":1582160678569
},
"message":{
"attributes":[
],
"text":"Comment with comment-image media"
},
"$URN":"urn:li:comment:(urn:li:activity:6631349431612559360,6636062862760562688)",
"content":[
{
"type":"IMAGE",
"entity":{
"digitalmediaAsset":"urn:li:digitalmediaAsset:C552CAQGu16obsGZENQ"
},
"url":"https://media.licdn-ei.com/dms/image/C552CAQGu16obsGZENQ/comment-image-shrink_8192_800/ 0?e=1584576000&v=beta&t=RkJykQ1pLG-3I5ojq0TGWR7NbHq76XPcRkb_HZDx4iE"
}
],
"object":"urn:li:activity:6631349431612559360"
}
]
}
If a top level comment has nested comments, the commentsSummary.selectedComments
array provides a preview of the two most recent nested comments.
Note
We recommend:
Retrieve Comments on Comments
To resolve nested comments for a given parent comment, provide a parent commentUrn
as the target in the request URL. A commentUrn
is a composite URN constructed using a comment ID and activityUrn
.
Sample Request
GET https://api.linkedin.com/rest/socialActions/urn:li:comment:(urn:li:activity:6273189577469632512,6275822846992351232)/comments
If your request exceeds the maximum length requirement, please utilize query tunneling:
curl -X POST 'https://api.linkedin.com/rest/socialActions/urn:li:comment:(urn:li:activity:6273189577469632512,6275822846992351232)/comments \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
'LinkedIn-Version: {version number in the format YYYYMM}
Sample Request Example
GET https://api.linkedin.com/v2/socialActions/urn:li:comment:(urn:li:activity:6273189577469632512,6275822846992351232)/comments
If your request exceeds the maximum length requirement, please utilize query tunneling:
curl -X POST 'https://api.linkedin.com/v2/socialActions/urn:li:comment:(urn:li:activity:6273189577469632512,6275822846992351232)/comments \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
--data 'projection=(...)'
Sample Response
{
"elements":[
{
"actor":"urn:li:person:f49f2kf0",
"commentUrn":"urn:li:comment:(urn:li:activity:6273189577469632512,6636062862760562688)",
"created":{
"actor":"urn:li:person:f49f2kf0",
"time":1582160678569
},
"id":"6636062862760562688",
"lastModified":{
"actor":"urn:li:person:f49f2kf0",
"time":1582160678569
},
"message":{
"attributes":[],
"text":"Comment with comment-image media"
},
"content":[
{
"type":"IMAGE",
"entity":{
"image":"urn:li:image:C552CAQGu16obsGZENQ"
},
"url":"https://media.licdn-ei.com/dms/image/C552CAQGu16obsGZENQ/comment-image-shrink_8192_800/0?e=1584576000&v=beta&t=RkJykQ1pLG-3I5ojq0TGWR7NbHq76XPcRkb_HZDx4iE"
}
],
"likesSummary": {
"aggregatedTotalLikes": 1,
"selectedLikes": [
"urn:li:like:(urn:li:person:f49f2kf0,urn:li:comment:(urn:li:activity:6273189577469632512,6636062862760562688))"
],
"likedByCurrentUser": true,
"totalLikes": 1
},
"object":"urn:li:activity:6273189577469632512",
"parentComment":"urn:li:comment:(urn:li:activity:6273189577469632512,6275822846992351232)"
}
]
}
{
"elements":[
{
"actor":"urn:li:person:f49f2kf0",
"created":{
"actor":"urn:li:person:f49f2kf0",
"time":1582160678569
},
"id":"6636062862760562688",
"lastModified":{
"actor":"urn:li:person:f49f2kf0",
"time":1582160678569
},
"message":{
"attributes":[
],
"text":"Comment with comment-image media"
},
"$URN":"urn:li:comment:(urn:li:activity:6273189577469632512,6636062862760562688)",
"content":[
{
"type":"IMAGE",
"entity":{
"digitalmediaAsset":"urn:li:digitalmediaAsset:C552CAQGu16obsGZENQ"
},
"url":"https://media.licdn-ei.com/dms/image/C552CAQGu16obsGZENQ/comment-image-shrink_8192_800/0?e=1584576000&v=beta&t=RkJykQ1pLG-3I5ojq0TGWR7NbHq76XPcRkb_HZDx4iE"
}
],
"object":"urn:li:activity:6273189577469632512",
"parentComment":"urn:li:comment:(urn:li:activity:6273189577469632512,6275822846992351232)"
}
]
}
Get a Comment
GET https://api.linkedin.com/rest/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments/{commentId}
Sample Request Example
Sample Response
{
"actor": "urn:li:organization:79988552",
"commentsSummary": {
"selectedComments": [
"urn:li:comment:(urn:li:ugcPost:7096760097833439232,7102979086045638657)"
],
"totalFirstLevelComments": 1,
"commentsState": "OPEN",
"aggregatedTotalComments": 1
},
"agent": "urn:li:person:_74NULPy7d",
"commentUrn": "urn:li:comment:(urn:li:ugcPost:7096760097833439232,7102976128625123328)",
"created": {
"actor": "urn:li:organization:79988552",
"impersonator": "urn:li:person:_74NULPy7d",
"time": 1693481475980
},
"id": "7102976128625123328",
"lastModified": {
"actor": "urn:li:organization:79988552",
"impersonator": "urn:li:person:_74NULPy7d",
"time": 1693481475980
},
"message": {
"attributes": [],
"text": "Test comment"
},
"object": "urn:li:ugcPost:7096760097833439232"
}
{
"actor":"urn:li:person:f49f2kf0",
"created":{
"actor":"urn:li:person:f49f2kf0",
"time":1582160678569
},
"id":"6636062862760562688",
"lastModified":{
"actor":"urn:li:person:f49f2kf0",
"time":1582160678569
},
"parentComment": "urn:li:comment:(urn:li:activity:6631349431612559360,6850752781414875136)",
"message":{
"attributes":[
],
"text":"Comment with comment-image media"
},
"$URN":"urn:li:comment:(urn:li:activity:6631349431612559360,6636062862760562688)",
"content":[
{
"type":"IMAGE",
"entity":{
"digitalmediaAsset":"urn:li:digitalmediaAsset:C552CAQGu16obsGZENQ"
},
"url":"https://media.licdn-ei.com/dms/image/C552CAQGu16obsGZENQ/comment-image-shrink_8192_800/0?e=1584576000&v=beta&t=RkJykQ1pLG-3I5ojq0TGWR7NbHq76XPcRkb_HZDx4iE"
}
],
"object":"urn:li:activity:6631349431612559360"
}
Batch Get Comments
Sample Response
{
"statuses": {},
"results": {
"7061795051579785216": {
"actor": "urn:li:person:A8xe03Qt10",
"commentsSummary": {
"totalFirstLevelComments": 1,
"selectedComments": [
"urn:li:comment:(urn:li:activity:7061794973381181553,7061795094571401216)"
],
"commentsState": "OPEN",
"aggregatedTotalComments": 1
},
"commentUrn": "urn:li:comment:(urn:li:activity:7061794973381181553,7061795051579785216)",
"created": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1683663142106
},
"lastModified": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1683663142106
},
"id": "7061795051579785216",
"message": {
"attributes": [],
"text": "Comment 2"
},
"likesSummary": {
"aggregatedTotalLikes": 1,
"selectedLikes": [
"urn:li:like:(urn:li:person:A8xe03Qt10,urn:li:comment:(urn:li:activity:7061794973381181553,7061795051579785216))"
],
"likedByCurrentUser": false,
"totalLikes": 1
},
"object": "urn:li:activity:7061794973381181553"
},
"7061795017773699072": {
"actor": "urn:li:person:A8xe03Qt10",
"commentUrn": "urn:li:comment:(urn:li:activity:7061794973381181553,7061795017773699072)",
"created": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1683663134046
},
"lastModified": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1683663134046
},
"id": "7061795017773699072",
"message": {
"attributes": [],
"text": "Comment 1"
},
"likesSummary": {
"aggregatedTotalLikes": 1,
"selectedLikes": [
"urn:li:like:(urn:li:person:A8xe03Qt10,urn:li:comment:(urn:li:activity:7061794973381181553,7061795017773699072))"
],
"likedByCurrentUser": false,
"totalLikes": 1
},
"object": "urn:li:activity:7061794973381181553"
}
},
"errors": {}
}
{
"statuses": {},
"results": {
"6851102243672899584": {
"reactionType": "EMPATHY",
"created": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1555543895726
},
"root": "urn:li:activity:6516117581072519168",
"lastModified": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1555543895726
},
"$URN": "urn:li:reaction:(urn:li:person:A8xe03Qt10,urn:li:activity:6516117581072519168)"
},
"6851102243672899584": {
"reactionType": "EMPATHY",
"created": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1554942909426
},
"root": "urn:li:lyndaCourse:56301",
"lastModified": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1554942909426
},
"$URN": "urn:li:reaction:(urn:li:person:A8xe03Qt10,urn:li:lyndaCourse:56301)"
}
},
"errors": {}
}
Retrieve Commenters' Profile Information
Using Response Decoration, the profile name and picture of commenters can be retrieved. This profile information may never be stored.
Sample Request
GET https://api.linkedin.com/v2/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments?projection=(elements(*(*,actor~(*,profilePicture(displayImage~:playableStreams)))))
If your request exceeds the maximum length requirement, please utilize query tunneling:
curl -X POST 'https://api.linkedin.com/v2/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
--data 'projection=(elements(*(*,actor~(*,profilePicture(displayImage~:playableStreams)))))'
Common Retrieval Errors
The table below lists commonly encountered errors retrieving social actions. It is not meant to be a comprehensive list of all possible social action retrieval errors.
Code | Message | Description |
---|---|---|
400 | Invalid query parameters passed to request | Occurs when using Restli 2.0 and the query parameters are not encoded properly. See Protocol Version for more on Restli 2.0 encoding. Calls with Postman and some other HTTP clients can trigger this error. Try using curl or another client when testing. |
400 | Syntax exception in path variables | Indicates an invalid URN was requested. Try again with a share or ugcPost URN. |
Retrieve Commenters' Profile Information
Using Response Decoration, the profile name and picture of commenters can be retrieved. This profile information may never be stored.
Sample Response
{
"elements": [
{
"actor~": {
"localizedLastName": "Tester",
"lastName": {
"localized": {
"en_US": "Tester"
},
"preferredLocale": {
"country": "US",
"language": "en"
}
},
"vanityName": "test-person",
"localizedHeadline": "Test Profile at Acme Corp",
"profilePicture": {
"displayImage": "urn:li:digitalmediaAsset:C5603AQEuebSM6NP8wq",
"displayImage~": {
"paging": {
"count": 10,
"start": 0,
"links": []
},
"elements": [
{
"artifact": "urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C5603AQEuebSM6NP8wq,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_800_800)",
"authorizationMethod": "PUBLIC",
"data": {
"com.linkedin.digitalmedia.mediaartifact.StillImage": {
"mediaType": "image/jpeg",
"rawCodecSpec": {
"name": "jpeg",
"type": "image"
},
"displaySize": {
"width": 800.0,
"uom": "PX",
"height": 800.0
},
"storageSize": {
"width": 800,
"height": 800
},
"storageAspectRatio": {
"widthAspect": 1.0,
"heightAspect": 1.0,
"formatted": "1.00:1.00"
},
"displayAspectRatio": {
"widthAspect": 1.0,
"heightAspect": 1.0,
"formatted": "1.00:1.00"
}
}
},
"identifiers": [
{
"identifier": "https://example.com/image.jpg",
"index": 0,
"mediaType": "image/jpeg",
"file": "urn:li:digitalmediaFile:(urn:li:digitalmediaAsset:C5603AQEuebSM6NP8wq,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_800_800,0)",
"identifierType": "EXTERNAL_URL",
"identifierExpiresInSeconds": 1609372800
}
]
}
]
}
},
"firstName": {
"localized": {
"en_US": "Tester"
},
"preferredLocale": {
"country": "US",
"language": "en"
}
},
"id": "j8924gj82",
"headline": {
"localized": {
"en_US": "Test Profile at Acme Corp"
},
"preferredLocale": {
"country": "US",
"language": "en"
}
},
"localizedFirstName": "Tester"
},
"created": {
"actor": "urn:li:person:j8924gj82",
"time": 1603870852695
},
"message": {
"attributes": [],
"text": "Test Comment!"
},
"actor": "urn:li:person:j8924gj82",
"commentsSummary": {
"totalFirstLevelComments": 1,
"selectedComments": [
"urn:li:comment:(urn:li:activity:1234,567)"
],
"aggregatedTotalComments": 1
},
"id": "789",
"lastModified": {
"actor": "urn:li:person:j8924gj82",
"time": 1603870852695
},
"$URN": "urn:li:comment:(urn:li:activity:1234,789)",
"likesSummary": {
"selectedLikes": [
"urn:li:like:(urn:li:person:j8924gj82,urn:li:comment:(urn:li:activity:1234,789))"
],
"likedByCurrentUser": false,
"aggregatedTotalLikes": 1,
"totalLikes": 1
},
"object": "urn:li:activity:1234"
}
]
}
Create and Delete Social Actions
Create Comment
Request Body Fields
Field | Description | Format | Required |
---|---|---|---|
actor | Entity which authored the comment | organization URN or person URN | Yes |
message | Text of the comment. May contain attributes such as links to people and organizations. | Text | Yes |
content | The content of the comment, such as an image. | List of ContentEntity | No |
parentComment | For nested comments, this is the urn of the parent comment. This is not available for first-level comments. | Composite URN | No |
Use the object
field in the request body to specify the share or the ugcPost which contains the comment. Specify the share or the ugcPost in the request URL, and represent it as an URN.
Use the ID returned in the response header to take further action on the newly created comment. The following response body also contains a comment URN which can be used as parent comment for creating nested comments.
Sample Request
POST https://api.linkedin.com/rest/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments
{
"actor":"urn:li:organization:5637409",
"object":"urn:li:activity:6631349431612559360",
"message":{
"text":"commentV2 with image entity"
},
"content":[
{
"entity":{
"image":"urn:li:image:C552CAQGu16obsGZENQ"
}
}
]
}
Sample Request Example
POST https://api.linkedin.com/rest/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments
{
"actor":"urn:li:organization:5637409",
"object":"urn:li:activity:6631349431612559360",
"message":{
"text":"commentV2 with image entity"
},
"content":[
{
"entity":{
"digitalmediaAsset":"urn:li:digitalmediaAsset:C552CAQGu16obsGZENQ"
}
}
]
}
POST https://api.linkedin.com/v2/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments
{
"actor":"urn:li:organization:5637409",
"object":"urn:li:activity:6631349431612559360",
"message":{
"text":"commentV2 with image entity"
},
"content":[
{
"entity":{
"digitalmediaAsset":"urn:li:digitalmediaAsset:C552CAQGu16obsGZENQ"
}
}
]
}
Sample Response Header
X-restli-id : 7102986562019213313
Sample Response Body
{
"actor": "urn:li:organization:79988552",
"agent": "urn:li:person:_74NULPy7d",
"commentUrn": "urn:li:comment:(urn:li:ugcPost:7096760097833439232,7102986562019213313)",
"created": {
"actor": "urn:li:organization:79988552",
"impersonator": "urn:li:person:_74NULPy7d",
"time": 1693483963495
},
"id": "7102986562019213313",
"lastModified": {
"actor": "urn:li:organization:79988552",
"impersonator": "urn:li:person:_74NULPy7d",
"time": 1693483963495
},
"message": {
"attributes": [],
"text": "commentV2 with image entity"
},
"likesSummary": {
"selectedLikes": [],
"aggregatedTotalLikes": 0,
"likedByCurrentUser": false,
"totalLikes": 0
},
"object": "urn:li:ugcPost:7096760097833439232"
}
{
"actor": "urn:li:organization:5637409",
"agent": "urn:li:person:CnpTkB7V70",
"created": {
"actor": "urn:li:organization:5637409",
"impersonator": "urn:li:person:CnpTkB7V70",
"time": 1583863835990
},
"id": "6643206422739898368",
"lastModified": {
"actor": "urn:li:organization:5637409",
"impersonator": "urn:li:person:CnpTkB7V70",
"time": 1583863835990
},
"message": {
"attributes": [],
"text": "commentV2 with image urn"
},
"$URN": "urn:li:comment:(urn:li:activity:6641861161010679808,6643206422739898368)",
"content": [
{
"type": "IMAGE",
"url": "https://media.licdn-ei.com/dms/image/C552CAQGu16obsGZENQ/comment-image-shrink_8192_800/0?e=1585180800&v=beta&t=d8E35ZP3x0_Lrk0utXbn3YPw9_5ybihj2AWXWb8xHdc",
"entity": {
"digitalmediaAsset": "urn:li:digitalmediaAsset:C552CAQGu16obsGZENQ"
}
}
],
"object": "urn:li:activity:6641861161010679808"
}
Common Creation Errors
The table below lists commonly encountered errors creating comments. It is not meant to be a comprehensive list of all possible comment creation errors.
Code | Message | Description |
---|---|---|
403 | Unpermitted fields present in REQUEST_BODY: Data Processing Exception while processing fields [/content] | Occurs when attempting to include an image in an inline comment which is not currently not supported by the API. |
429 | Comment create throttled: creation rate limit exceeded for member | Indicates member has hit the short term 1 minute rate limit for common creation. |
Delete Comment from Share
Query Parameters
Field | Description | Format | Required |
---|---|---|---|
actor | Entity deleting the comment | organization URN | Only when deleting comment as an organization |
Sample Request
DELETE https://api.linkedin.com/rest/socialActions/{shareUrn|ugcPostUrn}/comments/{comment ID}
Sample Request Example
Additional Comment Features
Create a Comment on a Comment
To create a nested comment, add a parentComment
field to your request body. The value is a composite URN, which is comprised of the activityUrn
and parent comment ID.
Sample Request
POST https://api.linkedin.com/rest/socialActions/urn:li:comment:(urn:li:activity:6305471423192264704,6308007194273021952)/comments
{
"actor": "urn:li:organization:2414183",
"message": {
"text": "Dunder Mifflin's Dundie Award goes to Dwight Schrute!"
},
"object": "urn:li:share:6305471423242596352",
"parentComment": "urn:li:comment:(urn:li:activity:6305471423192264704,6308007194273021952)"
}
POST https://api.linkedin.com/v2/socialActions/urn:li:comment:(urn:li:activity:6305471423192264704,6308007194273021952)/comments
{
"actor": "urn:li:organization:2414183",
"message": {
"text": "Dunder Mifflin's Dundie Award goes to Dwight Schrute!"
},
"object": "urn:li:share:6305471423242596352",
"parentComment": "urn:li:comment:(urn:li:activity:6305471423192264704,6308007194273021952)"
}
Comment Mentioning
Comment text may contain attributes, which are links to other LinkedIn entities such as people or organizations. Mentioning requires knowledge of the URN for the referenced entity. You must also specify the part of the comment text that should be rendered as a link to the entity.
Schema
Field | Description | Format | Required |
---|---|---|---|
length | The length of the annotation link | integer | yes |
start | The starting character index beginning the annotation link | integer | yes |
value | An object that includes the URN of the organization or member you want to mention in the comment. | URN | no |
Sample Request Body
{
"actor": "urn:li:organization:2414183",
"message": {
"attributes": [
{
"length": 17,
"start": 0,
"value": {
"organization": {
"organization": "urn:li:organization:2414183"
}
}
},
{
"length": 14,
"start": 38,
"value": {
"person": {
"person": "urn:li:person:uOeeiwWoxO"
}
}
}
],
"text": "Dunder Mifflin's Dundie Award goes to Dwight Schrute!"
},
"object": "urn:li:share:6305471423242596352"
}
{
"actor": "urn:li:organization:2414183",
"message": {
"attributes": [
{
"length": 17,
"start": 0,
"value": {
"com.linkedin.adsexternalapi.social.OrganizationAttributedEntity": {
"company": "urn:li:organization:2414183"
}
}
},
{
"length": 14,
"start": 38,
"value": {
"com.linkedin.adsexternalapi.social.PersonAttributedEntity": {
"member": "urn:li:person:uOeeiwWoxO"
}
}
}
],
"text": "Dunder Mifflin's Dundie Award goes to Dwight Schrute!"
},
"object": "urn:li:share:6305471423242596352"
}
Comments with Images
An entity
field is now part of the content
field in a comment, replacing the url
field. When creating a comment with an image, specify the image as an image
URN within the entity
field instead of the URL field. This ImageUrn is obtained when uploading an image to the Vector API (if an Urn like urn:li:digitalMediaAsset:ABC123
is returned then use urn:li:image:ABC123
). Learn more.
An entity
field is now part of the content
field in a comment, replacing the url
field. When creating a comment with an image, specify the image as a digitalmediaAsset
URN (obtained when uploading an image to the Vector API) within the entity
field instead of the URL field. Learn more.
Schema
Field | Description | Format | Required |
---|---|---|---|
entity | The Digitalmedia Asset URN of the image you want to include in the comment. | URN | yes |
type | The type of the content, in this case, use "IMAGE". (This is a read-only field and should not be provided for comment creates.) | string | yes |
url | The URL of the content. (This is a read-only field and should not be provided for comment creates.) | URL | no |
Sample Request Body
{
"actor":"urn:li:person:f49f2kf0",
"object":"urn:li:activity:6631349431612559360",
"message":{
"text":"commentV2 with image entity"
},
"content":[
{
"entity":{
"image":"urn:li:image:C552CAQGu16obsGZENQ"
}
}
]
}
{
"actor":"urn:li:person:f49f2kf0",
"object":"urn:li:activity:6631349431612559360",
"message":{
"text":"commentV2 with image entity"
},
"content":[
{
"entity":{
"digitalmediaAsset":"urn:li:digitalmediaAsset:C552CAQGu16obsGZENQ"
}
}
]
}
Create a Like on a Share
Sample Request
Use the object
field in the request body to specify the URN of the entity to which the like belongs. This object should be a sub-entity of the top-level share indicated in the request URL, and should be represented as a URN of format urn:li:share:{id}
.
The actor
field in the request body is used to specify the entity performing the action. It should be represented by a urn:li:person:{id}
or urn:li:organization:{id}
URN.
Sample Response
{
"id": "urn:li:like:(urn:li:person:0XV6h162Ub,urn:li:activity:6280442346165280768)",
"actor": "urn:li:person:0XV6h162Ub",
"agent": "urn:li:person:0XV6h162Ub",
"created": {
"actor": "urn:li:person:0XV6h162Ub",
"time": 1497380688598
},
"lastModified": {
"actor": "urn:li:person:0XV6h162Ub",
"time": 1497380688598
},
"object": "urn:li:activity:6280442346165280768"
}
{
"$URN": "urn:li:like:(urn:li:person:0XV6h162Ub,urn:li:activity:6280442346165280768)",
"actor": "urn:li:person:0XV6h162Ub",
"agent": "urn:li:person:0XV6h162Ub",
"created": {
"actor": "urn:li:person:0XV6h162Ub",
"time": 1497380688598
},
"lastModified": {
"actor": "urn:li:person:0XV6h162Ub",
"time": 1497380688598
},
"object": "urn:li:activity:6280442346165280768"
}
Create a Like on a Comment
Likes can be created on comments by using the comment URN as the target key in the request URL. Similar to liking a share, the object value should be set to the top level share URN.
Sample Request
Delete a Like
Sample Request
Query Parameters
Field | Description | Format | Required |
---|---|---|---|
actor | Entity deleting the like. Must supply the entity that created the like. | organization URN or person URN | Yes |