Create Message¶
Create common messages and alert message on the Application Portal.
Request Format¶
POST https://{apigw-address}/app-portal-service/v2.1/message/produce
Request Parameters (Body)¶
Name |
Required or Not |
Data Type |
Description |
---|---|---|---|
messages |
true |
MessageProduceDTO struct |
Message details |
MessageProduceDTO Struct¶
Name |
Required or Not |
Data Type |
Description |
---|---|---|---|
messageId |
true |
String |
Message ID |
type |
false |
int |
Message type: 0: common message, 1: alert message |
orgId |
true |
String |
Organization ID |
accessKey |
true |
String |
Service account of the application. The application authenticates with |
body |
false |
I18nString |
Internationalized message. For the structure, see Internationalized name struct |
color |
false |
int |
Color of indicating the message severity |
ring |
false |
int |
Ringtone for the message |
tags |
false |
I18nString |
Internationalized tags for the message. Only display the first 3 tags. For the structure, see Internationalized name struct |
produceTime |
true |
String |
Produce time of the message in UTC. Format: “yyyy-MM-dd HH:mm:ss” |
zoneOffset |
true |
String |
Time zone, such as “+08:00” |
linkedAppId |
false |
String |
The application ID associated with the alert message. ( |
linkedMenuCode |
false |
String |
The menu identifier within the application that is associated with the message |
linkedStates |
false |
String |
URL state associated with the message |
feature |
false |
I18nString |
Internationalized description by the customer. For the structure, see Internationalized name struct |
assetId |
false |
String |
The ID of the asset associated with the alert message. If the alert message is not related to the asset, no need to provided. |
authUnitId |
true |
String |
The asset tagged as “auth_unit:true” in the asset tree of the EnOS Cloud. It 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. For example, there are several solar panels under a solar power station. Each solar panel has its own asset ID: assetId1, assetId2, and so on. The asset tree of this solar power station on the EnOS Cloud was tagged with “auth_unit:true”. When the solar power station informaton is successfully synchronized to the Application Portal (authUnitId is valid), if an organization has an application represented by the appId, the users who can view the solar power station in the Application Portal can receive the corresponding alert message. In this example, assetId is the ID of a solar panel and authUnitId is the solar power station ID. |
callbackUrl |
true |
String |
The complete URL of the Application Portal callback (supporting URL Encode) after clicking the corresponding button of |
actionName |
true |
I18nString |
Internationalized text on the customized button in the message window. 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. For the structure, see Internationalized name struct |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
data struct |
null |
Sample¶
Request Sample¶
POST
https://{apigw-address}/app-portal-service/v2.1/message/produce
{
"messages": [
{
"zoneOffset": "+08:00",
"linkedMenuCode": "menucode",
"linkedAppId": "accessKey",
"color": 1,
"ring": 1,
"messageId": "yunfan01",
"produceTime": "24/7/2019 11:22:01",
"body": {
"default": "This is a test3335",
"en_US": "This is a test3335",
"zh_CN": "这是个测试233335"
},
"type": 1,
"tags": [
{
"default": "Severe",
"en_US": "Severe",
"zh_CN": "严重"
},
{
"default": "Performance Alarm",
"en_US": "Performance Alarm",
"zh_CN": "性能告警"
},
{
"default": "Inverter",
"en_US": "Inverter",
"zh_CN": "逆变器"
}
],
"orgId": "yourOrgId",
"createdAt": "24/7/2019 10:11:18",
"authUnitId": "7Uq6uP77",
"deletedAt": "1/1/1970 00:00:00",
"feature": {
"default": "This is a feature test3343",
"en_US": "This is a feature test3343",
"zh_CN": "这是个特征测试1"
},
"assetId": "7Uq6uP77",
"accessKey": "yourAccessKey",
"state": 0,
"linkedStates": "states",
"updatedAt": "24/7/2019 10:11:18",
"callbackUrl":"https://{app-service-address}/app-portal/test/v1/callback?appId=3b7aac51-8d3a-4e4f-a16d-7fe297a316e6&messageId=messagett0q22w1299",
"actionName":
{
"en_US":"ACK",
"zh_CN":"确认"
}
}
]
}
Return Sample¶
{
"code": 200,
"message": "",
"data": null
}