You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用LinkedIn评论API提及用户时返回422错误求助

解决LinkedIn API评论提及用户的422错误

你的错误核心是请求体里的实体类型使用错误,com.linkedin.adsexternalapi.social.PersonAttributedEntity是广告相关API的实体,不属于评论接口允许的联合类型成员,所以被接口拒绝。

修正后的请求体

把实体类型替换为com.linkedin.common.PersonAttributedEntity,同时确保message.text里的片段和start、length精准对应(对应你要提及的用户名称):

{
    "actor": "urn:li:organization:{actorId}",
    "object": "urn:li:share:{shareId}",
    "message": {
        "attributes": [
            {
                "length": 9, // 替换为你要提及的用户名称长度(含@前缀,比如@JaneSmith是9字符)
                "start": 0,
                "value": {
                    "com.linkedin.common.PersonAttributedEntity": {
                        "person": "urn:li:person:{personId}"
                    }
                }
            }
        ],
        "text": "@JaneSmith test message!" // 开头是要提及的用户名称
    }
}

关键注意点

  • 必须使用com.linkedin.common.PersonAttributedEntity作为提及实体的类型,这是LinkedIn社区管理API(评论接口)认可的联合类型成员。
  • start和length要严格匹配text中对应提及用户的片段位置和长度,否则提及不会被正确解析。
  • 确认你的请求使用的API版本与文档一致(你参考的2023-08版本),不同版本的结构可能有差异。

内容的提问来源于stack exchange,提问作者Dmitry

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 17:03:10