Create Firmware File¶
Create a firmware file for a product.
Operation Permissions¶
| Required Authorization | Required Operation Permission | 
|---|---|
| Device Management | Full Access | 
Request Format¶
POST https://{apigw-address}/connect-service/v2.1/ota-firmwares?action=create
Request Parameters (URI)¶
| Name | Location(Path/Query) | Mandatory/Optional | Data Type | Description | 
|---|---|---|---|---|
| orgId | Query | Mandatory | String | The organization ID which the asset belongs to. How to get orgId>> | 
| productKey | Query | Mandatory | String | The product key. | 
Request Parameters (Body)¶
The format of the request body is multipart/form-data, which consists of two form-data sections:
- Firmware metadata form-data 
- Firmware file form-data 
| Name | Mandatory/Optional | Data Type | Description | 
|---|---|---|---|
| Content-Disposition | Mandatory | Content-Disposition: form-data; name=”metadata” | 
 | 
| Name | Mandatory/Optional | Data Type | Description | 
|---|---|---|---|
| name | Mandatory | StringI18n | The firmware name. For more details on the structure and locales supported, see Internationalized name struct>> | 
| version | Mandatory | String | The firmware version. | 
| signMethod | Mandatory | String | The signature algorithm for the firmware files, supports  | 
| sign | Mandatory | String | The fimware file signature. | 
| desc | Optional | String | The firmware description. | 
| enableVerification | Mandatory | Boolean | Specifies whether the firmware must be verified for upgrading tasks. 
 | 
| Name | Mandatory/Optional | Data Type | Description | 
|---|---|---|---|
| Content-Disposition | Mandatory | Content-Disposition: form-data; name=”file”; filename=”yourFileName” | 
 | 
Response Parameters¶
| Name | Data Type | Description | 
|---|---|---|
| data | FirmwareCreateResult Struct | The created firmware ID. For details, see FirmwareCreateResult Struct>> | 
FirmwareCreateResult Struct 
| Name | Data Type | Description | 
|---|---|---|
| firmwareId | String | The created firmware ID. | 
Error Codes¶
| Code | Message | Description | 
|---|---|---|
| 24601 | Firmware version already exists | A firmware with this version already exists. | 
| 24602 | Firmware name already exists | A firmware with this name already exists. | 
| 24603 | Not allowed to create firmware concurrently | Firmware cannot be created concurrently. | 
Samples¶
Request Sample¶
url: https://{apigw-address}/connect-service/v2.1/ota-firmwares?action=create&orgId=yourOrgId&productKey=yourProductKey
method: POST
requestBody:
  Firmware metadata form-data:
    Header:
    Content-Disposition: form-data; name="metadata"
    Body:
    {
    "name": {
        "defaultValue": "testDefaultValue"
    },
    "version": "yourVersion",
    "signMethod": "md5",
    "sign": "7eb565583c040b76b7466af1ecb553f3",
    "enableVerification": false,
    "desc": "ota firmware"
    }
Return Sample¶
{
    "code": 0,
    "msg": "OK",
    "requestId": "9bba8197-d6d6-4fe2-a3d2-65153ab6376c",
    "data": {
        "firmwareId": "5ee0edb729b990001b9acf9a"
    }
}