V2.1 Create Product¶
Create a product.
This API is available in EnOS 2.1.0 and above.
Operation Permissions¶
Before invoking this API, ensure that the service account has been authorized the policy that includes the following service(s) and action permission(s). For how to authorize the service account, see Managing Service Accounts.
Required Service |
Required Operation Permission |
---|---|
Product |
Create |
Prerequisite¶
You have learnt the Limitations about products.
Request Format¶
POST https://{apigw-address}/connect-service/v2.1/products?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>> |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
productDesc |
Optional |
String |
The product description. |
biDirectionalAuth |
Mandatory |
Boolean |
|
modelId |
Mandatory |
String |
The model ID which the asset belongs to. How to get modelID>> |
dataFormat |
Mandatory |
String |
Supports only two values:
|
productName |
Mandatory |
StringI18n |
The product name. For more details on the structure and locales supported, see Internationalized name struct. |
productType |
Mandatory |
String |
Supports only two values:
|
dynamicActivateEnabled |
Optional |
Boolean |
|
productTags |
Optional |
Map |
The tags of the product. For details, see How to use tags. |
defaultValidDay |
Optional |
Integer |
Only applicable when |
maxValidDay |
Optional |
Integer |
Only applicable when |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
String |
The key of the created product. |
Error Codes¶
Code |
Message |
Description |
---|---|---|
99500 |
Query model failed |
The |
Samples¶
Request Sample¶
url: https://{apigw-address}/connect-service/v2.1/products?action=create&orgId=yourOrgId
method: POST
requestBody:
{
"productDesc":"openapi_sdk_create_test",
"biDirectionalAuth":false,
"modelId":"AlterTest0615",
"dataFormat":"Custom",
"productName":{
"defaultValue":"AlterTest0615_Product",
"i18nValue":{}
},
"productType":"Device",
"dynamicActivateEnabled":false,
"productTags": {
"key1": "v1"
}
}
Return Sample¶
{
"code":0,
"msg":"OK",
"requestId":"522d0269-445d-4f13-be04-1424e0e2893e",
"data":"2zp6A70r"
}
SDK Samples¶
You can access the SDK samples for Connection Service on GitHub: