Create Message¶
Create common messages and alert messages on the Application Portal.
Prerequisites¶
The associated application has been purchased by the organization.
If this message is an alert about an asset, the asset or the parent node of the asset must have a tag value with “auth_unit: true”.
Request Format¶
POST https://{apigw-address}/app-portal-service/v2.2/message/produce
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
messages |
Mandatory |
MessageProduceDTO Struct |
The message details. |
MessageProduceDTO Struct¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
messageId |
Mandatory |
String |
The message ID. |
type |
Optional |
Integer |
The message type.
|
orgId |
Mandatory |
String |
The organization ID which the asset belongs to. How to get orgId >> |
accessKey |
Mandatory |
String |
The service account of the application. The application authenticates with |
body |
Optional |
I18nString |
Specify the message in its respective locale’s language. You must specify at least the |
color |
Optional |
Integer |
The color to indicate the message severity. How to get message icon color>> |
ring |
Optional |
Integer |
The ringtone for the message. How to get message ringtones>> |
tags |
Optional |
Map |
Specify the tags in its respective locale’s language. Note: only the first 3 tags will be displayed. You must specify at least the |
produceTime |
Mandatory |
String |
The time the message is produced. Format: “yyyy-MM-dd HH:mm:ss” |
state |
Optional |
Integer |
The state of the message.
|
zoneOffset |
Mandatory |
String |
The timezone, such as “+08:00”. |
linkedAppId |
Optional |
String |
The application ID associated with the alert message. ( |
linkedMenuCode |
Optional |
String |
The menu identifier within the application that is associated with the message. ( |
linkedStates |
Optional |
String |
URL state associated with the message. ( |
feature |
Optional |
I18nString |
Specify the description by the customer in its respective locale’s language. You must specify at least the |
assetId |
Optional |
String |
The ID of the asset associated with the alert message. If the alert message is not related to an asset, there is no need to provide this. |
authUnitId |
Mandatory |
String |
The asset tagged as “auth_unit:true” in the asset tree of the EnOS. The value can either be “assetId” or the parent node of the “assetId”. It is the asset ID synchronized to the Application Portal to verify the permissions of an application.
|
callbackUrl |
Mandatory |
String |
The complete URL of the Application Portal callback (supporting URL Encode) after clicking the corresponding button of |
actionName |
Mandatory |
I18nString |
Specify the customized text on the button in the message window in its respective locale’s language. It is recommended to use two characters for Chinese and three characters for English, such as “确认” and “ACK”. If not provided, it will not be displayed. You must specify at least the |
Samples¶
Request Sample¶
url: https://{apigw-address}/app-portal-service/v2.2/message/produce
method: POST
requestBody:
{
"messages": [
{
"zoneOffset": "+08:00",
"linkedMenuCode": "menucode",
"linkedAppId": "accessKey",
"color": 1,
"ring": 1,
"messageId": "yunfan01",
"produceTime": "2019-07-24 11:22:01",
"body": {
"default": "This is a test3335",
"en_US": "This is a test3335",
"zh_CN": "这是个测试233335",
"ja_JP": "",
"es_ES": ""
},
"type": 1,
"tags": [
{
"default": "Severe",
"en_US": "Severe",
"zh_CN": "严重",
"ja_JP": "",
"es_ES": ""
},
{
"default": "Performance Alarm",
"en_US": "Performance Alarm",
"zh_CN": "性能告警",
"ja_JP": "",
"es_ES": ""
},
{
"default": "Inverter",
"en_US": "Inverter",
"zh_CN": "逆变器",
"ja_JP": "",
"es_ES": ""
}
],
"orgId": "yourOrgId",
"authUnitId": "7Uq6uP77",
"feature": {
"default": "This is a feature test3343",
"en_US": "This is a feature test3343",
"zh_CN": "这是个特征测试1",
"ja_JP": "",
"es_ES": ""
},
"assetId": "7Uq6uP77",
"accessKey": "yourAccessKey",
"state": 0,
"linkedStates": "states",
"callbackUrl":"https://{app-service-address}/app-portal/test/v1/callback?appId=accessKey&messageId=messagett0q22w1299",
"actionName":
{
"en_US":"ACK",
"zh_CN":"确认",
"ja_JP": "",
"es_ES": ""
}
}
]
}
Return Sample¶
{
"code": 0,
"message": "",
"data": true
}