HTTP or HTTPS Message Format
Scenarios
- When receiving HTTP or HTTPS messages sent by SMN, refer to the industry standards for the common name (CN) of the terminal certificate. Some special characters may cause HTTPS message sending failures.
- Unencrypted HTTP messages transmitted on the Internet may cause information leakage. Therefore, select the HTTPS protocol when you add subscriptions.
This section describes the formats of messages sent to HTTP/HTTPS endpoints. You can identify the message format based on message type in the header.
SMN supports five message formats: HTTP/HTTPS subscription confirmation messages, HTTP/HTTPS notification messages, HTTP/HTTPS subscription cancellation messages, HTTP/HTTPS subscriber confirmation messages, and HTTP/HTTPS subscriber cancellation messages. All messages are transmitted using the HTTP/HTTPS POST method.
The header of an SMN HTTP/HTTPS message contains the following parameters: X-SMN-MESSAGE-TYPE, X-SMN-MESSAGE-ID, and X-SMN-TOPIC-URN.
| Parameter | Description |
|---|---|
| X-SMN-MESSAGE-TYPE | Indicates the message type, which can be:
|
| X-SMN-MESSAGE-ID | Indicates the unique message ID. |
| X-SMN-TOPIC-URN | Indicates the URN of the topic the message belongs to. |
The requirements for HTTP/HTTPS header fields are described as follows:
- According to section 3.2 in RFC 7230, header fields should be case insensitive.
- According to section 8.1.2 in RFC 7540, header fields in HTTP/2 should be lowercase.
- Custom HTTP/HTTPS header fields must comply with the above two requirements for SMN.
- You are advised to use case-insensitive letters to obtain HTTP/HTTPS header fields.
HTTP/HTTPS Subscription Confirmation Message Format
After you add an HTTP/HTTPS endpoint, SMN sends a subscription confirmation message to the subscriber. The message body is composed of JSON character strings. The subscriber must obtain the subscription URL (subscribe_url) to confirm the subscription. Table 2 describes the JSON field in detail.
| Parameter | Description |
|---|---|
| type | Indicates the message type, which is SubscriptionConfirmation. |
| signature | Indicates the signature information. The signature includes the message, message_id, subscribe_url, timestamp, topic_urn, and type fields. For details about signature verification, see Message Signature Verification. |
| topic_urn | Indicates the URN of the topic the message belongs to. |
| message_id | Indicates the unique message ID. |
| signature_version | Indicates the signature version, which is V1. |
| message | Indicates the message content. |
| subscribe_url | Indicates the URL to be accessed for subscription confirmation. |
| signing_cert_url | Indicates the certificate URL for message signing. It can be directly accessed without authentication. |
| timestamp | Indicates the time stamp when the message was initially sent. |
{
"subscribe_url": "https://console.******.com/smn/subscription/confirm?token=0a419ac94f80f2c62f14c01e34ae5dfcf6b0b92ef46241218eaae5b4cb90d5d423cf104593284665a1f98691b1576976785114fb4408450e8de153b9f1******&topic_urn=urn:smn:region01:0a419ac94f80f2c62f14c01e34******:test_******®ion=region01®ion_id=region01",
"signature": "W/DQSiqpRkY6En0jNaFtCYOpmUjMhzoJIdMPLhnRv37iPzNhH+SxlievFoUIyS29z7Ig4hL/ECWNfGrRhTqoasiAeOaXOjoRNoQ73YfyqWm7x7OdX+2c202zxaOS5GcsUHohxAS+wCYd6W6aVhx6eQpWzpzLwrGgE+iPmsd5I00HXIBeZEeBx/VuoqkPyBDnSvGNNDTJ2gw+fL7XuKqf/DUUjjI8dkPsp3gAcETe/XMgf3UTMFDvLLrq2fAZVhr/jMR/9m81PwuDs1k9i3iBxT67afzmQ1AhY/a/ayQX7Fmwf/FBpehG1o8e98lXAZFS2nzhvTpttawUFG8Z82******",
"topic_urn": "urn:smn:region01:0a419ac94f80f2c62f14c01e34******:test_******",
"message_id": "54bb04eddfc842e9b44ca36393f77cd3",
"signature_version": "v1",
"type": "SubscriptionConfirmation",
"message": "You are invited to subscribe to topic: urn:smn:regionid:0a419ac94f80f2c62f14c01e34******:test_******. To confirm this subscription, please visit the subscribe_url included in this message. The subscribe_url is valid only within 48 hours.",
"signing_cert_url": "https://smn.region01.******.com/smn/SMN_region01_3190c26a56fb435f9882e3435b******.pem",
"timestamp": "2024-07-10T09:43:44Z"
} HTTP/HTTPS Notification Message Format
After an HTTP/HTTPS subscriber confirms the subscription, the subscriber can receive notification messages published to the topic. The notification message body is composed of JSON character strings, which are described in Table 3.
| Parameter | Description |
|---|---|
| type | Indicates the message type, which is Notification. |
| signature | Indicates the signature information. The signature includes the message, message_id, subject, timestamp, topic_urn, and type fields. If the subject field is empty, the signature is not verified. For details about signature verification, see Message Signature Verification. |
| subject | Indicates the message subject. |
| topic_urn | Indicates the URN of the topic the message belongs to. |
| message_id | Indicates the unique message ID. |
| signature_version | Indicates the signature version, which is V1. |
| message | Indicates the message content. |
| unsubscribe_url | Indicates the URL for canceling a subscription. |
| signing_cert_url | Indicates the certificate URL for message signing. |
| timestamp | Indicates the time stamp when the message was initially sent. |
{
"signature": "WmSQ2/0kp2v2u2T33lMqKYrrLxnJoW2NHqIy5QowDuHH3y+HvhCNlCgHDUiAGpb3suCXJm16hWF+EJAYR+tPaTY1q0N3p0p+oBbhlD30fOTxRNsEWRAg73k4qArmQajhdDZOtd57xelQiNhzl2r6iCs0en4kR2iY78zZM/9caZQGBTlNcjkd2lyXYP6aSc7MOgxTsYrRus0A6yipD3zsUA7TvTdfsauAe2hZLR5W0l+um+S3ytT7sA1CMlIJPBXHP5WlqS4iMAeivmufZv7T+G43DbwWfw/seKnK6uFKWd214oqsY2/oLY3C4dcyLdvsy0/7/W8zvxXbgHeSL4******",
"subject": "SMN",
"topic_urn": "urn:smn:region01:0a419ac94f80f2c62f14c01e34******:test_******",
"message_id": "d84bd6629ef04513ad2e37bffd6e17cb",
"signature_version": "v1",
"type": "Notification",
"message": "{\"enterpriseProjectId\": \"0\", \"eventTime\": \"2019-08-12 22:40:55.040632\", \"chargingMode\": \"postPaid\", \"cloudserviceType\": \"xxx.service.type.bandwidth\", \"eventType\": 1, \"regionId\": \"region01\", \"tenantId\": \"057eefe55400d2742f8cc00178******\", \"resourceType\": \"xxx.resource.type.bandwidth\", \"resourceSpecCode\": \"19_bgp\", \"resourceSize\": 10, \"resourceId\": \"e091f1b1-08ef-4e2b-a27e-f85e4c******\", \"resouceSizeMeasureId\": 15, \"resourceName\": \"elbauto_2019_08_13_06_40_46\"}",
"unsubscribe_url": "https://console.******.com/smn/subscription/unsubscribe?region=region01®ion_id=region01&subscription_urn=urn:smn:region01:0a419ac94f80f2c62f14c01e34******:test_******:23cf104593284665a1f98691b1******",
"signing_cert_url": "https://smn.region01.******.com/smn/SMN_region01_3190c26a56fb435f9882e3435b******.pem",
"timestamp": "2024-07-10T09:45:00Z"
} HTTP/HTTPS Subscription Cancellation Message Format
After an HTTP/HTTPS subscription is canceled, the subscriber receives a subscription cancellation message sent by SMN. The message body is composed of JSON character strings, which are described in Table 4.
| Parameter | Description |
|---|---|
| type | Indicates the message type. Its value is UnsubscribeConfirmation. |
| signature | Indicates the signature information. The signature includes the message, message_id, subscribe_url, timestamp, topic_urn, and type fields. For details about signature verification, see Message Signature Verification. |
| topic_urn | Indicates the URN of the topic the message belongs to. |
| message_id | Indicates the unique message ID. |
| signature_version | Indicates the signature version, which is V1. |
| message | Indicates the message content. |
| subscribe_url | Indicates the URL for a re-subscription. |
| signing_cert_url | Indicates the certificate URL for message signing. |
| timestamp | Indicates the time stamp when the message was initially sent. |
{
"signature": "ViE96uGbBkl+S8eWqgebi5KdmRht2U8+Rs88yuyMHq1k4h3jUkcDZ6HCqTqdpJ8nrLcdqETyyEiOQyTszJdU05z+LhfE8jerCCdSbL4zeInVkydHh0kcCRWmORye0/EuQ/gLC1UIXwvUsqbUCPnBRhNFXOeXMOPPCzK+d04xjy4QHd1H/bHxgsY3AlTe0gCFT068Zru7OK6w9aQaY44mXnN3OWGmBmoHyFab5TRXLSQNz/9u/Vj646cQMMaI0PPQ30QzGYD0MtzgDZi12m8jMTHAnMkTEcbLaEgaqmaoEnATSpEcspFKNXv2skwk7rsVakMOISpMH3+qC6RzhE******",
"topic_urn": "urn:smn:region01:0a419ac94f80f2c62f14c01e34******:test_******",
"message_id": "d86c201092574e71a3ca85826652c58b",
"signature_version": "v1",
"type": "UnsubscribeConfirmation",
"message": "You are unsubscribed from topic: urn:smn:region01:0a419ac94f80f2c62f14c01e34******:test_******. To subscribe to this topic again, please visit the subscribe_url included in this message. The subscribe_url is valid only within 48 hours.",
"subscribe_url": "https://console.******.com/smn/subscription/confirm?token=0a419ac94f80f2c62f14c01e34ae5dfcf6b0b92ef46241218eaae5b4cb90d5d423cf104593284665a1f98691b1576976785114fb4408450e8de153b9f1******&topic_urn=urn:smn:region01:0a419ac94f80f2c62f14c01e34******:test_******®ion=region01®ion_id=region01",
"signing_cert_url": "https://smn.region01.******.com/smn/SMN_region01_3190c26a56fb435f9882e3435b******.pem",
"timestamp": "2024-07-10T11:45:00Z"
} HTTP/HTTPS Subscriber Confirmation Message Format
After an HTTP/HTTPS subscriber is added or subscription is cancelled, SMN sends a subscription confirmation message to the endpoint. The following describes the message's HTTP content, which is a JSON-formatted string that includes the subscribe_url field. To confirm the subscription, the subscriber must send a GET request to the subscribe_url address. For details about the JSON fields, see Table 5.
| Parameter | Description |
|---|---|
| type | Indicates the message type, which is HttpSubscriptionUserConfirm. |
| signature | Indicates the signature information. The signature includes the message, message_id, subscribe_url, timestamp, and type fields. |
| message_id | Indicates the unique message ID. |
| signature_version | Indicates the signature version, which is V1. |
| message | Indicates the description of the subscriber confirmation message. |
| subscribe_url | Indicates the URL that the subscriber must access to confirm the subscription. |
| signing_cert_url | Indicates the certificate URL for message signing. It can be directly accessed without authentication. |
| timestamp | Indicates the timestamp when the message is sent for the first time. |
The following is an example HTTP/HTTPS subscriber confirmation message:
{
"message": "You are invited to be a subscriber that belongs to test_******. To confirm your subscription, click subscribe_url within 48 hours.",
"subscribe_url": "https://console.******.com/smn/v2/subscription-users/confirm?ticket_data=******®ion=******",
"type": "HttpSubscriptionUserConfirm",
"message_id": "1ca9e463f2a84ef69f43b65caf9b2064",
"signature": "lRzi9ymQoTgGX7dn8s3UtWWHme8Z0gzLFsknuP2LRkxZqBrHJ9s8+LTwHWcqS7GjhACOBRUuKF+TLsl+Z8jjjvpXCL2pxNZUoBNgT8OhHJ1hL5dqqFBmQzWMa1+mleF9Wo/5kvT+z8ab5h2MV3oLI9ZKjhY1L9Aby7CWq6W4sLtqjqakAWnMEM/o+z/HfHSx3SrRkPyyR5yfaw6GV2K8y+OQ+lPKbMC5qeHjHvIvD1zPsTIvwswxyM2Q3q7c6+fAKeyImeWprbkZc/V0i5VXcYib/Wo8LJcyE87NDpeq1uyWnaDjk1+z2jlXaTB+52FHLAgRsyECrdD2PCQqT82pSQ******",
"signature_version": "v1",
"signing_cert_url": "https://smn.region01.******.com/smn/SMN_region01_3190c26a56fb435f9882e3435b******.pem",
"timestamp": "2026-01-01T00:00:00Z"
} HTTP/HTTPS Subscriber Cancellation Message Format
After an HTTP/HTTPS subscriber confirms a subscription, SMN sends a subscription cancellation message to the subscription endpoint. The message contains the message's HTTP content, which is a JSON-formatted string that includes the unsubscribe_url field. The subscriber can access the URL to cancel the subscriber confirmation. For details about the fields, see Table 6.
| Parameter | Description |
|---|---|
| type | Indicates the message type, which is HttpSubscriptionUserUnsubscribe. |
| signature | Indicates the signature information. The signature includes the message, message_id, timestamp, and type fields. |
| message_id | Indicates the unique message ID. |
| signature_version | Indicates the signature version, which is V1. |
| message | Indicates the description of the subscriber cancellation message. |
| unsubscribe_url | Indicates the URL that the subscriber must access to cancel the subscription. |
| signing_cert_url | Indicates the certificate URL for message signing. It can be directly accessed without authentication. |
| timestamp | Indicates the timestamp when the message is sent for the first time. |
The following is an example HTTP/HTTPS subscriber cancellation message:
{
"message": "You have confirmed to be a subscriber. To cancel the confirmation, click unsubscribe_url within one year. Keep unsubscribe_url secure and do not disclose it to others.",
"unsubscribe_url": "https://console.******.com/smn/v2/subscription-users/unsubscribe?ticket_data=******®ion=******",
"type": "HttpSubscriptionUserUnsubscribe",
"message_id": "fb28c8e29af542dc80290a8e5b1b8d82",
"signature": "nqVADIUhL50Rfe0ksFG3m30bmMnH1icZ4rrhYWHeD2NjrczQyBBl+JIijXpsCa0eBfbijPEJv73M2N1GU4P2gLkI8Q08JrZDxL8NU/b0rDhNfxIunqzWYgfcHl6JkiOU0EY2mkD1ReOXrFaYVS3CLuOiTOKmZsF5+LFz/H8B++uZ8qxOs5PV7mZB7vfCbl5fK/fN3FUN6lY8DW+Qk9sc1L/3784fDJDxdoHQPhraqJOeSwmtO1e+Z3iu4fpPZnsP3x08C3rFCJ+1dhJmlaweGzndXZIJORJm7VDTONTiMOG9E/9G8Wepo85ic+nRF67iHzPVGUoDXROXC8YSg65Zvw******",
"signature_version": "v1",
"signing_cert_url": "https://smn.region01.******.com/smn/SMN_region01_3190c26a56fb435f9882e3435b******.pem",
"timestamp": "2026-01-01T00:00:00Z"
} What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot