Get File Upload URL

Last Updated on : 2023-06-15 05:12:27

Get the file upload URL and upload the file according to the temporary URL returned by the API.

API address

GET: /v1.0/iot-03/app-contents/upload-file/infos

Request parameter

Parameter name Type IN Required Description
file_name String query true The file name.
file_size Long query true The file size in bytes.

Return parameter

Parameter name Type Description
result SecStorageSignRsp The information about file upload.

Description of result

Parameter name Type Description
token String The token.
upload_url String The URL of file upload.
headers List The information about a specified HTTP header.

Description of headers

Parameter name Type Description
key Object The key of a specified HTTP header. The value, if any, must be carried during file upload.
value Object The value of a specified HTTP header. The value, if any, must be carried during file upload.

Request example

GET: /v1.0/iot-03/app-contents/upload-file/infos?fileName=a.jpg&fileSize=10

Return example

{ "result": { "headers": [ { "value": "BlockBlob", "key": "x-ms-blob-type" } ], "token": "f0008b107a2426a025b538567dc4aa8d240eeedae6d8420f8e773ba2dea9d0e4", "upload_url": "https://tuya-temp-fileupload-daily-1254153901.cos.ap-shanghai.myqcloud.com/iot-platform-tmp/bsh1618231457224vDlX/16305516165c837c2a150.jpg?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKID85RK8j3CFNI7i7pEuSkPp26xZvA9jPgp%26q-sign-time%3D1630551616%3B1630555216%26q-key-time%3D1630551616%3B1630555216%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D523200a12afc017090b9d387c6413882adaa3d4d" }, "t": 1630551616762, "success": true }

Error code

For more information, see error code.