大家好,那些遭受Microsoft LI v2迁移困扰的人。
我对带有矢量资产(图像)的教资会有疑问,它基于https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/vector-asset-api#upload-the-asset
我从第一个查询获得了uploadUrl,当我执行第二个查询时,它给了我错误400。 当我尝试调试并对其进行卷曲(according to their example)时,最后的日志行:
> Content-Length: 1636960
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
* We are completely uploaded and fine
* TLSv1.2 (IN), TLS alert, Client hello (1):
* Unexpected EOF
* Closing connection 0
curl: (56) Unexpected EOF
在第一个查询(registerUpload
)中,我没有从第一个查询获得的标题:
-H "x-amz-server-side-encryption:aws:kms"
-H "x-amz-server-side-encryption-aws-kms-key-id:e10ace24-blah-4977-bar-89foo193e2ab"
任何人都可以通过矢量资产上传吗?
答案 0 :(得分:1)
通过添加'Accept' => '*/*'
来解决(我尝试过不使用它,但它不起作用)并将请求设置为multipart
(红宝石Faraday
宝石)
答案 1 :(得分:0)
您参考的矢量资产文档特定于将视频内容上传到LinkedIn。您可以在https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin?context=linkedin/consumer/context#create-an-image-share
查看图像共享文档从文档中,您可以注册您的上传:
POST https://api.linkedin.com/v2/assets?action=registerUpload
{
"registerUploadRequest": {
"recipes": [
"urn:li:digitalmediaRecipe:feedshare-image"
],
"owner": "urn:li:person:8675309",
"serviceRelationships": [
{
"relationshipType": "OWNER",
"identifier": "urn:li:userGeneratedContent"
}
]
}
它返回您可以用来提交图像的上传URL:
{
"value": {
"uploadMechanism": {
"com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest": {
"headers": {},
"uploadUrl": "https://api.linkedin.com/mediaUpload/C5522AQGTYER3k3ByHQ/feedshare-uploadedImage/0?ca=vector_feedshare&cn=uploads&m=AQJbrN86Zm265gAAAWemyz2pxPSgONtBiZdchrgG872QltnfYjnMdb2j3A&app=1953784&sync=0&v=beta&ut=2H-IhpbfXrRow1"
}
},
"mediaArtifact": "urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C5522AQGTYER3k3ByHQ,urn:li:digitalmediaMediaArtifactClass:feedshare-uploadedImage)",
"asset": "urn:li:digitalmediaAsset:C5522AQGTYER3k3ByHQ"
}
}