如何通过 Linkedin API 上传视频?上传资产时出现 SignatureDoesNotMatch 错误
How to upload a video through Linkedin API? Getting SignatureDoesNotMatch Error while uploading the asset
根据 linkedin 文档上传视频有 3 个步骤。
- 注册上传请求。
我能够成功注册上传请求。
回复:
{
"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]"
}
}
- 上传资产
我正在使用以下 curl 请求上传资产
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
但是收到错误 403 Forbidden 的响应
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
我应该怎么做才能在linkedin中成功上传视频。
我发现了几年前当 linkedin 不支持视频时被问到的相同问题。
可能是curl用错了,与api无关。在终端中尝试相同的方法它会起作用。
根据 linkedin 文档上传视频有 3 个步骤。
- 注册上传请求。
我能够成功注册上传请求。
回复:
{
"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]"
}
}
- 上传资产
我正在使用以下 curl 请求上传资产
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
但是收到错误 403 Forbidden 的响应
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
我应该怎么做才能在linkedin中成功上传视频。
我发现了几年前当 linkedin 不支持视频时被问到的相同问题。
可能是curl用错了,与api无关。在终端中尝试相同的方法它会起作用。