forked from docs/doc-exports
Reviewed-by: gtema <artem.goncharov@gmail.com> Co-authored-by: guoyanyan <guoyanyan3@huawei.com> Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
142 lines
11 KiB
HTML
142 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">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">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">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 a topic. You can obtain it according to <a href="smn_api_51004.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__b57274411">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__b453632946">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__b1841617943">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">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__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 value 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 is a UTF-8-coded character string of no more than 256 KB. For SMS subscribers, if the content exceeds 256 bytes, the system will divide it into multiple messages and send only the first two.</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">Time-to-live (TTL) of a message, specifically, the maximum time period for retaining the message in the system</p>
|
|
<p id="smn_api_54001__p73858218511">If the period expires, the system will discard the message. The time period is measured in seconds, and the default TTL is <strong id="smn_api_54001__b84235270617311">3600s</strong> (one hour).</p>
|
|
<p id="smn_api_54001__p163851021156">The value 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__b142806169">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__b913296798">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__b1375747178">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 section <a href="smn_api_63002.html">Returned Value</a>.</p>
|
|
</div>
|
|
<div class="section" id="smn_api_54001__section73211020122511"><h4 class="sectiontitle">Error Code</h4><p id="smn_api_54001__p9759142919265">See section <a href="smn_api_64000.html">Error Code</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>
|
|
|