在Microsoft Power Automate自定义连接器中实现Autodesk APS上传遇阻求助
在Power Automate中调用Autodesk Data Management API上传文件至签名S3 URL的问题
我正在Microsoft Power Automate中创建自定义连接器,对接Autodesk的Data Management API,但卡在了文档中的步骤5——直接上传至签名S3 URL。
我已在Postman中验证其余流程均可正常运行;也通过shell脚本的curl命令测试了步骤5,确认签名URL生成正常且上传能顺利完成。
我尝试了两种在Power Automate中执行上传的方式:
方法1:使用HTTP操作
传入签名URL,请求方法为PUT,请求体放入文件内容,操作的代码视图如下:
{ "type": "Http", "inputs": { "uri": "[REDACTED SIGNED URL]", "method": "PUT", "body": "@body('Get_file_content')" }, "runAfter": { "Upload_file_to_S3_signed_URL": [ "Succeeded" ] }, "runtimeConfiguration": { "contentTransfer": { "transferMode": "Chunked" } } }
执行后出现错误:
InvalidProtocolResponse
The response to partial content upload initiating request is not valid. The response to initiating partial content upload request must contain a valid location header.
方法2:构建专用自定义连接器
因S3上传的主机名与其他Autodesk API不同,我构建了专用自定义连接器,其swagger JSON如下:
swagger: '2.0' info: title: APS S3 Signed URL Uploader description: Direct upload to S3 signed URL generated by the Data Management API. version: '1.0' host: com-autodesk-oss-direct-upload.s3-accelerate.amazonaws.com basePath: / schemes: - https consumes: - application/octet-stream produces: - application/json paths: /upload: put: summary: Upload file to S3 signed URL operationId: UploadToURL parameters: - name: signedURL in: query required: true type: string description: Signed URL generated by the Data Management API. - name: fileContent in: body required: true schema: type: string format: binary description: Binary file content to upload. responses: '200': description: Upload successful schema: type: object properties: message: type: string example: File uploaded successfully. '400': description: Bad Request '500': description: Internal Server Error securityDefinitions: {}
此方式返回403错误,响应体如下:
<?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>V48YVK8JA62E8GX3</RequestId><HostId>z6CEun8FVfqQEB1ostuWqeWJUeEMtd9L0c4X5NsS70akh7sMSL6S3uC/I53IikjDD6waL5MjM/0=</HostId></Error>
我并非专业开发人员,若有明显疏漏还请见谅,恳请提供解决方向。
内容的提问来源于stack exchange,提问作者Zulphide
相关产品推荐
相关产品推荐

