如何通过Linkedin API上传视频?上载资产时出现SignatureDoesNotMatch错误

时间:2019-08-20 11:47:37

标签: video upload postman linkedin linkedin-api

https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/vector-asset-api#register-an-upload

根据linkedin文档,上传视频有3个步骤。

  1. 注册上传请求。

我能够成功注册上传请求。

响应:

guard let firstCell = app.cells.allElementsBoundByIndex.first, let topButton = firstCell.buttons.allElementsBoundByIndex.last else { XCTFail("no reoder btn for first cell"); return }
guard let bottomCell = app.cells.allElementsBoundByIndex.last, let bottomButton = bottomCell.buttons.allElementsBoundByIndex.last else { XCTFail("no reoder btn for last cell"); return }
topButton.press(forDuration: 0.5, thenDragTo: bottomButton)
  1. 上传资产

我正在使用以下卷曲请求上载资产

{
    "value": {
        "uploadMechanism": {
            "com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest": {
                "headers": {
                    "x-amz-server-side-encryption-aws-kms-key-id": "xxxx-xxxx-xxxx",
                    "x-amz-server-side-encryption": "aws:kms",
                    "Content-Type": "application/octet-stream"
                },
                "uploadUrl": "https://video-uploads-prod.s3-accelerate.amazonaws.com/KEY1/aws-userUploadedVideo?X-Amz-Algorithm=[ALGORITHM]&X-Amz-SignedHeaders=content-type%3Bhost%3Bx-amz-server-side-encryption%3Bx-amz-server-side-encryption-aws-kms-key-id&X-Amz-Expires=86400&X-Amz-Credential=[CREDENTIAL]&X-Amz-Signature=[SIGNATURE]"
            }
        },
        "mediaArtifact": "[ARTIFACT]",
        "asset": "[ASSET]"
    }
}

但是获得响应并禁止错误403

curl -X POST \
  'https://video-uploads-prod.s3-accelerate.amazonaws.com/KEY1/aws-userUploadedVideo?X-Amz-Algorithm=[ALGORITHM]&X-Amz-SignedHeaders=content-type%3Bhost%3Bx-amz-server-side-encryption%3Bx-amz-server-side-encryption-aws-kms-key-id&X-Amz-Expires=86400&X-Amz-Credential=[CREDENTIAL]&X-Amz-Signature=[SIGNATURE]' \
  -H 'Content-Type: application/octet-stream' \
  -H 'x-amz-server-side-encryption: aws:kms' \
  -H 'x-amz-server-side-encryption-aws-kms-key-id: xxxx-xxxx-xxxx' \
  -F upload-file=@/Users/kaushik/Downloads/videoplayback.mp4

要成功在linkedin中上传视频,我该怎么做。

我发现了几年前当linkedin不支持视频时问过的同样问题。

1 个答案:

答案 0 :(得分:0)

可能使用错误的curl,与api无关。在终端上尝试同样的方法即可。