Query Messages

Last Updated on : 2022-01-24 10:16:30

Query the messages on pages.

API address

GET: /v1.0/sdf/notifications/messages

Request parameter

Parameter nameTypeINRequiredDescription
recipient_idStringquerytrueThe ID of a specified recipient.
message_typeStringqueryfalseThe message type. Valid values:
  • 1: device message.
  • 3: system notification.
  • 4: service message.
Pass an empty value if you want to query all types of messages.
message_sub_typeStringqueryfalseThe message sub-type. Valid values:
  • 40: device alerts.
  • 41: device offline.
  • 50: user role change.
Pass an empty value if you want to query all sub-types of messages.
read_flagStringqueryfalseSpecifies whether a message is read. Valid values:
  • 0: It is unread.
  • 1: It is already read.
Pass an empty value if you want to query all read and unread messages.
page_noIntegerqueryfalseThe current page number.
page_sizeIntegerqueryfalseThe number of items returned on each page.

Return parameter

Parameter nameTypeDescription
resultPageResThe returned result.

Description of result

Parameter nameTypeDescription
totalIntegerThe total items.
listListThe list of data.
has_moreBooleanSpecifies whether to return the next page.

Description of list

Parameter nameTypeDescription
message_idStringThe message ID.
message_categoryStringThe message category.
message_category_descriptionStringThe description of a specified message category.
message_typeStringThe message type.
message_type_descriptionStringThe description of a specified message type.
message_sub_typeStringThe message sub-type.
message_titleStringThe title of a specified message.
message_contentStringThe content of a specified message.
create_timeStringThe time when it is created.
read_statusStringSpecifies whether a message is read. Valid values:
  • 1: It is already read.
  • 0: It is unread.

Request example

GET: /v1.0/sdf/notifications/messages?recipient_id=bay163****&message_type=1&message_sub_type=41&read_flag=0&page_no=1&page_size=10

Return example

{
    "result": {
        "list": [
            {
                "create_time": "2021-11-22 06:15",
                "message_title": "Device offline",
                "message_category": "PLATFORM",
                "read_status": "0",
                "message_id": "6162****",
                "message_type": "1",
                "message_type_description": "Device message",
                "message_content": "Real 00 (6c027****) is offline",
                "message_category_description": "Platform",
                "message_sub_type": "41"
            },
            {
                "create_time": "2021-11-21 21:03",
                "message_title": "Device offline",
                "message_category": "PLATFORM",
                "read_status": "0",
                "message_id": "6110****",
                "message_type": "1",
                "message_type_description": "Device message",
                "message_content": "The aroma diffuser (33071012****) is offline",
                "message_category_description": "Platform",
                "message_sub_type": "41"
            }
        ],
        "total": 2,
        "has_more": true
    },
    "t": 1637564235282,
    "success": true
}

Error code

For more information, see error code.