"Invalid content entity type!" 发布到 Linkedin 时 v2/shares

"Invalid content entity type!" when posting to Linkedin v2/shares

遵循此文档:https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/rich-media-shares 上传图像以在 LinkedIn 的组织共享中引用。

使用 Assets API 成功上传图像。 URN 采用这种格式 - urn:li:digitalmediaAsset:XXX

Retrieving asset information 使用 digitalmediaAsset URN 中的资产 ID 显示以下状态:

{
    "serviceRelationships": [
        {
            "identifier": "urn:li:userGeneratedContent",
            "relationshipType": "OWNER"
        }
    ],
    "recipes": [
        {
            "recipe": "urn:li:digitalmediaRecipe:feedshare-image",
            "status": "AVAILABLE"
        }
    ],
    "mediaTypeFamily": "STILLIMAGE",
    "created": 1579015000150,
    "lastModified": 1579015039823,
    "id": "XXX",
    "status": "ALLOWED"
}

但是当我写分享时using Assets URN -

POST https://api.linkedin.com/v2/shares

{
    "content": {
        "contentEntities": [
            {
                "entity": "urn:li:digitalmediaAsset:XXX"
            }
        ],
        "description": "content description",
        "title": "Test Share with Content"
    },
    "distribution": {
        "linkedInDistributionTarget": {}
    },
    "subject": "Test Share Subject",
    "text": {
        "text": "Test Share!"
    },
    "owner":"urn:li:organization:YYY"
}

我收到以下错误:

{"message":"Invalid content entity type!","status":400}

知道我做错了什么吗?

在此处添加 shareMediaCategory 字段,如下所示:

POST https://api.linkedin.com/v2/shares

{
    "content": {
        "contentEntities": [
            {
                "entity": "urn:li:digitalmediaAsset:XXX"
            }
        ],
        "description": "content description",
        "title": "Test Share with Content",
        "shareMediaCategory": "IMAGE"
    },
    "distribution": {
        "linkedInDistributionTarget": {}
    },
    "subject": "Test Share Subject",
    "text": {
        "text": "Test Share!"
    },
    "owner":"urn:li:organization:YYY"
}

详见文档:https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/share-api#using-images-for-shares