V2.4 Get Product


Get the details of a product via its productKey.


This API is only available if 2.4 Cumulative Update 1 has been applied to your environment.

If you need to invoke this API after performing bulk updates to relevant products using other APIs, it is recommended to wait for about 2 seconds to avoid obtaining unupdated data.

Request Format

GET https://{apigw-address}/connect-service/v2.4/products?action=get

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.

requireSecret

Query

Optional

Boolean

  • true: productSecret and sessionKey will be returned. Ensure that:

    • Your service account has been granted with the required permission. If not, the returned value of productSecret and sessionKey will be an error.

    • The RSA key pair has been created for the service account. Creating RSA Key Pairs >>

  • false (default): productSecret and sessionKey will not be returned.

Response Parameters

Name

Data Type

Description

data

Product Struct

The details of the product. For more information, see Product Struct.

Product Struct

Name

Data Type

Description

orgId

String

The organization ID which the asset belongs to.

productKey

String

The product key.

productName

StringI18n

The product name.

productSecret

String

The product secret, returned only when the value of requireSecret is true. The returned value will be encrypted. How to Decrypt >>

sessionKey

String

The key for encrypting and decrypting the value of productSecret, returned only when the value of requireSecret is true. The returned value will be encrypted. How to Decrypt >>

productDesc

String

The product description.

productType

String

The product type. Device stands for common product types, while Gateway stands for gateway types.

dataFormat

String

  • Custom represents the user-defined data type.

  • Json represents the json data type.

productTags

Map

The product tags. (The Key and Value are of String type.)

protocolGatewayIds

String

The protocol gateway ID to which the asset is bound.

modelId

String

The model ID which the asset belongs to.

dynamicActiveEnabled

Boolean

  • true: able to activate dynamically

  • false: not able to activate dynamically

biDirectionalAuth

Boolean

  • true: supports two-way authentication

  • false: does not support two-way authentication

createTime

Long

The time the product is created.

createBy

String

The name of the person who created the product.

updateTime

Long

The time when the product was last updated. This will have the same value as createTime if there are no updates made after the product was created.

updateBy

String

The name of the person who updated the product.

defaultValidDay

Integer

Only applicable when biDirectionalAuth is true. This parameter is used when a device/gateway under this product applies for a certificate. When the device/gateway applies for a certificate but does not specify the validity period, this parameter will be used as the certificate validity period.

maxValidDay

Integer

Only applicable when biDirectionalAuth is true. The maximum certificate validity period of a device/gateway when a device/gateway under this product applies for a certificate.

Error Codes

Code

Message

Description

11404

Product cannot be found

The productKey does not exist.

11858

Unable to find public key

Unable to find public key for requireSecret due to there is no RSA key pair for the service account. Creating RSA Key Pairs >>.

Samples

Request Sample

url: https://{apigw-address}/connect-service/v2.4/products?action=get&orgId=yourOrgId&productKey=yourProductKey&requireSecret=true
method: GET

Return Sample

{
    "code":0,
    "msg":"OK",
    "requestId":"864291ce-ca48-457f-a790-a3415c0169ad",
    "data":{
        "orgId":"yourOrgId",
        "productKey":"yourProductKey",
        "productName":{
            "defaultValue":"202cp",
            "i18nValue":{
                "en_US":"",
                "zh_CN":""
            }
        },
        "productSecret"::"EncryptedProductSecret",
        "sessionKey":"EncryptedSessionKey",
        "productDesc":"",
        "productType":"Device",
        "dataFormat":"Json",
        "productTags":null,
        "protocolGatewayIds":null,
        "modelId":"202model",
        "dynamicActivateEnabled":false,
        "biDirectionalAuth":false,
        "createBy":"DM001",
        "createTime":1582861255508,
        "updateBy":"DM001",
        "updateTime":1582861255508,
        "defaultValidDay":null,
        "maxValidDay":null
    }
}

SDK Samples


You can access the SDK samples for Connection Service on GitHub: