Linkedin v2 vector asset upload error 400

妖精的绣舞 提交于 2021-01-29 05:06:45

问题


Hello everyone who suffering from Microsoft LI v2 migration.

I have issue with UGC with vector asset (image), it's based on https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/vector-asset-api#upload-the-asset

I have uploadUrl from the first query, and when i perform second query it gives me error 400. When i try to debug and cURL it (according to their example), the last log lines:

> 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

In the first query(registerUpload), I don't have desired headers from the first query:

-H "x-amz-server-side-encryption:aws:kms"
-H "x-amz-server-side-encryption-aws-kms-key-id:e10ace24-blah-4977-bar-89foo193e2ab"

Anyone had any luck with vector asset upload ?


回答1:


It was solved by adding 'Accept' => '*/*'(i experimented without it and it did not worked) and set request to multipart (ruby Faraday gem)




回答2:


The vector asset documentation you referenced is specific to uploading video content to LinkedIn. You can view image share documentation at https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin?context=linkedin/consumer/context#create-an-image-share

From the documentation, you can register your upload:

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"
        }
    ]
}

which returns the upload URL you can use to submit your image:

{
"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"
}

}



来源:https://stackoverflow.com/questions/56042957/linkedin-v2-vector-asset-upload-error-400

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!