Generates the URL information that is used to upload firmware file to Object Storage Service (OSS).

Notes

This operation is used with other operations to create firmware. To create firmware, follow these steps:

  1. Call this operation to generate the information for uploading the firmware file to OSS.

    The response parameters of this operation include:

    • The request parameters that are required to call the PostObject operation of OSS for uploading a firmware file, such as Key, OSSAccessKeyId, Signature, and Policy.
    • The FirmwareUrl parameter that is required when you call the CreateOTAFirmware operation to create a firmware.
  2. Use the OSS SDK to call the PostObject operation to upload a firmware file within one minute after this operation returns the response.
    Note
    • The parameter information returned by this operation is valid for one minute. You must upload the firmware file within one minute.
    • The size of the firmware file is at most 1,000 MB.
  3. After the firmware file is uploaded, call the CreateOTAFirmware operation of IoT Platform within 60 minutes to create a firmware.

    If the firmware file is uploaded but you do not call the CreateOTAFirmware operation to create the firmware, the uploaded file is automatically deleted by the system.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to GenerateOTAUploadURL.
IotInstanceId String No The ID of your IoT Platform instance. This parameter is not required for public instances. However, the parameter is required for the instances that you have purchased.
Common request parameters N/A Yes For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Description
RequestId String The globally unique ID that is generated by Alibaba Cloud for the request.
Success Boolean Indicates whether the call is successful. true indicates that the call was successful. false indicates that the call failed.
ErrorMessage String The error message returned if the call fails.
Code String The error code returned if the call fails. For more information about error codes, see Error codes.
Data Data The information for uploading the firmware file to OSS that is returned when the call is successful. For more information, see the Data table.
Table 1. Data
Parameter Type Description
Key String The key of the uploaded firmware file. The key includes the complete path of the OSS object. You can use the name to call the PostObject operation of OSS.

Example: ota/65dfcda0473be29836dfde585472****/ck2nfzljo00023g7kysg0****.bin.

Host String The domain name of the OSS bucket, for example, https://iotx-ota.oss-cn-shanghai.aliyuncs.com.
Policy String The parameter that is used by OSS to verify form fields for the request.
OSSAccessKeyId String The AccessKey ID of the bucket owner.

This OSS bucket stores the firmware file.

Signature String The signature that is calculated based on AccessKeySecret and Policy. When you call an OSS operation, OSS uses the signature information to verify the POST request.
FirmwareUrl String The URL of the firmware file stored in OSS. After the firmware file is uploaded, you can use this parameter to call the CreateOTAFirmware operation and create the firmware.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=GenerateOTAUploadURL
&Common request parameters

Sample success responses

  • JSON format
    {
      "Data": {
        "Key": "ota/65dfcda0473be29836dfde585472****/ck2nfzljo00023g7kysg0****.bin",
        "Host": "https://iotx-ota.oss-cn-shanghai.aliyuncs.com",
        "Policy": "eyJleHBpcmF****",
        "OSSAccessKeyId": "cS8uRRy54Rsz****",
        "Signature": "v6lViO4FBvfquajQjg20K5hK****",
        "FirmwareUrl: "https://iotx-ota.oss-cn-shanghai.aliyuncs.com/ota/65dfcda0473be29836dfde585472****/ck2nfzljo00023g7kysg0****.bin"
    
      },
      "RequestId": "74C2BB8D-1D6F-41F5-AE68-6B2310883F63",
      "Success": true
    }
  • XML format
    <? xml version="1.0" encoding="utf-8"? >
    <GenerateOTAUploadURLResponse>
      <Data>
        <Key>ota/65dfcda0473be29836dfde585472****/ck2nfzljo00023g7kysg0****.bin</Key>
        <Host>https://iotx-ota.oss-cn-shanghai.aliyuncs.com</Host>
        <Policy>eyJleHBpcmF****</Policy>
        <OSSAccessKeyId>****</OSSAccessKeyId>
        <Signature>cS8uRRy54Rsz****</Signature>
        <FirmwareUrl>https://iotx-ota.oss-cn-shanghai.aliyuncs.com/ota/65dfcda0473be29836dfde585472****/ck2nfzljo00023g7kysg0****.bin</FirmwareUrl>
      </Data>
      <RequestId>B6E77674-09C4-4647-BF85-59CB72A72E4B</RequestId>
      <Success>true</Success>
    </GenerateOTAUploadURLResponse>

Next step: Upload a firmware file

After you call this operation and obtain the upload information, you use the OSS SDK to call the PostObject operation to upload the firmware file. For more information, see the following OSS topics:

OSS SDK Overview

PostObject