Bu sayfa henüz yerel dilinizde mevcut değildir. Daha fazla dil seçeneği eklemek için yoğun bir şekilde çalışıyoruz. Desteğiniz için teşekkür ederiz.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Query a Message by Message ID

Updated on 2025-03-03 GMT+08:00

Function

This API is used by an application to query a message with a specified ID delivered by the platform to a device.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

GET /v5/iot/{project_id}/devices/{device_id}/messages/{message_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Parameter description: project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

device_id

Yes

String

Parameter description: ID of the device to which the message is delivered. The ID is unique and is allocated by the platform during device registration.

Value: The value can contain a maximum of 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

message_id

Yes

String

Parameter description: ID of the delivered message. The ID is unique and is allocated by the platform during message delivery.

Value: The value can contain a maximum of 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

Parameter description: user token. You can obtain the token by calling the IAM API Obtaining a User Token Through Password Authentication. In the returned response header, X-Subject-Token is the desired user token. For details about how to obtain the token, see Token Authentication.

Instance-Id

No

String

Parameter description: instance ID. Unique identifier of each instance in the physical multi-tenant scenario. Mandatory for professional editions and recommended in other cases. Log in to the IoTDA console and choose Overview in the navigation pane to view the instance ID. For details, see Viewing Instance Details.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

message_id

String

Device message ID, which is unique and is allocated by the platform during message delivery.

name

String

Message name specified during device message delivery.

message

Object

Message content.

encoding

String

Encoding format for the message content. Possible options are none and base64. The default value is none. base64 supports only transparent transmission.

payload_format

String

Valid payload format. This parameter is valid when encoding is none. Possible options are standard and raw. The default value is standard, indicating that the message content is encapsulated in the standard format. raw indicates that the message content is directly delivered.

topic

String

Message topic.

properties

PropertiesDTO object

Property parameter of the message delivered to the device.

status

String

Message status, including PENDING, DELIVERED, FAILED, and TIMEOUT. PENDING: The message is cached and delivered after the device goes online. DELIVERED: The message is sent successfully. FAILED: The message fails to be sent. TIMEOUT: If a message is not delivered to the device within the default period (one day), the platform sets the message status to TIMEOUT.

error_info

ErrorInfoDTO object

Message delivery error information, including error_code and error_msg. error_code includes IOTDA.014016 and IOTDA.014112. IOTDA.014016 indicates that the device is offline. IOTDA.014112 indicates that the device does not subscribe to any topic.

created_time

String

UTC time when the message was created. The value is in the format of yyyyMMdd'T'HHmmss'Z'.

finished_time

String

UTC time when the message was delivered to the device or timed out. The value is in the format of yyyyMMdd'T'HHmmss'Z'.

Table 4 PropertiesDTO

Parameter

Type

Description

correlation_data

String

Parameter description: data in the request and response modes of MQTT 5.0. This parameter is optional. You can use this parameter to configure data in the request and response modes of MQTT.

Value: The value can contain a maximum of 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

response_topic

String

Parameter description: response topic in the request and response modes of MQTT 5.0. This parameter is optional. You can use this parameter to configure the response topic in the request and response modes of MQTT.

Value: The value can contain a maximum of 128 characters. Only letters, digits, and special characters (_-?=$#+/) are allowed.

user_properties

Array of UserPropDTO objects

Parameter description: custom property. This parameter is optional. You can use this parameter to configure custom properties. A maximum of 20 customized attributes can be configured.

Table 5 UserPropDTO

Parameter

Type

Description

prop_key

String

Parameter description: key of the custom property.

Value: The value can contain a maximum of 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

prop_value

String

Parameter description: value of the custom property.

Value: The value can contain a maximum of 128 characters. Only letters, digits, underscores (_), and question marks (?) are allowed. '#().,& %@!-.

Table 6 ErrorInfoDTO

Parameter

Type

Description

error_code

String

Parameter description: error code, including IOTDA.014016 and IOTDA.014112. IOTDA.014016 indicates that the device is offline. IOTDA.014112 indicates that the device does not subscribe to any topic.

error_msg

String

** Parameter description**: error message. The device is offline or does not subscribe to any topic.

Example Requests

Queries details about a specified message.

GET https://{endpoint}/v5/iot/{project_id}/devices/{device_id}/messages/{message_id}

Example Responses

Status code: 200

OK

{
  "message_id" : "b1224afb-e9f0-4916-8220-b6bab568e888",
  "name" : "message_name",
  "message" : "string",
  "encoding" : "none",
  "payload_format" : "raw",
  "topic" : "string",
  "properties" : {
    "correlation_data" : "string",
    "response_topic" : "string",
    "user_properties" : [ {
      "prop_key" : "string",
      "prop_value" : "string"
    } ]
  },
  "status" : "PENDING",
  "error_info" : {
    "error_code" : "string",
    "error_msg" : "string"
  },
  "created_time" : "20151212T121212Z",
  "finished_time" : "20151212T121212Z"
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.

Sitemizi ve deneyiminizi iyileştirmek için çerezleri kullanırız. Sitemizde tarama yapmaya devam ederek çerez politikamızı kabul etmiş olursunuz. Daha fazla bilgi edinin

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback