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>
124 lines
9.5 KiB
HTML
124 lines
9.5 KiB
HTML
<a name="smn_api_55001"></a><a name="smn_api_55001"></a>
|
|
|
|
<h1 class="topictitle1">Sending a Transactional SMS Message to a Phone Number</h1>
|
|
<div id="body1477641760137"><div class="section" id="smn_api_55001__section2841046616319"><h4 class="sectiontitle">Description</h4><div class="note" id="smn_api_55001__note15448103663113"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="smn_api_55001__p14489365314">Direct SMS messaging is not available to new users. If you want to use these APIs, go to <strong id="smn_api_55001__b12508538194617">Cloud Communications</strong> > <strong id="smn_api_55001__b4199542184615">Message&SMS</strong>.</p>
|
|
</div></div>
|
|
<ul id="smn_api_55001__ul1954637016319"><li id="smn_api_55001__li4169960316319">API name<p id="smn_api_55001__p3975211016319">SmsPublish</p>
|
|
</li><li id="smn_api_55001__li2222467716319">Function<p id="smn_api_55001__p6580436716319">Send a transactional SMS message to a specified phone number, usually used for verification code or notification.</p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_55001__section5536839916319"><h4 class="sectiontitle">URI</h4><ul id="smn_api_55001__ul5565535416319"><li id="smn_api_55001__li3113614316319">URI format<p id="smn_api_55001__p1178983816319">POST /v2/{project_id}/notifications/sms</p>
|
|
</li><li id="smn_api_55001__li3899967816319">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_55001__table1545278516319" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_55001__row4866951016319"><th align="left" class="cellrowborder" valign="top" width="21.27787221277872%" id="mcps1.3.2.2.2.1.1.5.1.1"><p id="smn_api_55001__p4991624416319"><strong id="smn_api_55001__b842352706191030">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="19.688031196880313%" id="mcps1.3.2.2.2.1.1.5.1.2"><p id="smn_api_55001__p1668400316319"><strong id="smn_api_55001__b593421527191713">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.987901209879013%" id="mcps1.3.2.2.2.1.1.5.1.3"><p id="smn_api_55001__p922703516319"><strong id="smn_api_55001__b84235270619112">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="38.04619538046195%" id="mcps1.3.2.2.2.1.1.5.1.4"><p id="smn_api_55001__p919235516319"><strong id="smn_api_55001__b84235270619115">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_55001__row4728262816319"><td class="cellrowborder" valign="top" width="21.27787221277872%" headers="mcps1.3.2.2.2.1.1.5.1.1 "><p id="smn_api_55001__p468766116319">project_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="19.688031196880313%" headers="mcps1.3.2.2.2.1.1.5.1.2 "><p id="smn_api_55001__p4415629516319">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.987901209879013%" headers="mcps1.3.2.2.2.1.1.5.1.3 "><p id="smn_api_55001__p1989017016319">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="38.04619538046195%" headers="mcps1.3.2.2.2.1.1.5.1.4 "><p id="smn_api_55001__p682193315545">Project ID</p>
|
|
<p id="smn_api_55001__p49105316319">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_55001__section57419616319"><h4 class="sectiontitle">Request</h4><ul id="smn_api_55001__ul4650991216319"><li id="smn_api_55001__li1593603116319">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_55001__table920655716319" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_55001__row5615067816319"><th align="left" class="cellrowborder" valign="top" width="18.8%" id="mcps1.3.3.2.1.1.1.5.1.1"><p id="smn_api_55001__p5191106116319"><strong id="smn_api_55001__b237681975">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="22.869999999999997%" id="mcps1.3.3.2.1.1.1.5.1.2"><p id="smn_api_55001__p4404643716319"><strong id="smn_api_55001__b34394499562">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.3.2.1.1.1.5.1.3"><p id="smn_api_55001__p1099166216319"><strong id="smn_api_55001__b44117074">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33%" id="mcps1.3.3.2.1.1.1.5.1.4"><p id="smn_api_55001__p1790939916319"><strong id="smn_api_55001__b431519678">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_55001__row6305495416319"><td class="cellrowborder" valign="top" width="18.8%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_55001__p717763616319">endpoint</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.869999999999997%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_55001__p4451766316319">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_55001__p4916096316319">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_55001__p2261503016319">Phone number</p>
|
|
<p id="smn_api_55001__p1987817916319">The phone number must be preceded by a plus sign (+) and a country code.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_55001__row4468588616319"><td class="cellrowborder" valign="top" width="18.8%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_55001__p6278699416319">message</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.869999999999997%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_55001__p5258174716319">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_55001__p3126308016319">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_55001__p4928152916319">SMS message content</p>
|
|
<p id="smn_api_55001__p3238094416319">If the content exceeds 256 bytes, the system will divide it into multiple messages, each containing 256 bytes at most and send only the first two.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="smn_api_55001__ul561077016319"><li id="smn_api_55001__li5049693616319">Example request<div class="p" id="smn_api_55001__p9913135813292"><pre class="screen" id="smn_api_55001__screen585135617298">POST https://{SMN_Endpoint}/v2/{project_id}/notifications/sms
|
|
{
|
|
"endpoint": "+00111****1990",
|
|
"message": "SMS message test"
|
|
}</pre>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_55001__section3660902116319"><h4 class="sectiontitle">Response</h4><ul id="smn_api_55001__ul1254072516319"><li id="smn_api_55001__li4575766616319">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_55001__table916581816319" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_55001__row1992556516319"><th align="left" class="cellrowborder" valign="top" width="30.366963303669635%" id="mcps1.3.4.2.1.1.1.4.1.1"><p id="smn_api_55001__p335807316319"><strong id="smn_api_55001__b1555646738">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="34.97650234976503%" id="mcps1.3.4.2.1.1.1.4.1.2"><p id="smn_api_55001__p356849316319"><strong id="smn_api_55001__b828517610">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="34.656534346565344%" id="mcps1.3.4.2.1.1.1.4.1.3"><p id="smn_api_55001__p2061254616319"><strong id="smn_api_55001__b1855168186">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_55001__row1455838216319"><td class="cellrowborder" valign="top" width="30.366963303669635%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_55001__p3837826016319">request_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="34.97650234976503%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_55001__p2163135516319">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="34.656534346565344%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_55001__p730932216319">Request ID, which is unique</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_55001__row2689606416319"><td class="cellrowborder" valign="top" width="30.366963303669635%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_55001__p3109756416319">message_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="34.97650234976503%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_55001__p3587471616319">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="34.656534346565344%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_55001__p2017085616319">Message ID, which is unique</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="smn_api_55001__ul231175116319"><li id="smn_api_55001__li2080576416319">Example response<pre class="screen" id="smn_api_55001__screen4534080116356">{
|
|
"message_id": "bf94b63a5dfb475994d3ac34664e24f2",
|
|
"request_id": "9974c07f6d554a6d827956acbeb4be5f"
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_55001__section754533616319"><h4 class="sectiontitle">Returned Value</h4><p id="smn_api_55001__p719244316319">See section <a href="smn_api_63002.html">Returned Value</a>.</p>
|
|
</div>
|
|
<div class="section" id="smn_api_55001__section73211020122511"><h4 class="sectiontitle">Error Code</h4><p id="smn_api_55001__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_55000.html">SMS Message Operations</a></div>
|
|
</div>
|
|
</div>
|
|
|