gpt4 book ai didi

linkedin - 错误请求 : Attempting to associate a ugc with an asset that's not owned by the author

转载 作者:行者123 更新时间:2023-12-03 09:40:04 26 4
gpt4 key购买 nike

我正在尝试将我的应用程序从 LinkedIn API v1 迁移到 v2。我目前正在考虑将图像(本地)共享到我的个人 LinkedIn 个人资料。

我正在关注这里的官方文档:https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin#create-an-image-share

为了注册图像,我发出了以下 POST 请求: to https://api.linkedin.com/v2/assets?action=registerUpload

{
"registerUploadRequest": {
"recipes": [
"urn:li:digitalmediaRecipe:feedshare-image"
],
"owner": "urn:li:person:9PyfTxBTFY",
"serviceRelationships": [
{
"relationshipType": "OWNER",
"identifier": "urn:li:userGeneratedContent"
}
]
}

}

我得到了成功的回应:
{
"value": {
"uploadMechanism": {
"com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest": {
"headers": {},
"uploadUrl": "https://api.linkedin.com/mediaUpload/C4D22AQEGOHxBzKUXvw/feedshare-uploadedImage/0?ca=vector_feedshare&cn=uploads&m=AQLhYJm0KOaTCgAAAWhSDplI-Lzlfh7lOsd8D5qBcz0aJ2bf1fwIfnh8ow&app=5212106&sync=0&v=beta&ut=0rKn179ebIA8A1"
}
},
"mediaArtifact": "urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C4D22AQEGOHxBzKUXvw,urn:li:digitalmediaMediaArtifactClass:feedshare-uploadedImage)",
"asset": "urn:li:digitalmediaAsset:C4D22AQEGOHxBzKUXvw"
}
}

我使用返回的uploadUrl成功上传了一个二进制图像:
curl -i --upload-file PATH_TO_FILE --header "Authorization: Bearer TOKEN" 'https://api.linkedin.com/mediaUpload/C4D22AQEGOHxBzKUXvw/feedshare-uploadedImage/0?ca=vector_feedshare&cn=uploads&m=AQLhYJm0KOaTCgAAAWhSDplI-Lzlfh7lOsd8D5qBcz0aJ2bf1fwIfnh8ow&app=5212106&sync=0&v=beta&ut=0rKn179ebIA8A1'

为了确认图像可以使用,我使用 GET https://api.linkedin.com/v2/assets/C4D22AQEGOHxBzKUXvw 检查了 Assets 的状态。哪个返回
{
"serviceRelationships": [
{
"identifier": "urn:li:userGeneratedContent",
"relationshipType": "OWNER"
}
],
"recipes": [
{
"recipe": "urn:li:digitalmediaRecipe:feedshare-image",
"status": "AVAILABLE"
}
],
"mediaTypeFamily": "STILLIMAGE",
"created": 1547564914979,
"lastModified": 1547564994321,
"id": "C4D22AQEGOHxBzKUXvw",
"status": "ALLOWED"
}

根据文档,我现在可以简单地引用 UGC 帖子中的 Assets URN。

这是我尝试使用 https://api.linkedin.com/v2/ugcPosts 分享的测试图片帖子端点
{
"author": "urn:li:person:9PyfTxBTFY",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "Testing LinkedIn image shares"
},
"shareMediaCategory": "IMAGE",
"media": [
{
"status": "READY",
"description": {
"text": "Some text"
},
"media": "urn:li:digitalmediaAsset:C4D22AQEGOHxBzKUXvw",
"title": {
"text": "Some title"
}
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}

但我不断收到错误消息:
{
"message": "Attempting to associate a ugc with an asset that's not owned by the author",
"status": 400
}

尝试共享状态更新或链接附件时,上述请求非常有效。

我还没有尝试过视频(类似的方法),因为我认为我会面临同样的问题。我也没有尝试过作为一个组织进行分享,因为我需要先被 LinkedIn 营销开发人员计划接受。

最佳答案

我可以确认这已由 LinkedIn 开发人员团队修复。按照与上面相同的步骤进行操作,只要经过身份验证的用户已授予 w_member_social 权限,它就应该可以正常工作。

在最后一个请求中,我现在得到 201 Created带有标题的响应 X-RestLi-Id包含指向新帖子的链接 urn:li:share:6494126499975700480 .

https://www.linkedin.com/feed/update/urn:li:share:6494126499975700480

附言如果您重新尝试旧的请求/已注册的上传,它将不起作用,因此请确保您使用新 Assets 进行尝试。我相信这个错误是在注册上传时。

关于linkedin - 错误请求 : Attempting to associate a ugc with an asset that's not owned by the author,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54201879/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com