Update Product


Update a product.

Operation Permissions

Required Authorization Required Operation Permission
Device Management Full Access

Request Format

POST https://{apigw-address}/connect-service/v2.1/products?action=update

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)

Name Mandatory/Optional Data Type Description
productDesc Optional String The product description.
biDirectionalAuth Optional Boolean
  • true: supports two-way authentication
  • false (default): does not support two-way authentication
dynamicActivateEnabled Optional Boolean
  • true: able to activate dynamically
  • false (default): not able to activate dynamically
productName Optional StringI18n The product name. If not given, the name will not be changed. For more details on the structure and locales supported, see Internationalized name struct.
productTags Optional Map The tags of the product. For details, see How to use tags.
defaultValidDay Optional Integer This parameter is used when a device under this product applies for a certificate. When the device applies for a certificate but does not specify the validity period, this parameter will be used as the certificate validity period. The range is 1 to 3650, and the default value is 730.
maxValidDay Optional Integer The maximum certificate validity period of a device when a device under this product applies for a certificate. If the validity period is exceeded, an error will be reported and the certificate application will fail. The range is 1 to 3650, and the default value is 1095.

Response Parameters

Name Data Type Description
data String The key of the updated product.

Samples

Request Sample

url: https://{apigw-address}/connect-service/v2.1/products?action=update&orgId=yourOrgId&productKey=yourProductKey
method: POST
requestBody:
{
    "productDesc":"test_sdk_update",
    "biDirectionalAuth":true,
    "dynamicActivateEnabled":true,
    "productName": {
        "defaultValue":"AlterTest0615_Product",
        "i18nValue":{}
    }
}

Return Sample

{
    "code":0,
    "msg":"OK",
    "requestId":"522d0269-445d-4f13-be04-1424e0e2893e",
    "data":"2zp6A70r"
}

Java SDK Sample

package com.envisioniot.enos.api.sample.connect_service.product;

import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envisioniot.enos.api.common.constant.common.StringI18n;
import com.envisioniot.enos.connect_service.v2_1.product.UpdateProductRequset;
import com.envisioniot.enos.connect_service.v2_1.product.UpdateProductResponse;

public class UpdateProduct {

    public static void main(String[] args) {
        String appKey = "yourAppKey";
        String appSecret = "yourAppSecret";
        String serverUrl = "yourServerUrl";
        String orgId = "yourOrgId";
        UpdateProductRequset request = new UpdateProductRequset();
        request.setOrgId(orgId);
        request.setProductKey("yourProductKey");
        StringI18n productName = new StringI18n("yourProductName");
        request.setProductName(productName);
        request.setBiDirectionalAuth(true);
        request.setDynamicActivateEnabled(true);

        UpdateProductResponse response = Poseidon.config(PConfig.init().appKey(appKey).appSecret(appSecret).debug())
                .url(serverUrl)
                .getResponse(request, UpdateProductResponse.class);
    }
}