LinkedIn Share API 返回 400 错误 - “不支持所有者实体类型人员”

问题描述

我正在使用以下正文访问 LinkedIn Share API 端点。无法弄清楚这个错误的确切原因是什么,文档中也没有提到这一点。

发布请求:

{
    "content": {
        "contentEntities": [
            {
                "entityLocation": "https://www.sample.com","thumbnails": [
                    {
                        "resolvedUrl": "https://www.sample.com"
                    }
                ]
            }
        ],"title": "Test Share with Content"
    },"distribution": {
        "linkedindistributionTarget": {}
    },"owner": "urn:li:person:_EELFb0y","subject": "Test Share Subject","text": {
        "text": "Test Share!"
    }
}

回复

{
    "message": "Owner entity type person is not supported","status": 400
}

对此有什么帮助吗?

解决方法

[官方 LinkedIn API 文档]

在 v2 API 中,LinkedIn 使用“作者”,而不是“所有者”

{
"author": "urn:li:person:8675309","lifecycleState": "PUBLISHED","specificContent": {
    "com.linkedin.ugc.ShareContent": {
        "shareCommentary": {
            "text": "Hello World! This is my first Share on LinkedIn!"
        },"shareMediaCategory": "NONE"
    }
},"visibility": {
    "com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}

}

这可能是 status=400 的原因