doc-exports/docs/smn/api-ref/smn_api_53001.html
Zaoxu, Li 152a7d9381 SMN API DOC
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>
2024-06-20 15:01:38 +00:00

136 lines
11 KiB
HTML

<a name="smn_api_53001"></a><a name="smn_api_53001"></a>
<h1 class="topictitle1">Creating a Message Template</h1>
<div id="body1471602451369"><div class="section" id="smn_api_53001__section8297742193738"><h4 class="sectiontitle">Description</h4><ul id="smn_api_53001__ul33304380203733"><li id="smn_api_53001__li51147505203733">API name<p id="smn_api_53001__p38624841203741"><a name="smn_api_53001__li51147505203733"></a><a name="li51147505203733"></a>CreateMessageTemplate</p>
</li></ul>
<ul id="smn_api_53001__ul20998054203745"><li id="smn_api_53001__li46884910203750">Function<p id="smn_api_53001__p161662387455"><a name="smn_api_53001__li46884910203750"></a><a name="li46884910203750"></a>Create a message template for quick message sending to reduce the request data volume.</p>
<p id="smn_api_53001__p5295386410442">By default, a user can create a maximum of 100 message templates. However, in a high-concurrency scenario, which is rare, extra templates may be successfully created.</p>
</li></ul>
</div>
<div class="section" id="smn_api_53001__section9256466193738"><h4 class="sectiontitle">URI</h4><ul id="smn_api_53001__ul11576320193738"><li id="smn_api_53001__li37078021193738">URI format<p id="smn_api_53001__p65266738193738"><a name="smn_api_53001__li37078021193738"></a><a name="li37078021193738"></a>POST /v2/{project_id}/notifications/message_template</p>
</li></ul>
<ul id="smn_api_53001__ul50529737193738"><li id="smn_api_53001__li52114449193738">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_53001__table66376860193738" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_53001__row32265521193738"><th align="left" class="cellrowborder" valign="top" width="19.54%" id="mcps1.3.2.3.1.1.1.5.1.1"><p id="smn_api_53001__p63370415193738"><strong id="smn_api_53001__b842352706191030">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21.490000000000002%" id="mcps1.3.2.3.1.1.1.5.1.2"><p id="smn_api_53001__p32730030193738"><strong id="smn_api_53001__b593421527191713">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="22.09%" id="mcps1.3.2.3.1.1.1.5.1.3"><p id="smn_api_53001__p33886806193738"><strong id="smn_api_53001__b84235270619112">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="36.88%" id="mcps1.3.2.3.1.1.1.5.1.4"><p id="smn_api_53001__p60476750193738"><strong id="smn_api_53001__b84235270619115">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_53001__row40354127193738"><td class="cellrowborder" valign="top" width="19.54%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_53001__p47458856193738">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="21.490000000000002%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_53001__p18962162193738">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="22.09%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_53001__p59540181193738">String</p>
</td>
<td class="cellrowborder" valign="top" width="36.88%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><p id="smn_api_53001__p204280715521">Project ID</p>
<p id="smn_api_53001__p58025336193738">See <a href="smn_api_66000.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="smn_api_53001__section62753823193738"><h4 class="sectiontitle">Request</h4><ul id="smn_api_53001__ul49894899193738"><li id="smn_api_53001__li46400914193738">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_53001__table14955048193738" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_53001__row8946017193738"><th align="left" class="cellrowborder" valign="top" width="25.629999999999995%" id="mcps1.3.3.2.1.1.1.5.1.1"><p id="smn_api_53001__p53538768193738"><strong id="smn_api_53001__b2074795357">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="22.41%" id="mcps1.3.3.2.1.1.1.5.1.2"><p id="smn_api_53001__p41672976193738"><strong id="smn_api_53001__b181195193337">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21.560000000000002%" id="mcps1.3.3.2.1.1.1.5.1.3"><p id="smn_api_53001__p20067913193738"><strong id="smn_api_53001__b741693542">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="30.4%" id="mcps1.3.3.2.1.1.1.5.1.4"><p id="smn_api_53001__p14888226193738"><strong id="smn_api_53001__b488416187">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_53001__row38253781193738"><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_53001__p11548543193738">message_template_name</p>
</td>
<td class="cellrowborder" valign="top" width="22.41%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_53001__p63016810193738">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="21.560000000000002%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_53001__p4087998193738">String</p>
</td>
<td class="cellrowborder" valign="top" width="30.4%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_53001__p62692385193738">Template name</p>
<p id="smn_api_53001__p487820285367">Enter 1 to 64 characters, and start with a letter or digit. Only letters, digits, hyphens (-), and underscores (_) are allowed.</p>
</td>
</tr>
<tr id="smn_api_53001__row1612977193738"><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_53001__p63542293193738">content</p>
</td>
<td class="cellrowborder" valign="top" width="22.41%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_53001__p46652102193738">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="21.560000000000002%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_53001__p20723883193738">String</p>
</td>
<td class="cellrowborder" valign="top" width="30.4%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_53001__p912940193738">Template content, which currently supports plain text only</p>
<p id="smn_api_53001__p73931234163613">The template content cannot be left blank or larger than 256 KB.</p>
</td>
</tr>
<tr id="smn_api_53001__row61554123193738"><td class="cellrowborder" valign="top" width="25.629999999999995%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_53001__p19828051193738">protocol</p>
</td>
<td class="cellrowborder" valign="top" width="22.41%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_53001__p62568275193738">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="21.560000000000002%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_53001__p34865524193738">String</p>
</td>
<td class="cellrowborder" valign="top" width="30.4%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_53001__p23131803">Protocol supported by the template</p>
<p id="smn_api_53001__p15571735514">Currently, the following protocols are supported:</p>
<ul id="smn_api_53001__ul1715273514576"><li id="smn_api_53001__li1915283525718"><strong id="smn_api_53001__b122581017374">email</strong></li><li id="smn_api_53001__li955352032817"><strong id="smn_api_53001__b1938219133716">default</strong></li><li id="smn_api_53001__li031203718574"><strong id="smn_api_53001__b23671526885">sms</strong></li><li id="smn_api_53001__li1682010496573"><strong id="smn_api_53001__b185159332910">http</strong> and <strong id="smn_api_53001__b25282033899">https</strong></li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
<ul id="smn_api_53001__ul57963375193738"><li id="smn_api_53001__li51908331193738">Example request<pre class="screen" id="smn_api_53001__screen23826321105059">POST https://{SMN_Endpoint}/v2/{project_id}/notifications/message_template</pre>
<pre class="screen" id="smn_api_53001__screen59760459193821">{
"message_template_name": "confirm_message",
"protocol": "https",
"content": "(1/2)You are invited to subscribe to topic({topic_id}). Click the following URL to confirm subscription:(If you do not want to subscribe to this topic, ignore this message.)"
}</pre>
</li></ul>
</div>
<div class="section" id="smn_api_53001__section2535551193738"><h4 class="sectiontitle">Response</h4><ul id="smn_api_53001__ul4053051193738"><li id="smn_api_53001__li36477466193738">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_53001__table59861740193738" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_53001__row37209510193738"><th align="left" class="cellrowborder" valign="top" width="34.09340934093409%" id="mcps1.3.4.2.1.1.1.4.1.1"><p id="smn_api_53001__p61180371193738"><strong id="smn_api_53001__b1900856937">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="29.56295629562956%" id="mcps1.3.4.2.1.1.1.4.1.2"><p id="smn_api_53001__p56663008193738"><strong id="smn_api_53001__b1881007783">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="36.343634363436344%" id="mcps1.3.4.2.1.1.1.4.1.3"><p id="smn_api_53001__p26300917193738"><strong id="smn_api_53001__b1629751159">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_53001__row23431513193738"><td class="cellrowborder" valign="top" width="34.09340934093409%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_53001__p18904440193738">request_id</p>
</td>
<td class="cellrowborder" valign="top" width="29.56295629562956%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_53001__p54864704193738">String</p>
</td>
<td class="cellrowborder" valign="top" width="36.343634363436344%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_53001__p14856024193738">Request ID, which is unique</p>
</td>
</tr>
<tr id="smn_api_53001__row25514541193738"><td class="cellrowborder" valign="top" width="34.09340934093409%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_53001__p53411941193738">message_template_id</p>
</td>
<td class="cellrowborder" valign="top" width="29.56295629562956%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_53001__p31399978193738">String</p>
</td>
<td class="cellrowborder" valign="top" width="36.343634363436344%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_53001__p60370275193738">Resource identifier of the template, which is unique</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
<ul id="smn_api_53001__ul12862035193738"><li id="smn_api_53001__li48649453193738">Example response<pre class="screen" id="smn_api_53001__screen54745463193844">{
"request_id": "ca03efa691624d8eb2dfeba01a1bcf6e",
"message_template_id": "57ba8dcecda844878c5dd5815b65d10f"
}</pre>
</li></ul>
</div>
<div class="section" id="smn_api_53001__section49451272193738"><h4 class="sectiontitle">Returned Value</h4><p id="smn_api_53001__p46130129193738">See <a href="smn_api_63002.html">Returned Value</a>.</p>
</div>
<div class="section" id="smn_api_53001__section73211020122511"><h4 class="sectiontitle">Error Codes</h4><p id="smn_api_53001__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_53000.html">Template Operations</a></div>
</div>
</div>