• Simple Message Notification

smn
  1. Help Center
  2. Simple Message Notification
  3. User Guide
  4. Appendix
  5. HTTP/HTTPS Messages
  6. HTTP/HTTPS Message Format

HTTP/HTTPS Message Format

Scenario

This section describes the format of messages sent to HTTP or HTTPS endpoints. Messages can be identified based on their message types. An HTTP/HTTPS message contains an HTTP/HTTPS header and body. The HTTP/HTTPS body contains JSON character strings.

HTTP/HTTPS Message Header Information

The header of an SMN HTTP/HTTPS message contains the following parameters: X-SMN-TOPIC-URNX-SMN-MESSAGE-IDX-SMN-MESSAGE-TYPE, and X-SMN-SUBSCRIPTION-URN.

Table 1 HTTP/HTTPS header parameters

Parameter

Description

X-SMN-MESSAGE-TYPE

Indicates the message type, which can be:

  • SubscriptionConfirmation
  • Notification
  • UnsubscribeConfirmation

X-SMN-MESSAGE-ID

Indicates the unique message ID.

X-SMN-TOPIC-URN

Indicates the URN of the topic to which the message belongs.

X-SMN-SUBSCRIPTION-URN

Identifies the subscription endpoint.

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 strings in detail.

Table 2 HTTP/HTTPS subscription confirmation message body

Parameter

Description

type

Indicates the message type, the value of which is SubscriptionConfirmation.

subscribe_url

Indicates the URL to be accessed for subscription confirmation.

topic_urn

Indicates the URN of the topic to which the message belongs.

message_id

Indicates the unique message ID.

message

Indicates the message content.

signature

Indicates the signature information.

The signature includes the messagemessage_idsubscribe_urltimestamptopic_urn, and type fields. For details about signature verification, see Message Signature Verification.

signature_version

Indicates the signature version, which is currently V1.

signing_cert_url

Indicates the certificate URL for generating the message signature.

timestamp

Indicates the time stamp when the message was initially sent.

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.

Table 3 HTTP/HTTPS notification message body

Parameter

Description

type

Indicates the message type, the value of which is Notification.

topic_urn

Indicates the URN of the topic to which the message belongs.

message_id

Indicates the unique message ID.

message

Indicates the message content.

unsubscribe_url

Indicates the URL for canceling a subscription.

signature

Indicates the signature information.

The signature includes the messagemessage_idsubjecttimestamptopic_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

Message subject

signature_version

Indicates the signature version, which is currently V1.

signing_cert_url

Indicates the certificate URL for generating the message signature.

timestamp

Indicates the time stamp when the message was initially sent.

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.

Table 4 HTTP/HTTPS subscription cancellation message body

Parameter

Description

type

Indicates the message type, the value of which is UnsubscribeConfirmation.

subscribe_url

Indicates the URL for a re-subscription.

topic_urn

Indicates the URN of the topic to which the message belongs.

message_id

Indicates the unique message ID.

message

Indicates the message content.

signature

Indicates the signature information.

The signature includes the messagemessage_idsubscribe_urltimestamptopic_urn, and type fields. For details about signature verification, see Message Signature Verification.

signature_version

Indicates the signature version, which is currently V1.

signing_cert_url

Indicates the certificate URL for generating the message signature.

timestamp

Indicates the time stamp when the message was initially sent.