doc-exports/docs/smn/api-ref/smn_api_53004.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

224 lines
18 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<a name="smn_api_53004"></a><a name="smn_api_53004"></a>
<h1 class="topictitle1">Querying Message Templates</h1>
<div id="body18062974"><div class="section" id="smn_api_53004__section27645849"><h4 class="sectiontitle">Description</h4><ul id="smn_api_53004__ul33304380203733"><li id="smn_api_53004__li51147505203733">API name<p id="smn_api_53004__p38624841203741"><a name="smn_api_53004__li51147505203733"></a><a name="li51147505203733"></a>ListMessageTemplates</p>
</li></ul>
<ul id="smn_api_53004__ul20998054203745"><li id="smn_api_53004__li46884910203750">Function<p id="smn_api_53004__p53814755"><a name="smn_api_53004__li46884910203750"></a><a name="li46884910203750"></a>Query the template list by page. The list is sorted by the template creation time in ascending order. You can specify <strong id="smn_api_53004__b11798193520252">offset</strong> and <strong id="smn_api_53004__b363774132520">limit</strong>. If no template has been created, an empty list is returned. The parameters <strong id="smn_api_53004__b8423527068283">message_template_name</strong> and <strong id="smn_api_53004__b84235270682823">protocol</strong> are added.</p>
</li></ul>
<div class="note" id="smn_api_53004__note48368154194319"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="smn_api_53004__p32660209194319">The template list provides only brief information. To query the template details, see <a href="smn_api_53005.html">Querying the Details of a Message Template</a>.</p>
</div></div>
</div>
<div class="section" id="smn_api_53004__section47486057"><h4 class="sectiontitle">URI</h4><ul id="smn_api_53004__ul39379979"><li id="smn_api_53004__li18875499">URI format<p id="smn_api_53004__p1252632418520"><a name="smn_api_53004__li18875499"></a><a name="li18875499"></a>GET /v2/{project_id}/notifications/message_template?offset={offset}&amp;limit={limit}&amp;message_template_name={message_template_name}&amp;protocol={protocol}</p>
</li></ul>
<ul id="smn_api_53004__ul52520413"><li id="smn_api_53004__li2921675">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_53004__table26295076" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_53004__row16170542"><th align="left" class="cellrowborder" valign="top" width="20.667933206679333%" id="mcps1.3.2.3.1.1.1.5.1.1"><p id="smn_api_53004__p34745524"><strong id="smn_api_53004__b842352706191030">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21.597840215978405%" id="mcps1.3.2.3.1.1.1.5.1.2"><p id="smn_api_53004__p62924030"><strong id="smn_api_53004__b593421527191713">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="27.06729327067293%" id="mcps1.3.2.3.1.1.1.5.1.3"><p id="smn_api_53004__p63681652"><strong id="smn_api_53004__b84235270619112">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="30.666933306669332%" id="mcps1.3.2.3.1.1.1.5.1.4"><p id="smn_api_53004__p57940224"><strong id="smn_api_53004__b84235270619115">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_53004__row41204595"><td class="cellrowborder" valign="top" width="20.667933206679333%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_53004__p49237932">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="21.597840215978405%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_53004__p28849561">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="27.06729327067293%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_53004__p55113123">String</p>
</td>
<td class="cellrowborder" valign="top" width="30.666933306669332%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><p id="smn_api_53004__p3312144215538">Project ID</p>
<p id="smn_api_53004__p34977969">See <a href="smn_api_66000.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
<tr id="smn_api_53004__row64680333"><td class="cellrowborder" valign="top" width="20.667933206679333%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_53004__p4615638">offset</p>
</td>
<td class="cellrowborder" valign="top" width="21.597840215978405%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_53004__p38322367">No</p>
</td>
<td class="cellrowborder" valign="top" width="27.06729327067293%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_53004__p1093734394616">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="30.666933306669332%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><p id="smn_api_53004__p146581828102110">Offset</p>
<p id="smn_api_53004__p21821344207">If the offset is an integer greater than 0 but less than the number of resources, all resources after this offset will be queried. The default offset is <strong id="smn_api_53004__b12138124415152">0</strong>.</p>
</td>
</tr>
<tr id="smn_api_53004__row51881906"><td class="cellrowborder" valign="top" width="20.667933206679333%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_53004__p41684868">limit</p>
</td>
<td class="cellrowborder" valign="top" width="21.597840215978405%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_53004__p21031171">No</p>
</td>
<td class="cellrowborder" valign="top" width="27.06729327067293%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_53004__p25803286">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="30.666933306669332%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><ul id="smn_api_53004__ul38160342182720"><li id="smn_api_53004__li35820204182720">Number of resources returned on each page</li><li id="smn_api_53004__li7898765182720">Value range: 1100<p id="smn_api_53004__p3980022182720"><a name="smn_api_53004__li7898765182720"></a><a name="li7898765182720"></a>Commonly used numbers are <strong id="smn_api_53004__b152545771319">10</strong>, <strong id="smn_api_53004__b122548791311">20</strong>, and <strong id="smn_api_53004__b1325587131310">50</strong>.</p>
<p id="smn_api_53004__p4889152416011">The default number is <strong id="smn_api_53004__b1713511181318">100</strong>.</p>
</li></ul>
</td>
</tr>
<tr id="smn_api_53004__row18621933"><td class="cellrowborder" valign="top" width="20.667933206679333%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_53004__p31981619">message_template_name</p>
</td>
<td class="cellrowborder" valign="top" width="21.597840215978405%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_53004__p40374353">No</p>
</td>
<td class="cellrowborder" valign="top" width="27.06729327067293%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_53004__p49097200">String</p>
</td>
<td class="cellrowborder" valign="top" width="30.666933306669332%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><p id="smn_api_53004__p17450296">Template name</p>
<p id="smn_api_53004__p6338272399">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_53004__row37690705"><td class="cellrowborder" valign="top" width="20.667933206679333%" headers="mcps1.3.2.3.1.1.1.5.1.1 "><p id="smn_api_53004__p33048293">protocol</p>
</td>
<td class="cellrowborder" valign="top" width="21.597840215978405%" headers="mcps1.3.2.3.1.1.1.5.1.2 "><p id="smn_api_53004__p59666077">No</p>
</td>
<td class="cellrowborder" valign="top" width="27.06729327067293%" headers="mcps1.3.2.3.1.1.1.5.1.3 "><p id="smn_api_53004__p1114082">String</p>
</td>
<td class="cellrowborder" valign="top" width="30.666933306669332%" headers="mcps1.3.2.3.1.1.1.5.1.4 "><p id="smn_api_53004__p23131803">Protocol supported by the template</p>
<p id="smn_api_53004__p15571735514">The following protocols are supported:</p>
<ul id="smn_api_53004__ul1715273514576"><li id="smn_api_53004__smn_api_53001_li1915283525718"><strong id="smn_api_53004__smn_api_53001_b122581017374">email</strong></li><li id="smn_api_53004__smn_api_53001_li955352032817"><strong id="smn_api_53004__smn_api_53001_b1938219133716">default</strong></li><li id="smn_api_53004__smn_api_53001_li031203718574"><strong id="smn_api_53004__smn_api_53001_b23671526885">sms</strong></li><li id="smn_api_53004__smn_api_53001_li1682010496573"><strong id="smn_api_53004__smn_api_53001_b185159332910">http</strong> and <strong id="smn_api_53004__smn_api_53001_b25282033899">https</strong></li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="smn_api_53004__section24721334"><h4 class="sectiontitle">Request</h4><div class="p" id="smn_api_53004__p32931230124510">Example request<pre class="screen" id="smn_api_53004__screen39543111105211">GET https://{SMN_Endpoint}/v2/{project_id}/notifications/message_template?offset=0&amp;limit=2&amp;message_template_name=test1&amp;protocol=email</pre>
</div>
</div>
<div class="section" id="smn_api_53004__section21165417"><h4 class="sectiontitle">Response</h4><ul id="smn_api_53004__ul42047784"><li id="smn_api_53004__li42885739">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_53004__table50427332" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_53004__row21494305"><th align="left" class="cellrowborder" valign="top" width="37.163716371637165%" id="mcps1.3.4.2.1.1.1.4.1.1"><p id="smn_api_53004__p63317164"><strong id="smn_api_53004__b467937232">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21.562156215621563%" id="mcps1.3.4.2.1.1.1.4.1.2"><p id="smn_api_53004__p28416672"><strong id="smn_api_53004__b2068899797">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="41.27412741274127%" id="mcps1.3.4.2.1.1.1.4.1.3"><p id="smn_api_53004__p20049059"><strong id="smn_api_53004__b185677211">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_53004__row8508925"><td class="cellrowborder" valign="top" width="37.163716371637165%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_53004__p18134306">request_id</p>
</td>
<td class="cellrowborder" valign="top" width="21.562156215621563%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_53004__p59592696">String</p>
</td>
<td class="cellrowborder" valign="top" width="41.27412741274127%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_53004__p62279078">Request ID, which is unique</p>
</td>
</tr>
<tr id="smn_api_53004__row35856517"><td class="cellrowborder" valign="top" width="37.163716371637165%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_53004__p18696727">message_template_count</p>
</td>
<td class="cellrowborder" valign="top" width="21.562156215621563%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_53004__p38039934">String</p>
</td>
<td class="cellrowborder" valign="top" width="41.27412741274127%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_53004__p61335842">Number of returned templates</p>
</td>
</tr>
<tr id="smn_api_53004__row19325759"><td class="cellrowborder" valign="top" width="37.163716371637165%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_53004__p21882681">message_templates</p>
</td>
<td class="cellrowborder" valign="top" width="21.562156215621563%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_53004__p6914341891">Array of <a href="#smn_api_53004__table52721373195752">Table 1</a> objects</p>
</td>
<td class="cellrowborder" valign="top" width="41.27412741274127%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_53004__p3915749919"><strong id="smn_api_53004__b11650414468">Message_template</strong> structure array</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="smn_api_53004__table52721373195752"></a><a name="table52721373195752"></a><table cellpadding="4" cellspacing="0" summary="" id="smn_api_53004__table52721373195752" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Message template structure</caption><thead align="left"><tr id="smn_api_53004__row49890639195752"><th align="left" class="cellrowborder" valign="top" width="30.409999999999997%" id="mcps1.3.4.2.1.2.2.4.1.1"><p id="smn_api_53004__p14609979195752"><strong id="smn_api_53004__b1071973719112">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="27.889999999999997%" id="mcps1.3.4.2.1.2.2.4.1.2"><p id="smn_api_53004__p42557684195752"><strong id="smn_api_53004__b1019541395">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="41.699999999999996%" id="mcps1.3.4.2.1.2.2.4.1.3"><p id="smn_api_53004__p24620385195752"><strong id="smn_api_53004__b75384394116">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_53004__row3315065195752"><td class="cellrowborder" valign="top" width="30.409999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="smn_api_53004__p84852195752">message_template_id</p>
</td>
<td class="cellrowborder" valign="top" width="27.889999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="smn_api_53004__p6873027195752">String</p>
</td>
<td class="cellrowborder" valign="top" width="41.699999999999996%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="smn_api_53004__p19844303195752">Template ID</p>
</td>
</tr>
<tr id="smn_api_53004__row38091128195752"><td class="cellrowborder" valign="top" width="30.409999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="smn_api_53004__p65482522195752">message_template_name</p>
</td>
<td class="cellrowborder" valign="top" width="27.889999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="smn_api_53004__p2484052195752">String</p>
</td>
<td class="cellrowborder" valign="top" width="41.699999999999996%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="smn_api_53004__p66990543195752">Template name</p>
</td>
</tr>
<tr id="smn_api_53004__row1830114116222"><td class="cellrowborder" valign="top" width="30.409999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="smn_api_53004__p04063811611">protocol</p>
</td>
<td class="cellrowborder" valign="top" width="27.889999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="smn_api_53004__p18228205714104">String</p>
</td>
<td class="cellrowborder" valign="top" width="41.699999999999996%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="smn_api_53004__p14404381967">Protocol supported by the template</p>
<p id="smn_api_53004__p11456163572311">The following protocols are supported:</p>
<ul id="smn_api_53004__ul045620357238"><li id="smn_api_53004__smn_api_53001_li1915283525718_1"><strong id="smn_api_53004__smn_api_53001_b122581017374_1">email</strong></li><li id="smn_api_53004__smn_api_53001_li955352032817_1"><strong id="smn_api_53004__smn_api_53001_b1938219133716_1">default</strong></li><li id="smn_api_53004__smn_api_53001_li031203718574_1"><strong id="smn_api_53004__smn_api_53001_b23671526885_1">sms</strong></li><li id="smn_api_53004__smn_api_53001_li1682010496573_1"><strong id="smn_api_53004__smn_api_53001_b185159332910_1">http</strong> and <strong id="smn_api_53004__smn_api_53001_b25282033899_1">https</strong></li></ul>
</td>
</tr>
<tr id="smn_api_53004__row31653440195752"><td class="cellrowborder" valign="top" width="30.409999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="smn_api_53004__p13791810195752">tag_names</p>
</td>
<td class="cellrowborder" valign="top" width="27.889999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="smn_api_53004__p43394841195752">String array</p>
</td>
<td class="cellrowborder" valign="top" width="41.699999999999996%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="smn_api_53004__p25321261195752">Variable list</p>
</td>
</tr>
<tr id="smn_api_53004__row4262034195752"><td class="cellrowborder" valign="top" width="30.409999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="smn_api_53004__p9680508195752">create_time</p>
</td>
<td class="cellrowborder" valign="top" width="27.889999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="smn_api_53004__p45923711195752">String</p>
</td>
<td class="cellrowborder" valign="top" width="41.699999999999996%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="smn_api_53004__p28833090195752">Time when the template was created</p>
<p id="smn_api_53004__p535731162417">The UTC time is in <em id="smn_api_53004__i23501384310">YYYY-MM-DDTHH:MM:SSZ</em> format.</p>
</td>
</tr>
<tr id="smn_api_53004__row14248281195752"><td class="cellrowborder" valign="top" width="30.409999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="smn_api_53004__p13260149195752">update_time</p>
</td>
<td class="cellrowborder" valign="top" width="27.889999999999997%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="smn_api_53004__p330252195752">String</p>
</td>
<td class="cellrowborder" valign="top" width="41.699999999999996%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="smn_api_53004__p26750472195752">Last time when the template was updated</p>
<p id="smn_api_53004__p25218464247">The UTC time is in <em id="smn_api_53004__i176381520257">YYYY-MM-DDTHH:MM:SSZ</em> format.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="smn_api_53004__li63685038">Example response<pre class="screen" id="smn_api_53004__screen47193592194530">{
"message_templates":[
{
"message_template_name": "confirm_message",
"protocol": "sms",
"update_time": "2016-08-02T08:22:18Z",
"create_time": "2016-08-02T08:22:18Z",
"tag_names":[
"topic_urn"
],
"message_template_id": "79227dfdf88d4e52a1820ca1eb411635"
},
{
"message_template_name": "confirm_message",
"protocol": "email",
"update_time": "2016-08-02T08:22:19Z",
"create_time": "2016-08-02T08:22:19Z",
"tag_names": [
"topic_id"
],
"message_template_id": "ecf63465804a4b10a0573980be78ffba"
},
{
"message_template_name": "confirm_message",
"protocol": "https",
"update_time": "2016-08-02T08:22:20Z",
"create_time": "2016-08-02T08:22:20Z",
"tag_names": [
"topic_id"
],
"message_template_id": "57ba8dcecda844878c5dd5815b65d10f"
}
],
"request_id": "ce7f2f7343224f8c9597b05a9a0bcc2e",
"message_template_count": 3
}</pre>
</li></ul>
</div>
<div class="section" id="smn_api_53004__section56271027"><h4 class="sectiontitle">Returned Value</h4><p id="smn_api_53004__p49844138">See <a href="smn_api_63002.html">Returned Value</a>.</p>
</div>
<div class="section" id="smn_api_53004__section73211020122511"><h4 class="sectiontitle">Error Codes</h4><p id="smn_api_53004__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>