forked from docs/doc-exports
Reviewed-by: Bobkova, Natalia <natalia.bobkova@t-systems.com> Co-authored-by: Zaoxu, Li <lizaoxu@huawei.com> Co-committed-by: Zaoxu, Li <lizaoxu@huawei.com>
143 lines
11 KiB
HTML
143 lines
11 KiB
HTML
<a name="smn_api_54001"></a><a name="smn_api_54001"></a>
|
|
|
|
<h1 class="topictitle1">Publishing Messages in the Text Format</h1>
|
|
<div id="body1471602451369"><div class="section" id="smn_api_54001__section34083598194741"><h4 class="sectiontitle">Description</h4><ul id="smn_api_54001__ul33304380203733"><li id="smn_api_54001__li51147505203733">API name<p id="smn_api_54001__p38624841203741"><a name="smn_api_54001__li51147505203733"></a><a name="li51147505203733"></a>Publish</p>
|
|
</li></ul>
|
|
<ul id="smn_api_54001__ul20998054203745"><li id="smn_api_54001__li46884910203750">Function<p class="tabletext" id="smn_api_54001__p9308019194741"><a name="smn_api_54001__li46884910203750"></a><a name="li46884910203750"></a>Publish messages in the text format to a topic. After the message ID is returned, the message has been saved and is to be pushed to the subscribers of the topic.</p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_54001__section16663308194741"><h4 class="sectiontitle">URI</h4><ul id="smn_api_54001__ul7550747194741"><li id="smn_api_54001__li847867194741">URI format<p class="tabletext" id="smn_api_54001__p7630803194741"><a name="smn_api_54001__li847867194741"></a><a name="li847867194741"></a>POST /v2/{project_id}/notifications/topics/{topic_urn}/publish</p>
|
|
</li></ul>
|
|
<ul id="smn_api_54001__ul1568365194741"><li id="smn_api_54001__li14115291194741">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_54001__table59928756194741" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_54001__row4278206194741"><th align="left" class="cellrowborder" valign="top" width="16.66833316668333%" id="mcps1.3.2.3.1.1.1.5.1.1"><p id="smn_api_54001__p10990404194741"><strong id="smn_api_54001__b842352706191030">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="19.04809519048095%" id="mcps1.3.2.3.1.1.1.5.1.2"><p id="smn_api_54001__p17807502194741"><strong id="smn_api_54001__b593421527191713">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="17.858214178582145%" id="mcps1.3.2.3.1.1.1.5.1.3"><p id="smn_api_54001__p33121540194741"><strong id="smn_api_54001__b84235270619112">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="46.42535746425357%" id="mcps1.3.2.3.1.1.1.5.1.4"><p id="smn_api_54001__p65599120194741"><strong id="smn_api_54001__b84235270619115">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_54001__row26682115194741"><td class="cellrowborder" valign="top" width="16.66833316668333%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_54001__p13767740194741">project_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="19.04809519048095%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_54001__p41445161194741">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.858214178582145%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_54001__p1614899194741">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="46.42535746425357%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><p id="smn_api_54001__p55689039155337">Project ID</p>
|
|
<p id="smn_api_54001__p63697985194741">See <a href="smn_api_66000.html">Obtaining a Project ID</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_54001__row63606429194741"><td class="cellrowborder" valign="top" width="16.66833316668333%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_54001__p51847142194741">topic_urn</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="19.04809519048095%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_54001__p38868943194741">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.858214178582145%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_54001__p61376640194741">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="46.42535746425357%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><p id="smn_api_54001__p5451938194741">Unique resource ID of the topic. You can obtain it by referring to <a href="en-us_topic_0036016755.html">Querying Topics</a>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_54001__section1142871194741"><h4 class="sectiontitle">Request</h4><ul id="smn_api_54001__ul25463739194741"><li id="smn_api_54001__li27847059194741">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_54001__table49296942194741" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_54001__row13744451194741"><th align="left" class="cellrowborder" valign="top" width="17.52%" id="mcps1.3.3.2.1.1.1.5.1.1"><p id="smn_api_54001__p39558753194741"><strong id="smn_api_54001__b1283967408">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="22.48%" id="mcps1.3.3.2.1.1.1.5.1.2"><p id="smn_api_54001__p50142464194741"><strong id="smn_api_54001__b287768269352">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="23.21%" id="mcps1.3.3.2.1.1.1.5.1.3"><p id="smn_api_54001__p35007816194741"><strong id="smn_api_54001__b45504978">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="36.79%" id="mcps1.3.3.2.1.1.1.5.1.4"><p id="smn_api_54001__p17060832194741"><strong id="smn_api_54001__b121033855">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_54001__row65643809194741"><td class="cellrowborder" valign="top" width="17.52%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_54001__p15548314194741">subject</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.48%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_54001__p51453956194741">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="23.21%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_54001__p7020935194741">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="36.79%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_54001__p31824842194741">Message subject, which is used as the email subject when you publish email messages. The subject cannot exceed 512 characters.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_54001__row47751841194741"><td class="cellrowborder" valign="top" width="17.52%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_54001__p42693949194741">message</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.48%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_54001__p35657812194741">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="23.21%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_54001__p2601680194741">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="36.79%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_54001__p9409561194741">Message content</p>
|
|
<p id="smn_api_54001__p23976982194741">The message content must be UTF-8-coded and can be no more than 256 KB. </p>
|
|
<p id="smn_api_54001__p1821653193210">If the subscription endpoint is a mobile number, each SMS message can contain up to 256 bytes. If you publish a message that exceeds the size limit, SMN sends it as multiple messages, each fitting within the size limit.</p>
|
|
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_54001__row103682214520"><td class="cellrowborder" valign="top" width="17.52%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_54001__p23681125515">time_to_live</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.48%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_54001__p23681626518">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="23.21%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_54001__p18075392520">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="36.79%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_54001__p66191571978">The maximum retention period of a message in SMN</p>
|
|
<p id="smn_api_54001__p73858218511">After the retention period expires, SMN does not send this message. The time period is measured in seconds, and the default retention period is <strong id="smn_api_54001__b84235270617311">3600</strong> (one hour).</p>
|
|
<p id="smn_api_54001__p163851021156">The retention period must be a positive integer less than or equal to 604,800 (3600 x 24 x 7).</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="smn_api_54001__li14466252194741">Example request<pre class="screen" id="smn_api_54001__screen14422309105253">POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId: f96188c7ccaf4ffba0c9aa149ab2bd57:test_create_topic_v2/publish</pre>
|
|
<pre class="screen" id="smn_api_54001__screen26391065194811">{
|
|
"subject": "test message v2",
|
|
"message": "Message test message v2",
|
|
"time_to_live": "3600"
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_54001__section43693179194741"><h4 class="sectiontitle">Response</h4><ul id="smn_api_54001__ul49486580194741"><li id="smn_api_54001__li42726036194741">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_54001__table48990005194741" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_54001__row32165281194741"><th align="left" class="cellrowborder" valign="top" width="30.006999300069992%" id="mcps1.3.4.2.1.1.1.4.1.1"><p id="smn_api_54001__p55250992194741"><strong id="smn_api_54001__b1031012503">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="26.807319268073194%" id="mcps1.3.4.2.1.1.1.4.1.2"><p id="smn_api_54001__p46145363194741"><strong id="smn_api_54001__b1834734748">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="43.185681431856814%" id="mcps1.3.4.2.1.1.1.4.1.3"><p id="smn_api_54001__p46786931194741"><strong id="smn_api_54001__b709257699">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_54001__row13112008194741"><td class="cellrowborder" valign="top" width="30.006999300069992%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_54001__p55439693194741">request_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.807319268073194%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_54001__p61430126194741">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="43.185681431856814%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_54001__p9784341194741">Request ID, which is unique</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_54001__row19245029194741"><td class="cellrowborder" valign="top" width="30.006999300069992%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_54001__p15343493194741">message_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.807319268073194%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_54001__p34863430194741">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="43.185681431856814%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_54001__p5365583194741">Message ID, which is unique</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li><li id="smn_api_54001__li19196568194741">Example response<pre class="screen" id="smn_api_54001__screen22887950194824">{
|
|
"message_id": "bf94b63a5dfb475994d3ac34664e24f2",
|
|
"request_id": "9974c07f6d554a6d827956acbeb4be5f"
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_54001__section56116278194741"><h4 class="sectiontitle">Returned Value</h4><p id="smn_api_54001__p49124666194741">See <a href="smn_api_63002.html">Returned Value</a>.</p>
|
|
</div>
|
|
<div class="section" id="smn_api_54001__section73211020122511"><h4 class="sectiontitle">Error Codes</h4><p id="smn_api_54001__p9759142919265">See <a href="smn_api_64000.html">Error Codes</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="smn_api_54000.html">Message Publishing</a></div>
|
|
</div>
|
|
</div>
|
|
|