api reference - huawei1.5 concepts account an account is created upon successful registration. the...
TRANSCRIPT
Simple Message Notification
API Reference
Issue 01
Date 2020-09-30
HUAWEI TECHNOLOGIES CO., LTD.
Copyright © Huawei Technologies Co., Ltd. 2020. All rights reserved.
No part of this document may be reproduced or transmitted in any form or by any means without priorwritten consent of Huawei Technologies Co., Ltd. Trademarks and Permissions
and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei andthe customer. All or part of the products, services and features described in this document may not bewithin the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,information, and recommendations in this document are provided "AS IS" without warranties, guaranteesor representations of any kind, either express or implied.
The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. i
Contents
1 Before You Start....................................................................................................................... 11.1 Overview.................................................................................................................................................................................... 11.2 API Calling..................................................................................................................................................................................11.3 Endpoints....................................................................................................................................................................................11.4 Notes and Constraints........................................................................................................................................................... 11.5 Concepts..................................................................................................................................................................................... 2
2 API Overview............................................................................................................................ 4
3 Calling APIs............................................................................................................................... 53.1 Making an API Request......................................................................................................................................................... 53.2 Authentication.......................................................................................................................................................................... 93.3 Response.................................................................................................................................................................................. 11
4 Getting Started...................................................................................................................... 13
5 APIs........................................................................................................................................... 155.1 Topic Operations................................................................................................................................................................... 155.1.1 Creating a Topic................................................................................................................................................................. 155.1.2 Updating a Topic................................................................................................................................................................175.1.3 Deleting a Topic................................................................................................................................................................. 185.1.4 Querying Topics..................................................................................................................................................................195.1.5 Querying Details of a Topic........................................................................................................................................... 215.1.6 Querying a Topic Policy................................................................................................................................................... 235.1.7 Updating a Topic Policy................................................................................................................................................... 255.1.8 Deleting a Specified Topic Policy................................................................................................................................. 285.1.9 Deleting All Topic Policies...............................................................................................................................................305.2 Subscription Operations..................................................................................................................................................... 315.2.1 Querying Subscriptions....................................................................................................................................................315.2.2 Querying Subscriptions of a Specified Topic............................................................................................................ 335.2.3 Adding a Subscription...................................................................................................................................................... 365.2.4 Deleting a Subscription................................................................................................................................................... 395.3 Template Operation............................................................................................................................................................. 405.3.1 Creating a Message Template.......................................................................................................................................405.3.2 Modifying a Message Template .................................................................................................................................. 425.3.3 Deleting a Message Template.......................................................................................................................................43
Simple Message NotificationAPI Reference Contents
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. ii
5.3.4 Querying Message Templates....................................................................................................................................... 445.3.5 Querying the Details of a Message Template......................................................................................................... 485.4 Message Publishing.............................................................................................................................................................. 505.4.1 Publishing Messages in the Text Format...................................................................................................................505.4.2 Publishing Messages Using a Message Structure.................................................................................................. 525.4.3 Publishing Messages Using a Template.....................................................................................................................555.5 Resource Tag Operations................................................................................................................................................... 585.5.1 Querying Resources by Tag............................................................................................................................................ 585.5.2 Adding or Deleting Resource Tags in Batches......................................................................................................... 655.5.3 Adding a Resource Tag.................................................................................................................................................... 685.5.4 Deleting a Resource Tag................................................................................................................................................. 705.5.5 Querying Resource Tags.................................................................................................................................................. 735.5.6 Querying Tags in a Specified Project.......................................................................................................................... 765.6 Application Operations....................................................................................................................................................... 775.6.1 Creating a Platform Application...................................................................................................................................775.6.2 Updating a Platform Application................................................................................................................................. 805.6.3 Deleting a Platform Application...................................................................................................................................815.6.4 Querying Platform Applications................................................................................................................................... 825.6.5 Querying Application Attributes...................................................................................................................................855.7 Application Endpoint Operations.................................................................................................................................... 865.7.1 Adding an Application Endpoint.................................................................................................................................. 875.7.2 Updating Application Endpoint Attributes............................................................................................................... 885.7.3 Deleting an Application Endpoint................................................................................................................................905.7.4 Querying the Endpoint List of an Application......................................................................................................... 915.7.5 Querying Application Endpoint Attributes................................................................................................................935.8 Direct Application Messaging........................................................................................................................................... 955.8.1 Sending an Application Message................................................................................................................................. 955.8.2 Sending an Application Message Using a Message Structure...........................................................................975.9 Version Querying................................................................................................................................................................ 1005.9.1 Listing All SMN API Versions.......................................................................................................................................1005.9.2 Querying the SMN API v2 Version............................................................................................................................ 102
6 Public Parameters............................................................................................................... 1056.1 Application Message Format.......................................................................................................................................... 1056.2 General Request Return Code........................................................................................................................................ 1066.2.1 Exception Response........................................................................................................................................................ 1066.2.2 Returned Value................................................................................................................................................................ 1076.3 Error Codes........................................................................................................................................................................... 1086.4 Obtaining a Project ID...................................................................................................................................................... 123
A Appendix............................................................................................................................... 125A.1 Topic Attribute List............................................................................................................................................................ 125A.2 SMS Message Delivery Status (CMPP)....................................................................................................................... 125A.3 Country/Region Code........................................................................................................................................................126
Simple Message NotificationAPI Reference Contents
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. iii
B Change History.................................................................................................................... 134
Simple Message NotificationAPI Reference Contents
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. iv
1 Before You Start
1.1 OverviewWelcome to the Simple Message Notification API Reference. Simple MessageNotification (SMN) is a reliable and flexible large-scale message notificationservice. It enables you to efficiently send messages to phone numbers, emailaddresses and HTTP/HTTPS servers and connect cloud services throughnotifications, reducing system complexity.
This document describes how to use application programming interfaces (APIs) toperform operations in SMN, such as creating, querying, deleting, and updatingresources. For details about all supported operations, see API Overview.
Before you use SMN by calling APIs, please get yourself familiar with basic SMNconcepts. For details, see Service Overview.
1.2 API CallingSMN supports Representational State Transfer (REST) APIs, allowing you to callAPIs using HTTPS. For details, see Calling APIs.
1.3 EndpointsAn endpoint is the request address for calling an API. Endpoints vary dependingon services and regions. For the endpoints of IMS, see Regions and Endpoints.
1.4 Notes and Constraints● The number of SMN resources you can create is determined by quota. To view
or increase the quota, see Quota Adjustment.● For more details, see the constraints described in each API.
Simple Message NotificationAPI Reference 1 Before You Start
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 1
1.5 Concepts● Account
An account is created upon successful registration. The account has full accesspermissions for all of its cloud services and resources. It can be used to resetuser passwords and grant user permissions. The account is a payment entity,which should not be used directly to perform routine management. To ensureaccount security, create Identity and Access Management (IAM) users andgrant them permissions for routine management.
● UserAn IAM user is created by an account in IAM to use cloud services. Each IAMuser has its own identity credentials (password and access keys).You can view the account ID and IAM user ID on the My Credentials page ofthe management console. API authentication requires information such as theaccount name, username, and password.
● RegionRegions are divided based on geographical location and network latency.Public services, such as Elastic Cloud Server (ECS), Elastic Volume Service(EVS), Object Storage Service (OBS), Virtual Private Cloud (VPC), Elastic IP(EIP), and Image Management Service (IMS), are shared within the sameregion. Regions are classified into universal regions and dedicated regions. Auniversal region provides universal cloud services for common tenants. Adedicated region provides specific services for specific tenants.For details, see Region and AZ.
● AZAn AZ comprises of one or more physical data centers equipped withindependent ventilation, fire, water, and electricity facilities. Computing,network, storage, and other resources in an AZ are logically divided intomultiple clusters. AZs within a region are interconnected using high-speedoptical fibers to allow you to build cross-AZ high-availability systems.
● ProjectA project corresponds to a region. Default projects are defined to a group andhave physically isolated resources (including computing, storage, and networkresources) across regions. Users can be granted permissions in a defaultproject to access all resources in the region under their accounts. If you needmore refined access control, create subprojects under a default project andcreate resources in subprojects. Then you can assign users the permissionsrequired to access only the resources in the specific subprojects.
Simple Message NotificationAPI Reference 1 Before You Start
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 2
Figure 1-1 Project isolation model
To view a project ID, go to the My Credentials page.● Enterprise project
Enterprise projects group and manage resources across regions. Resources indifferent enterprise projects are logically isolated. An enterprise project cancontain resources of multiple regions, and resources can be added to orremoved from enterprise projects.For details about enterprise projects and about how to obtain enterpriseproject IDs, see Enterprise Management User Guide.
Simple Message NotificationAPI Reference 1 Before You Start
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 3
2 API Overview
By calling SMN APIs, you can use all functions provided by SMN, for example,creating a topic and adding a subscription.
Table 2-1 API description
Category Description
Topic operations Create, modify, and delete topics.
Subscriptionoperations
Query the subscription list, add and delete subscriptions.
Templateoperations
Create, modify, and delete message templates.
Messagepublishing
Publish messages in the different formats, including text,JSON, and message template.
Resource tagoperations
Query resources by tag, add resource tags, and query tags.
Version querying Query SMN API versions and information about the SMNAPI v2 version.
Applicationoperations
Create, modify, and delete applications.
Applicationendpointoperations
Create, modify, and delete application endpoints.
Applicationmessage sending
Publish application messages and use a message structureto send messages.
Simple Message NotificationAPI Reference 2 API Overview
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 4
3 Calling APIs
3.1 Making an API RequestThis section describes the structure of a REST API request, and uses the IAM APIfor obtaining a user token as an example to demonstrate how to call an API. Theobtained token can then be used to authenticate the calling of other APIs.
Request URIA request URI is in the following format:
{URI-scheme}://{Endpoint}/{resource-path}?{query-string}
Although a request URI is included in the request header, most programminglanguages or frameworks require the request URI to be transmitted separately.
Table 3-1 URI parameter description
Parameter Description
URI-scheme Protocol used to transmit requests. All APIs use HTTPS.
Endpoint Domain name or IP address of the server bearing the RESTservice. The endpoint varies between services in differentregions. It can be obtained from Regions and Endpoints.For example, the endpoint of IAM in the CN North-Beijing1region is iam.cn-north-1.myhuaweicloud.com.
resource-path Access path of an API for performing a specified operation.Obtain the path from the URI of an API. For example, theresource-path of the API used to obtain a user token is /v3/auth/tokens.
Simple Message NotificationAPI Reference 3 Calling APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 5
Parameter Description
query-string Query parameter, which is optional. Ensure that a questionmark (?) is included before each query parameter that is in theformat of "Parameter name=Parameter value". For example, ?limit=10 indicates that a maximum of 10 data records will bedisplayed.
For example, to obtain an IAM token in the CN North-Beijing1 region, obtain theendpoint of IAM (iam.cn-north-1.myhuaweicloud.com) for this region and theresource-path (/v3/auth/tokens) in the URI of the API used to obtain a usertoken. Then, construct the URI as follows:
https://iam.cn-north-1.myhuaweicloud.com/v3/auth/tokens
Figure 3-1 Example URI
NO TE
To simplify the URI display in this document, each API is provided only with a resource-path and a request method. The URI-scheme of all APIs is HTTPS, and the endpoints of allAPIs in the same region are identical.
Request Methods
The HTTP protocol defines the following request methods that can be used tosend a request to the server.
Table 3-2 HTTP methods
Method Description
GET Requests the server to return specified resources.
PUT Requests the server to update specified resources.
POST Requests the server to add resources or perform specialoperations.
DELETE Requests the server to delete specified resources, forexample, an object.
HEAD Same as GET except that the server must return onlythe response header.
Simple Message NotificationAPI Reference 3 Calling APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 6
Method Description
PATCH Requests the server to update partial content of aspecified resource.If the resource does not exist, a new resource will becreated.
For example, in the case of the API used to obtain a user token, the requestmethod is POST. The request is as follows:
POST https://iam.cn-north-1.myhuaweicloud.com/v3/auth/tokens
Request Header
You can also add additional header fields to a request, such as the fields requiredby a specified URI or HTTP method. For example, to request for the authenticationinformation, add Content-Type, which specifies the request body type.
Common request header fields are as follows.
Table 3-3 Common request header fields
Parameter Description Mandatory Example Value
Host Specifies the serverdomain name and portnumber of the resourcesbeing requested. Thevalue can be obtainedfrom the URL of theservice API. The value isin the format ofHostname:Port number.If the port number is notspecified, the defaultport is used. The defaultport number for https is443.
NoThis field ismandatory forAK/SKauthentication.
code.test.comorcode.test.com:443
Content-Type Specifies the type (orformat) of the messagebody. The default valueapplication/json isrecommended. Othervalues of this field will beprovided for specific APIsif any.
Yes application/json
Content-Length
Specifies the length ofthe request body. Theunit is byte.
No 3495
Simple Message NotificationAPI Reference 3 Calling APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 7
Parameter Description Mandatory Example Value
X-Project-Id Specifies the project ID.Obtain the project ID byfollowing the instructionsin Obtaining a ProjectID.
NoThis field ismandatory forrequests thatuse AK/SKauthenticationin the DedicatedCloud (DeC)scenario ormulti-projectscenario.
e9993fc787d94b6c886cbaa340f9c0f4
X-Auth-Token Specifies a user token.It is a response to the APIfor obtaining a usertoken (only this API doesnot requireauthentication).After the request isprocessed, the value ofX-Subject-Token in theresponse header is thetoken value.
NoThis field ismandatory fortokenauthentication.
The following ispart of anexample token:MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ
NO TE
In addition to supporting authentication using tokens, APIs support authentication usingAK/SK, which uses SDKs to sign a request. During the signature, the Authorization(signature authentication) and X-Sdk-Date (time when a request is sent) headers areautomatically added in the request.For more details, see "Authentication Using AK/SK" in Authentication.
The API used to obtain a user token does not require authentication. Therefore,only the Content-Type field needs to be added to requests for calling the API. Anexample of such requests is as follows:
POST https://iam.cn-north-1.myhuaweicloud.com/v3/auth/tokensContent-Type: application/json
(Optional) Request BodyThis part is optional. The body of a request is often sent in a structured format asspecified in the Content-Type header field. The request body transfers contentexcept the request header.
The request body varies between APIs. Some APIs do not require the request body,such as the APIs requested using the GET and DELETE methods.
In the case of the API used to obtain a user token, the request parameters andparameter description can be obtained from the API request. The followingprovides an example request with a body included. Replace username,
Simple Message NotificationAPI Reference 3 Calling APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 8
domainname, ******** (login password), and xxxxxxxxxxxxxxxxxx (project name)with the actual values. Obtain a project name from Regions and Endpoints.
NO TE
The scope parameter specifies where a token takes effect. You can set scope to an accountor a project under an account. In the following example, the token takes effect only for theresources in a specified project. For more information about this API, see Obtaining a UserToken.
POST https://iam.cn-north-1.myhuaweicloud.com/v3/auth/tokensContent-Type: application/json
{ "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "username", "password": "********", "domain": { "name": "domainname" } } } }, "scope": { "project": { "name": "xxxxxxxxxxxxxxxxxx" } } }}
If all data required for the API request is available, you can send the request to callthe API through curl, Postman, or coding. In the response to the API used toobtain a user token, x-subject-token is the desired user token. This token canthen be used to authenticate the calling of other APIs.
3.2 AuthenticationRequests for calling an API can be authenticated using either of the followingmethods:● Token-based authentication: Requests are authenticated using a token.● AK/SK-based authentication: Requests are authenticated by encrypting the
request body using an AK/SK pair. AK/SK-based authentication isrecommended because it is more secure than token-based authentication.
Token-based AuthenticationNO TE
The validity period of a token is 24 hours. When using a token for authentication, cache itto prevent frequently calling the IAM API used to obtain a user token.
A token specifies temporary permissions in a computer system. During APIauthentication using a token, the token is added to requests to get permissions forcalling the API.
Simple Message NotificationAPI Reference 3 Calling APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 9
You can obtain a token by calling the Obtaining User Token API. When you callthe API, set auth.scope in the request body to project.
{ "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "username", "password": "********", "domain": { "name": "domainname" } } } }, "scope": { "project": { "name": "xxxxxxxx" } } }}
After a token is obtained, the X-Auth-Token header field must be added torequests to specify the token when calling other APIs. For example, if the token isABCDEFJ...., X-Auth-Token: ABCDEFJ.... can be added to a request as follows:
POST https://iam.cn-north-1.myhuaweicloud.com/v3/auth/projectsContent-Type: application/jsonX-Auth-Token: ABCDEFJ....
AK/SK-based AuthenticationNO TE
AK/SK-based authentication supports API requests with a body not larger than 12 MB. ForAPI requests with a larger body, token-based authentication is recommended.
In AK/SK-based authentication, AK/SK is used to sign requests and the signature isthen added to the requests for authentication.
● AK: access key ID, which is a unique identifier used in conjunction with asecret access key to sign requests cryptographically.
● SK: secret access key used in conjunction with an AK to sign requestscryptographically. It identifies a request sender and prevents the request frombeing modified.
In AK/SK-based authentication, you can use an AK/SK to sign requests based onthe signature algorithm or using the signing SDK. For details about how to signrequests and use the signing SDK, see API Request Signing Guide.
NO TE
The signing SDK is only used for signing requests and is different from the SDKs providedby services.
Simple Message NotificationAPI Reference 3 Calling APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 10
3.3 Response
Status CodeAfter sending a request, you will receive a response, including a status code,response header, and response body.
A status code is a group of digits, ranging from 1xx to 5xx. It indicates the statusof a request. For more information, see Returned Value.
For example, if status code 201 is returned for calling the API used to obtain auser token, the request is successful.
Response HeaderSimilar to a request, a response also has a header, for example, Content-Type.
Figure 3-2 shows the response header fields for the API used to obtain a usertoken. The x-subject-token header field is the desired user token. This token canthen be used to authenticate the calling of other APIs.
Figure 3-2 Header fields of the response to the request for obtaining a user token
(Optional) Response BodyThe body of a response is often returned in structured format as specified in theContent-Type header field. The response body transfers content except theresponse header.
The following is part of the response body for the API used to obtain a usertoken.
{ "token": {
Simple Message NotificationAPI Reference 3 Calling APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 11
"expires_at": "2019-02-13T06:52:13.855000Z", "methods": [ "password" ], "catalog": [ { "endpoints": [ { "region_id": "az-01",......
If an error occurs during API calling, an error code and a message will bedisplayed. The following shows an error response body.
{ "error_msg": "The format of message is error", "error_code": "AS.0001"}
In the response body, error_code is an error code, and error_msg providesinformation about the error.
Simple Message NotificationAPI Reference 3 Calling APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 12
4 Getting Started
ScenariosThis topic describes how to publish a message to a topic by calling APIs.
For details about how to call APIs, see Calling APIs.
NO TE
The token obtained from IAM is valid for only 24 hours. If you want to use one token forauthentication, you can cache it to avoid frequently calling the IAM API.
Involved APIsTo use token authentication, you need to obtain a token and add X-Auth-Token tothe request header of API calls.
● IAM API to obtain a token● SMN API to create a topic● SMN API to add subscriptions● SMN API to publish messages
Procedure1. Obtain the token by referring to Authentication.2. Send a request POST https://{SMN_Endpoint}/v2/{project_id}/
notifications/topics to create a topic.
a. Add X-Auth-Token to the request header.b. Specify the following parameters in the request body:
{ "name": "test_topic_v2", // Topic name (mandatory) "display_name": "test" // Display name (optional)}
If the request is successful, a request ID (request_id) and topic URN(topic_urn) are returned.If the request fails, an error code and error information are returned. Fordetails, see Error Codes.
3. Send a request POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/{topic_urn}/subscriptions to add subscriptions.
Simple Message NotificationAPI Reference 4 Getting Started
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 13
Set topic_urn based on the response in the previous step.
a. Add X-Auth-Token to the request header.b. Specify the following parameters in the request body:
{ "protocol": "email", // Subscription protocol (mandatory) "endpoint": "[email protected]", // Email address (mandatory) "remark": "Subscription" // Description (optional)}
If the request is successful, a request ID (request_id) and subscriptionURN (subscription_urn) are returned.If the request fails, an error code and error information are returned. Fordetails, see Error Codes.
NO TE
You can add multiple subscriptions to a topic. For details, see Adding aSubscription.
c. The subscription endpoint receives a confirmation message and mustconfirm the subscription in the email.
4. Send a request POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/{topic_urn}/publish to publish a message.
a. Add X-Auth-Token to the request header.b. Specify the following parameters in the request body:
{ "subject":"test message v2", // Message subject, which is displayed in email messages (optional) "message": "Message test message v2." // Message to be published (mandatory)}
If the request is successful, a request ID (request_id) and message ID(message_id) are returned.If the request fails, an error code and error information are returned. Fordetails, see Error Codes.
NO TE
Only confirmed subscription endpoints can receive the message you publish.
Simple Message NotificationAPI Reference 4 Getting Started
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 14
5 APIs
5.1 Topic Operations
5.1.1 Creating a Topic
Description● API name
CreateTopic
● Function
Create a topic. Each user can create 3000 topics at most. In the high-concurrent scenario, a user may create a few topics more than 3000.
The API is idempotent. It returns a successful result after creating a topic. If atopic of the same name already exists, the status code is 200. Otherwise, thestatus code is 201.
URI● URI format
POST /v2/{project_id}/notifications/topics
● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
Request● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 15
Parameter Mandatory Type Description
name Yes String Name of the topic tobe createdThe topic name is astring of 1 to 255characters. It mustcontain letters, digits,hyphens (-), andunderscores (_), andmust start with a letteror digit.
display_name Yes String Topic display name,which is presented asthe name of the emailsender in emailmessagesThe display namecannot exceed 192bytes.The value is left blankby default.
● Request example
POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics{ "name": "test_topic_v2", "display_name": "testtest"}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
topic_urn String Unique resource ID of a topic. You canobtain it based on Querying Topics.
● Response example
{ "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085", "topic_urn": "urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:test_topic_v2"}
Returned ValueSee Returned Value.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 16
Error CodesSee Error Codes.
5.1.2 Updating a Topic
Description● API name
UpdateTopic● Function
Update the topic display name.
URI● URI format
PUT /v2/{project_id}/notifications/topics/{topic_urn}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
topic_urn Yes String Unique resourceID of a topic. Youcan obtain itbased onQuerying Topics.
Request● Parameter description
Parameter Mandatory Type Description
display_name Yes String Topic display name,which is presented asthe name of the emailsender in emailmessagesThe display namecannot exceed 192bytes.
● Request example
PUT https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:test_topic_v2{ "display_name": "testtest222"}
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 17
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
● Response example
{ "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085"}
Returned ValueSee Returned Value.
Error CodesSee Error Codes.
5.1.3 Deleting a Topic
Description● API name
DeleteTopic● Function
Delete a topic and its subscribers. If a topic is deleted, a pending message willfail to deliver to the topic subscribers.
URI● URI format
DELETE /v2/{project_id}/notifications/topics/{topic_urn}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
topic_urn Yes String Unique resource ID of atopic. You can obtain itbased on QueryingTopics.
RequestRequest example
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 18
DELETE https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:test_topic_v2
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
● Response example
{ "request_id": "5fcba32bd2814ea39431829c22bda94b"}
Returned ValueSee Returned Value.
Error CodesSee Error Codes.
5.1.4 Querying Topics
Description● API name
ListTopics● Function
Query the topics by page. The topics are sorted by the creation time indescending order. When querying the topics by page, you can specify offsetand limit. If no topic has been created, an empty list is returned.
URI● URI format
GET /v2/{project_id}/notifications/topics?offset={offset}&limit={limit}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 19
Parameter Mandatory Type Description
offset No Integer OffsetIf the value is aninteger greaterthan 0 but lessthan the numberof resources, allresources after thisoffset will bequeried. Thedefault value is 0.
limit No Integer ● Number ofresourcesreturned oneach page
● Value range: 1–100Commonly usedvalues are 10,20, and 50.The defaultvalue is 100.
Request
Request exampleGET https://{SMN_Endpoint}/v2/{project_id}/notifications/topics?offset=0&limit=100
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
topic_count Integer Number of topics in youraccountNOTE
No matter what offset andlimit values you have set inthe request, this parameteralways returns the totalnumber of topics.
topics Topic structure array Topic detailsSee Table 5-1.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 20
Table 5-1 Topic structure
Parameter Type Description
topic_urn String Resource identifier of a topic,which is unique
name String Topic name
display_name String Topic display name, which ispresented as the name of theemail sender in emailmessages
push_policy Integer Message push policy● 0: Failed messages will be
saved in message queues.● 1: Failed messages will be
discarded.
● Response example
{ "request_id": "70bb40bef50e4a14b116a5a527fd7432", "topic_count": 1, "topics": [ { "topic_urn": "urn:smn:regionId:8bad8a40e0f7462f8c1676e3f93a8183:test_topic_v2", "display_name": "testtest", "name": "test_topic_v1", "push_policy": 0 } ]}
Returned ValueSee Returned Value.
Error CodesSee Error Codes.
5.1.5 Querying Details of a Topic
Description● API name
QueryTopicDetail● Function
Query the detailed information about a topic.
URI● URI format
GET /v2/{project_id}/notifications/topics/{topic_urn}
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 21
● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
topic_urn Yes String Unique resource ID of atopic. You can obtain itaccording to QueryingTopics.
RequestRequest exampleGET https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId:8bad8a40e0f7462f8c1676e3f93a8183:test_create_topic_v2
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
name String Name of the topic
topic_urn String Unique resource ID of a topic. You canobtain it according to QueryingTopics.
display_name String Topic display name, which ispresented as the name of the emailsender in email messages
push_policy Integer Message pushing policy0 indicates that the message sendingfails and the message is cached in thequeue. 1 indicates that the failedmessage is discarded.
create_time String Time when the topic was createdThe UTC time is in YYYY-MM-DDTHH:MM:SSZ format.
update_time String Time when the topic was updatedThe UTC time is in YYYY-MM-DDTHH:MM:SSZ format.
● Response example
{ "update_time": "2016-08-01T02:16:38Z",
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 22
"push_policy": 0, "create_time": "2016-08-01T02:16:38Z", "name": "test_create_topic_v2", "topic_urn": "urn:smn:regionId:8bad8a40e0f7462f8c1676e3f93a8183:test_create_topic_v2", "display_name": "test create topic v2", "request_id": "6837531fd3f54550927b930180a706bf"}
Returned Value
See Returned Value.
Error Codes
See Error Codes.
5.1.6 Querying a Topic Policy
Description● API name
ListTopicAttributes
● Function
Query a topic policy.
URI● URI format
GET /v2/{project_id}/notifications/topics/{topic_urn}/attributes?name={name}
● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
topic_urn Yes String Unique resource IDof a topic. You canobtain it based onQuerying Topics.
name No String Specifies the policyname.Only specified policynames aresupported. Fordetails, see TopicAttribute List.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 23
NO TE
If name is not specified, all attribute values of the topic are queried. The supportedattribute values are provided in Topic Attribute List.
RequestRequest exampleGET https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId:8bad8a40e0f7462f8c1676e3f93a8183:test_create_topic_v2/attributes?name=access_policy
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
attributes Map Attribute key-value pairaccess_policy: topicaccess policyintroduction: descriptionof a topic
● Response example
{ "request_id": "6837531fd3f54550927b930180a706bf", "attributes": { "access_policy": "{ "Version": "2016-09-07", "Id": "__default_policy_ID", "Statement": [ { "Sid": "__user_pub_0", "Effect": "Allow", "Principal": { "CSP": [ "urn:csp:iam::93dc1b4697ac493d9b7d089569f86b32:root" ] }, "Action": ["SMN:Publish","SMN:QueryTopicDetail"], "Resource": "urn:smn:regionId:8bad8a40e0f7462f8c1676e3f93a8183:aaa" }, { "Sid": "__service_pub_0", "Effect": "Allow", "Principal": { "Service": ["obs"] }, "Action": ["SMN:Publish","SMN:QueryTopicDetail"], "Resource": "urn:smn:regionId:8bad8a40e0f7462f8c1676e3f93a8183:aaa" } ] }" } }
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 24
NO TE
The value of access_policy is a JSON character string, which requires escapecharacters. While in the preceding example, the characters are not escaped. You needto escape them before using the policy.
Returned Value
See Returned Value.
Error Codes
See Error Codes.
5.1.7 Updating a Topic Policy
Description● API name
UpdateTopicAttribute● Function
Update a topic policy.
URI● URI format
PUT /v2/{project_id}/notifications/topics/{topic_urn}/attributes/{name}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
topic_urn Yes String Unique resource IDof a topic. You canobtain it based onQuerying Topics.
name Yes String Specifies the policyname.Only specified policynames are supported.For details, see TopicAttribute List.
Request● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 25
Parameter Mandatory Type Description
value Yes String Topic attribute valueThe value cannot exceed30 KB. For details, seeTable 5-2.
Table 5-2 Topic attribute values
Name Description Restriction
Version Policy specification version Currently, only2016-09-07 issupported.
Id Policy ID, which uniquelyidentifies a policy
The value cannot beempty.
Statement Statements used to configure atopic policy. Each topic policymay contain one or morestatements. You can usestatements to grant topicpermissions to other users orcloud services.
A policy must containat least one statement.For details aboutelements in astatement, see Table5-3.
Table 5-3 Statement elements description
Element Description Restriction
Sid Statement ID The statement ID must be unique,for example, statement01 orstatement02.
Effect Statement effect The value can be Allow or Deny.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 26
Element Description Restriction
PrincipalNotPrincipal
● Principal: object towhich the statementapplies
● NotPrincipal: objectto which thestatement does notapplyThere are currentlytwo supportedvalues:– CSP: one or more
cloud users– Service: one or
more cloudservices
Either the Principal or NotPrincipalelement must be configured.● If you enter CSP, you must
specify user information in theformaturn:csp:iam::domainId:root. Youneed to obtain the account ID ofeach user you specify.
● If you enter Service, you mustspecify the cloud service names inlower case.
ActionNotAction
● Action: allowedstatement action
● NotAction:statement actionnot allowedYou can use awildcard characterto configure a set ofactions, forexample,SMN:Update* andSMN:Delete*. If youonly enter awildcard character(*) in a statement,all supportedactions are allowed.
Either the Action or NotActionelement must be configured.The following actions are supported:● SMN:UpdateTopic● SMN:DeleteTopic● SMN:QueryTopicDetail● SMN:ListTopicAttributes● SMN:UpdateTopicAttribute● SMN:DeleteTopicAttributes● SMN:DeleteTopicAttributeBy-
Name● SMN:ListSubscriptionsByTopic● SMN:Subscribe● SMN:Unsubscribe● SMN:Publish
ResourceNotResource
● Resource: topic towhich a statementapplies
● NotResource: topicto which astatement does notapply
Either the Resource or NotResourceelement must be configured.You need to enter a topic URN.
● Example requestPUT https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/{topic_urn}/attributes/access_policy{ "value": "{ \"Version\": \"2016-09-07\", \"Id\": \"__default_policy_ID\", \"Statement\": [
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 27
{ \"Sid\": \"__user_pub_0\", \"Effect\": \"Allow\", \"Principal\": { \"CSP\": [ \"urn:csp:iam::{domainID}:root\" ] }, \"Action\": [\"SMN:Publish\",\"SMN:QueryTopicDetail\"], \"Resource\": \"{topic_urn}\" }, { \"Sid\": \"__service_pub_0\", \"Effect\": \"Allow\", \"Principal\": { \"Service\": [\"obs\"] }, \"Action\": [\"SMN:Publish\",\"SMN:QueryTopicDetail\"], \"Resource\": \"{topic_urn}\" } ] }" }
NO TE
You need to replace {project_id}, {domainID}, and {topic_urn} with the actual values.domainID indicates the user's account ID. To obtain it, log in to the SMN console, clickMy Credentials in the username drop-down list on the upper right.
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
● Example response
{ "request_id":"6837531fd3f54550927b930180a706bf"}
Returned ValueSee Returned Value.
Error CodesSee Error Codes.
5.1.8 Deleting a Specified Topic Policy
Description● API name
DeleteTopicAttributeByName● Function
Delete a specified topic policy.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 28
URI● URI format
DELETE /v2/{project_id}/notifications/topics/{topic_urn}/attributes/{name}
● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
topic_urn Yes String Unique resource ID ofa topic. You canobtain it based onQuerying Topics.
name Yes String Attribute nameOnly specifiedattribute names aresupported. For details,see Topic AttributeList.
Request
Example requestDELETE https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/{topic_urn}/attributes/access_policy
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
● Example response{ "request_id": "6837531fd3f54550927b930180a706bf"}
Returned Value
See Returned Value.
Error Codes
See Error Codes.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 29
5.1.9 Deleting All Topic Policies
Description● API name
DeleteTopicAttributes● Function
Delete all topic policies.
URI● URI format
DELETE /v2/{project_id}/notifications/topics/{topic_urn}/attributes● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a Project ID.
topic_urn Yes String Unique resource ID of atopic. You can obtain itaccording to QueryingTopics.
RequestExample requestDELETE https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/{topic_urn}/attributes
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
● Example response
{ "request_id": "6837531fd3f54550927b930180a706bf"}
Returned ValueSee Returned Value.
Error CodesSee Error Codes.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 30
5.2 Subscription Operations
5.2.1 Querying Subscriptions
Description● API name
ListSubscriptions● Function
Query the list of all subscriptions by page. The list is sorted by thesubscription adding time in ascending order. When querying the subscriptionlist by page, you can specify offset and limit. If no subscription has beenadded to the topic, an empty list is returned.
URI● URI format
GET /v2/{project_id}/notifications/subscriptions?offset={offset}&limit={limit}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
offset No Integer OffsetIf the value is an integergreater than 0 but lessthan the number ofresources, all resourcesafter this offset will bequeried. The default valueis 0.
limit No Integer ● Value range: 1–100Commonly used valuesare 10, 20, and 50.
● Number of resourcesreturned on each page
The default value is 100.
Request
Example requestGET https://{SMN_Endpoint}/v2/{project_id}/notifications/subscriptions?offset=0&limit=2
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 31
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
subscription_count Integer Number of subscriptions
subscriptions Subscriptionstructure array
See Table 5-4.
Table 5-4 Subscription structure
Parameter Type Description
topic_urn String Resource identifier of atopic, which is unique
protocol String Subscription protocol(Different protocols indicatedifferent types of endpointsto receive messages.)Currently, the followingprotocols are supported:● email: The endpoints are
email address.● sms: The endpoints are
phone numbers.● functionstage: The
endpoints areFunctionGraph functions.
● functiongraph: Theendpoints areFunctionGraph workflowsorchestrated by a groupof functions.
● http and https: Theendpoints are URLs.
subscription_urn String Resource identifier of asubscription, which is unique
owner String Project ID of the topiccreator
endpoint String Message receiving endpoint
remark String Remarks
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 32
Parameter Type Description
status Integer Subscription status● 0: unconfirmed● 1: confirmed● 3: canceled
● Example response
{ "request_id": "4650b14bf221492fb819c231d167e6fe", "subscription_count": 2, "subscriptions": [ { "topic_urn": "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1", "protocol": "sms", "subscription_urn": "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1:2e778e84408e44058e6cbc6d3c377837", "owner": "762bdb3251034f268af0e395c53ea09b", "endpoint": "xxxxxxxxxxx", "remark": "", "status": 0 }, { "topic_urn": "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1", "protocol": "email", "subscription_urn": "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1:a2d52a9f5c3b47f48c3fafb177a58796", "owner": "762bdb3251034f268af0e395c53ea09b", "endpoint": "[email protected]", "remark": "", "status": 0 }] }
Returned ValueSee Returned Value.
Error CodesSee Error Codes.
5.2.2 Querying Subscriptions of a Specified Topic
Description● API name
ListSubscriptionsByTopic● Function
Query the list of subscriptions of a specified topic by page. The list is sortedby the subscription adding time in ascending order. You can specify offset andlimit. If no subscription has been added to the topic, an empty list is returned.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 33
URI● URI format
GET /v2/{project_id}/notifications/topics/{topic_urn}/subscriptions?offset={offset}&limit={limit}
● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
topic_urn Yes String Unique resource ID of atopic. You can obtain itaccording to QueryingTopics.
offset No Integer OffsetIf the value is an integergreater than 0 but lessthan the number ofresources, all resourcesafter this offset will bequeried. The defaultvalue is 0.
limit No Integer ● Number of resourcesreturned on each page
● Value range: 1–100Commonly usedvalues are 10, 20, and50.The default value is100.
RequestExample requestGET https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1/subscriptions?offset=0&limit=100
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
subscription_count Integer Number ofsubscriptions
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 34
Parameter Type Description
subscriptions Subscription structure array For details, see Table5-5.
Table 5-5 Subscription structure
Parameter Type Description
topic_urn String Resource identifier of atopic, which is unique
protocol String Subscription protocol(Different protocols indicatedifferent types of endpointsto receive messages.)Currently, the followingprotocols are supported:● email: The endpoints are
email address.● sms: The endpoints are
phone numbers.● functionstage: The
endpoints areFunctionGraph functions.
● functiongraph: Theendpoints areFunctionGraph workflowsorchestrated by a groupof functions.
● http and https: Theendpoints are URLs.
subscription_urn String Resource identifier of asubscription, which is unique
owner String Project ID of the topiccreator
endpoint String Message receiving endpoint
remark String Remarks
status Integer Subscription status● 0: unconfirmed● 1: confirmed● 3: canceled
● Example response
{ "request_id": "4650b14bf221492fb819c231d167e6fe",
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 35
"subscription_count": 2, "subscriptions": [ { "topic_urn": "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1", "protocol": "sms", "subscription_urn": "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1:2e778e84408e44058e6cbc6d3c377837", "owner": "762bdb3251034f268af0e395c53ea09b", "endpoint": "xxxxxxxxxx", "remark": "", "status": 0 }, { "topic_urn": "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1", "protocol": "email", "subscription_urn": "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1:a2d52a9f5c3b47f48c3fafb177a58796", "owner": "762bdb3251034f268af0e395c53ea09b", "endpoint": "[email protected]", "remark": "", "status": 0 }] }
Returned Value
See Returned Value.
Error Codes
See Error Codes.
5.2.3 Adding a Subscription
Description● API name
Subscribe
● Function
Add a subscription to a specified topic. If the status of the subscription isunconfirmed, a confirmation message is sent to the subscriber. Afterconfirming the subscription, the subscriber can receive notification messagespublished to the topic.
By default, 10000 subscriptions can be added to a topic. However, in a high-concurrency scenario, which is rare, extra subscriptions may be addedsuccessfully.
The API is idempotent. If the added subscription already exists, a successfulresult and status code 200 are returned. Otherwise, the status code is 201.
URI● URI format
POST /v2/{project_id}/notifications/topics/{topic_urn}/subscriptions
● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 36
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
topic_urn Yes String Unique resource ID ofa topic. You canobtain it according toQuerying Topics.
Request● Parameter description
Parameter Mandatory Type Description
endpoint Yes String Message endpointNOTE
For an HTTP subscription,the endpoint starts withhttp://.For an HTTPS subscription,the endpoint starts withhttps://.For an email subscription,the endpoint is an emailaddress.For an SMS subscription,the endpoint is a phonenumber.For a FunctionStagesubscription, the endpointis a function.For a FunctionGraphsubscription, the endpointis a function flow.For a DMS subscription, theendpoint is a messagequeue.For an applicationsubscription, the endpointis a mobile device added toa platform application.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 37
Parameter Mandatory Type Description
protocol Yes String Subscription protocol(Different protocolsindicate different typesof endpoints to receivemessages.)Currently, the followingprotocols are supported:● email: The endpoints
are email address.● sms: The endpoints
are phone numbers.● functionstage: The
endpoints areFunctionGraphfunctions.
● functiongraph: Theendpoints areFunctionGraphworkflowsorchestrated by agroup of functions.
● http and https: Theendpoints are URLs.
remark No String Description of thesubscriptionThe remarks must be aUTF-8-coded characterstring containing 128bytes at most.
● Example request
POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1/subscriptions{ "protocol": "email", "endpoint": "[email protected]", "remark": "O&M"}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
subscription_urn String Resource identifier of asubscription, which is unique
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 38
● Example response{ "request_id": "fdbabe38ead6482b8574f82a3d1168e9", "subscription_urn": "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1:2e778e84408e44058e6cbc6d3c377837"}
Returned ValueSee section Returned Value.
Error CodeSee section Error Codes.
5.2.4 Deleting a Subscription
Description● API name
Unsubscribe● Function
Delete a specified subscription.
URI● URI format
DELETE /v2/{project_id}/notifications/subscriptions/{subscription_urn}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
subscription_urn Yes String Unique resourceID of a topic. Youcan obtain itaccording toQueryingSubscriptions.
RequestRequest exampleDELETE https://{SMN_Endpoint}/v2/{project_id}/notifications/subscriptions/urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1:2e778e84408e44058e6cbc6d3c377837
Response● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 39
Parameter Type Description
request_id String Request ID, which isunique
● Response example
{ "request_id": "f3197b274a6b473a8007eed79e716c30"}
Returned ValueSee section Returned Value.
Error CodeSee section Error Codes.
5.3 Template Operation
5.3.1 Creating a Message Template
Description● API name
CreateMessageTemplate● Function
Create a message template for quick message sending to reduce the requestdata volume.By default, a user can create a maximum of 100 message templates. However,in a high-concurrency scenario, which is rare, extra templates may besuccessfully created.
URI● URI format
POST /v2/{project_id}/notifications/message_template● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
Request● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 40
Parameter Mandatory Type Description
message_template_name
Yes String Template nameThe template nameis a string of 1 to 64characters. It mustcontain upper- orlower-case letters,digits, hyphens (-),and underscores (_),and must start witha letter or digit.
content Yes String Template content,which currentlysupports plain textonlyThe template contentcannot be left blankor larger than 256KB.
protocol No String Protocol supportedby the templateCurrently, thefollowing protocolsare supported:● email● default● sms● functionstage
(FunctionGraphfunction)
● functiongraph(FunctionGraphworkflow)
● dms● http and https
● Example requestPOST https://{SMN_Endpoint}/v2/{project_id}/notifications/message_template{ "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.)"}
Response● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 41
Parameter Type Description
request_id String Request ID, which isunique
message_template_id String Resource identifier of thetemplate, which is unique
● Example response{ "request_id": "ca03efa691624d8eb2dfeba01a1bcf6e", "message_template_id": "57ba8dcecda844878c5dd5815b65d10f"}
Returned Value
See section Returned Value.
Error Code
See section Error Codes.
5.3.2 Modifying a Message Template
Description● API name
UpdateMessageTemplate
● Function
Modify the message template content.
URI● URI format
PUT /v2/{project_id}/notifications/message_template/{message_template_id}
● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
message_template_id
Yes String Unique resource IDof a topic. You canobtain it accordingto QueryingMessageTemplates.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 42
Request● Parameter description
Parameter Mandatory Type Description
content Yes String Template content,which currentlysupports plain textonlyThe template contentcannot be left blankor larger than 256 KB.
● Request examplePUT https://{SMN_Endpoint}/v2/{project_id}/notifications/message_template/b3ffa2cdda574168826316f0628f774f{ "content": "(1/22)You are invited to subscribe to topic({topic_id_id1}). Click the following URL to confirm subscription:(If you do not want to subscribe to this topic, ignore this message.)"}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
● Response example{ "request_id": "5fcba32bd2814ea39431829c22bda94b"}
Returned Value
See section Returned Value.
Error Code
See section Error Codes.
5.3.3 Deleting a Message Template
Description● API name
DeleteMessageTemplate
● Function
Delete a message template. After you delete the template, you cannot use itto publish messages any more.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 43
URI● URI format
DELETE /v2/{project_id}/notifications/message_template/{message_template_id}
● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
message_template_id
Yes String Unique resource ID of atopic. You can obtain itaccording to QueryingMessage Templates.
Request
Request exampleDELETE https://{SMN_Endpoint}/v2/{project_id}/notifications/message_template/b3ffa2cdda574168826316f0628f774e
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
● Response example
{ "request_id": "5fcba32bd2814ea39431829c22bda94b" }
Returned Value
See section Returned Value.
Error Code
See section Error Codes.
5.3.4 Querying Message Templates
Description● API name
ListMessageTemplates
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 44
● FunctionQuery the template list by page. The list is sorted by the template creationtime in ascending order. You can specify offset and limit. If no template hasbeen created, an empty list is returned. The parametersmessage_template_name and protocol are added.
NO TE
The template list provides only brief information. To query the template details, seeQuerying the Details of a Message Template.
URI● URI format
GET /v2/{project_id}/notifications/message_template?offset={offset}&limit={limit}&message_template_name={message_template_name}&protocol={protocol}
● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
offset No Integer OffsetIf the value is aninteger greater than0 but less than thenumber of resources,all resources afterthis offset will bequeried. The defaultvalue is 0.
limit No Integer ● Number ofresources returnedon each page
● Value range: 1–100Commonly usedvalues are 10, 20,and 50.The default valueis 100.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 45
Parameter Mandatory Type Description
message_template_name
No String Template nameThe template nameis a string of 1 to 64characters. It mustcontain upper- orlower-case letters,digits, hyphens (-),and underscores (_),and must start with aletter or digit.
protocol No String Protocol supportedby the templateCurrently, thefollowing protocolsare supported:● email● default● sms● functionstage
(FunctionGraphfunction)
● functiongraph(FunctionGraphworkflow)
● dms● http and https
RequestRequest exampleGET https://{SMN_Endpoint}/v2/{project_id}/notifications/message_template?offset=0&limit=2&message_template_name=test1&protocol=email
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
message_template_count String Number of returnedtemplates
message_templates Messagetemplatestructure array
For details, see Table 5-6.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 46
Table 5-6 Message template structure
Parameter Type Description
message_template_id String Template ID
message_template_name
String Template name
protocol String Protocol supported by thetemplateCurrently, the followingprotocols are supported:● email● default● sms● functionstage
(FunctionGraph function)● functiongraph
(FunctionGraph workflow)● dms● http and https
tag_names String array Template variable list
create_time String Time when the template wascreatedThe UTC time is in YYYY-MM-DDTHH:MM:SSZ format.
update_time String Last time when the templatewas updatedThe UTC time is in YYYY-MM-DDTHH:MM:SSZ format.
● Response example
{ "message_templates":[ { "message_template_name": "confirm_message", "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"
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 47
}, { "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}
Returned ValueSee Returned Value.
Error CodesSee Error Codes.
5.3.5 Querying the Details of a Message Template
Description● API name
QueryMessageTemplateDetail● Function
Query the template details, including the template content.
URI● URI format
GET /v2/{project_id}/notifications/message_template/{message_template_id}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
message_template_id
Yes String Unique resource ID of atopic. You can obtain itaccording to QueryingMessage Templates.
RequestExample requestGET https://{SMN_Endpoint}/v2/{project_id}/notifications/message_template/57ba8dcecda844878c5dd5815b65d10f
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 48
Response● Parameter description
Parameter Type Description
message_template_id
String Template ID
message_template_name
String Template name
protocol String Protocol supported by thetemplateCurrently, the followingprotocols are supported:● email● default● sms● functionstage
(FunctionGraph function)● functiongraph
(FunctionGraph workflow)● dms● http and https
tag_names String Variable listThe variable name will bequoted in braces ({}) in thetemplate. When you use atemplate to send messages,you can replace the variablewith any content.
create_time String Time when the template wascreatedThe UTC time is in YYYY-MM-DDTHH:MM:SSZ format.
update_time String Last time when the templatewas updatedThe UTC time is in YYYY-MM-DDTHH:MM:SSZ format.
content String Template content
request_id String Request ID, which is unique
● Example response
{ "message_template_name": "confirm_message", "protocol": "https", "update_time": "2016-08-02T08:22:25Z",
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 49
"create_time": "2016-08-02T08:22:20Z", "request_id": "ba79ca8f794f4f50985ce7b98a401b47", "tag_names": [ "topic_id_id4" ], "content": "(1/24)You are invited to subscribe to topic({topic_id_id4}). Click the following URL to confirm subscription:(If you do not want to subscribe to this topic, ignore this message.)", "message_template_id": "57ba8dcecda844878c5dd5815b65d10f"}
Returned Value
See section Returned Value.
Error Code
See section Error Codes.
5.4 Message Publishing
5.4.1 Publishing Messages in the Text Format
Description● API name
Publish● Function
Publish messages in the text format to a topic. After the message ID isreturned, the message has been saved and is to be pushed to the subscribersof the topic.
URI● URI format
POST /v2/{project_id}/notifications/topics/{topic_urn}/publish● Parameter description
Parameter
Mandatory Type Description
project_id Yes String Project IDSee Obtaining a Project ID.
topic_urn Yes String Unique resource ID of a topic. Youcan obtain it according toQuerying Topics.
Request● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 50
Parameter Mandatory Type Description
subject Yes String Message subject, which isused as the email subjectwhen you publish emailmessages. The valuecannot exceed 512characters.
message No String Message contentThe message content is aUTF-8-coded characterstring of no more than256 KB. For SMSsubscribers, the contentcannot contain squarebrackets ([ ]). It must notexceed 490 bytes, or thesystem will cut it off andnot send the extra part.For applicationsubscribers, messagesmust comply with formatrequirements of themobile push platform. Fordetails, see ApplicationMessage Format.Otherwise, the mobile appwill fail to receivemessages. Currently, theHMS, APNS, andAPNS_SANDBOX mobilepush platforms aresupported.
time_to_live
No String Specifies the maximumretention period of amessage in SMN.After the retention periodexpires, SMN does notsend this message. Thetime period is measuredin seconds, and thedefault TTL is 3600s (onehour).The value must be apositive integer less thanor equal to 604,800 (3600x 24 x 7).
● Example request
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 51
POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId: f96188c7ccaf4ffba0c9aa149ab2bd57:test_create_topic_v2/publish{ "subject": "test message v2", "message": "Message test message v2", "time_to_live": "3600"}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
message_id String Message ID, which is unique
● Example response
{ "message_id": "bf94b63a5dfb475994d3ac34664e24f2", "request_id": "9974c07f6d554a6d827956acbeb4be5f"}
Returned ValueSee Returned Value.
Error CodesSee Error Codes.
5.4.2 Publishing Messages Using a Message Structure
Description● API name
Publish● Function
Use the message structure to publish a message to the topic. After themessage ID is returned, the message has been saved and is to be pushed tothe subscribers of the topic. This API allows you to send different messagecontent to different types of subscribers.
URI● URI format
POST /v2/{project_id}/notifications/topics/{topic_urn}/publish● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 52
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
topic_urn Yes String Unique resource ID of atopic. You can obtain itaccording to QueryingTopics.
Request● Parameter description
Parameter Mandatory Type Description
subject No String Message subject, which ispresented as the emailsubject when SMN sendsmassages to emailsubscribersThe message subject cannotexceed 512 bytes.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 53
Parameter Mandatory Type Description
message_structure
Yes String Message structure, whichcontains JSON characterstrings. Specify protocols inthe structure, which can behttp, https, email, dms,functiongraph,functionstage, HMS, APNS,APNS_SANDBOX, and sms.For details about HMS, APNS,and APNS_SANDBOXmessage formats, seeApplication MessageFormat.The default protocol ismandatory. If the system failsto match any other protocols,the default message is sent.NOTE
Three message formats aresupported:● message● message_structure● message_template_nameIf the three formats arespecified at the same time, theytake effect in the followingsequence: message_structure >message_template_name >message.
time_to_live No String Specifies the maximumretention period of amessage in SMN.After the retention periodexpires, SMN does not sendthis message. Unit: secondDefault value: 3600s (onehour)The value must be a positiveinteger less than or equal to604,800 (3600 x 24 x 7).
● Example request
POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId: f96188c7ccaf4ffba0c9aa149ab2bd57:test_create_topic_v2/publish{ "subject": "test message v2", "time_to_live": "3600", "message_structure": "{ "default": "test v2 default", "email": "abc",
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 54
"APNS": "{ "aps": { "alert":"hello world apns production" } } } }
NO TE
For example, a topic has two types of subscriptions, SMS and email. After the API iscalled to publish messages, the email subscriber will receive message "abc", and theSMS subscriber will receive the default message "test v2 default". Messages sent toapplication subscribers must meet application platform requirements. Otherwise,application endpoints will fail to receive messages. For example, if you have notspecified a message for application subscribers, the default message will be sent.However, if default message does not meet the structure requirements, the applicationsubscribers will receive no messages.
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
message_id String Message ID, which isunique
● Example response
{ "message_id": "bf94b63a5dfb475994d3ac34664e24f2", "request_id": "9974c07f6d554a6d827956acbeb4be5f"}
Returned Value
See Returned Value.
Error Codes
See Error Codes.
5.4.3 Publishing Messages Using a Template
Description● API name
Publish● Function
Use the message template to publish a message to a topic. After the messageID is returned, the message has been saved and is to be pushed to thesubscribers of the topic. This API allows you to send messages to differenttypes of subscribers using different template protocols with the same name.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 55
URI● URI format
POST /v2/{project_id}/notifications/topics/{topic_urn}/publish● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a Project ID.
topic_urn Yes String Unique resource ID of a topic.You can obtain it according toQuerying Topics.
Request● Parameter description
Parameter Mandatory Type Description
subject No String Message subject, whichis presented as theemail subject whenSMN sends massages toemail subscribersThe message subjectcannot exceed 512bytes.
message_template_name
Yes String Message templatename, which can beobtained according toQuerying MessageTemplatesNOTE
Three message formatsare supported:● message● message_structure● message_template_na
meIf the three formats arespecified at the sametime, they take effect inthe following sequence:message_structure>message_template_name>message
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 56
Parameter Mandatory Type Description
tags Yes JSON key-value pair
Variable parameters andvaluesThe value cannot be leftblank.
time_to_live No String Specifies the maximumretention period of amessage in SMN.After the retentionperiod expires, SMNdoes not send thismessage. Unit: secondDefault value: 3600s(one hour)The value must be apositive integer lessthan or equal to604,800 (3600 x 24 x 7).
● Request example
POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId: f96188c7ccaf4ffba0c9aa149ab2bd57:test_create_topic_v2/publish{ "subject": "test message template v2", "message_template_name": "confirm_message", "time_to_live": "3600", "tags": { "topic_urn": "topic_urn3331", "topic_id": "topic_id3332" }}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
message_id String Message ID, which isunique
● Response example
{ "message_id": "bf94b63a5dfb475994d3ac34664e24f2", "request_id": "9974c07f6d554a6d827956acbeb4be5f"}
Returned Value
See Returned Value.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 57
Error CodesSee Error Codes.
5.5 Resource Tag Operations
5.5.1 Querying Resources by Tag
Description● API name
GetResourceInstances● Function
Query SMN resources by tag.
URI● URI format
POST /v2/{project_id}/{resource_type}/resource_instances/action● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
resource_type Yes String Resource typeThe value can be thefollowing:smn_topic: topicsmn_sms: SMSsmn_application:mobile push
Request● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 58
Parameter
Mandatory Type Description
tags No Tags structurearray
Includes specified tags.For details, see Table 5-7.NOTE
The structure body ismandatory. A maximum of10 tag keys are allowed ineach query operation. Thetag key cannot be left blankor set to the empty string.Each tag key can have up to10 tag values. Each tag keyand tag values of one keymust be unique. Resourcesidentified by different keysare in AND relationship.
tags_any No Tags structurearray
Includes any of thespecified tags. For details,see Table 5-7.NOTE
The structure body ismandatory. A maximum of10 tag keys are allowed ineach query operation. Thetag key cannot be left blankor set to the empty string.Each tag key can have up to10 tag values. Each tag keyand tag values of one keymust be unique. Resourcesidentified by different keysare in OR relationship.
not_tags No Tags structurearray
Excludes specified tags.For details, see Table 5-7.NOTE
The structure body ismandatory. A maximum of10 tag keys are allowed ineach query operation. Thetag key cannot be left blankor set to the empty string.Each tag key can have up to10 tag values. Each tag keyand tag values of one keymust be unique. Resourcesidentified by different keysare in NAND relationship.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 59
Parameter
Mandatory Type Description
not_tags_any
No Tags structurearray
Excludes any of thespecified tags. For details,see Table 5-7.NOTE
The structure body ismandatory. A maximum of10 tag keys are allowed ineach query operation. Thetag key cannot be left blankor set to the empty string.Each tag key can have up to10 tag values. Each tag keyand tag values of one keymust be unique. Resourcesidentified by different keysare in NOR relationship.
limit No String Maximum number ofresources to be queried● If action is set to
count, this parameterdoes not take effect.
● If action is set tofilter, this parametertakes effect. Its valueranges from 1 to 1000(default).
offset No String Start location ofpagination query. Thequery starts from the nextresource of the specifiedlocation. You do not needto specify this parameterwhen querying resourceson the first page. Whenyou query resources onsubsequent pages, set thisparameter to the locationreturned in the responsebody for the previousquery.● If action is set to
count, this parameterdoes not take effect.
● If action is set tofilter, this parametertakes effect. Its valuecan be 0 (default) or apositive integer.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 60
Parameter
Mandatory Type Description
action Yes String Operation to beperformed. The value canbe filter or count (case-sensitive).filter: queries resources inpages based on filterconditions.count: queries the totalnumber of resourcesmeeting filter conditions.
matches No Match conditionstructure array
Key-value pair to bematchedThe key can only beresource_name.The value will be exactlymatched.
Table 5-7 Tags structure
Parameter Mandatory
Type Description Constraint
key Yes String Tag key A key contains 127Unicode characters andcannot be blank.
values Yes String list Value list Each value contains amaximum of 255Unicode characters. Ifthe value starts with anasterisk (*), thecharacter stringfollowing the asterisk isfuzzy-matched. Thevalues field cannot bemissing, but can be anempty list. If it is empty,any value will bematched. The values arein OR relationship.
● Request example
POST https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/resource_instances/action
– Request body when action is set to filter{ "offset": "100", "limit": "100",
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 61
"action": "filter", "matches":[ { "key": "resource_name", "value": "resource1" } ], "not_tags": [ { "key": "key1", "values": ["*value1","value2"] }, { "key": "key2", "values": ["*value21","value22"] } ], "tags": [ { "key": "key1", "values": ["*value1","value2"] } ], "tags_any": [ { "key": "key1", "values": ["value1", "value2"] } ], "not_tags_any": [ { "key": "key1", "values": ["value1", "value2"] } ]}
– Request body when action is set to count{ "action": "count", "not_tags": [ { "key": "key1", "values": ["value1", "*value2"] } ], "tags": [ { "key": "key1", "values": ["value1", "value2"] } ], "tags_any": [ { "key": "key1", "values": [ "value1", "value2"] } ], "not_tags_any": [ { "key": "key1", "values": ["value1", "value2"] } ], "matches":[ { "key": "resource_name", "value": "resouurce" }
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 62
]}
Response● Parameter description
Parameter Mandatory Type Description
resources Yes Resource structurearray
For details, see Table5-8.
total_count Yes Integer Total number ofresources
Table 5-8 Resource structure
Parameter Mandatory Type Description
resource_id Yes String Resource ID
resource_detail
Yes Object Resource details.Resource object usedfor extension. Thevalue is left blank bydefault.For topic resources,the value of this fieldis {"topic_urn":"${TopicUrn}","display_name":"displayname"}.For other resources,the value is null.
tags Yes Resource_tagstructure array
List of queried tags. Ifno tag is matched, anempty array isreturned. For details,see Table 5-9.
resource_name
Yes String Resource name
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 63
Table 5-9 Resource_tag structure
Parameter Mandatory
Type Description
Constraint
key Yes String Tag key The key contains 36Unicode characters atmost and cannot be blankor an empty string. It cancontain only digits, letters,hyphens (-), andunderscores (_) and mustnot start or end with aspace.
value Yes String Tagvalue
Each value contains 43Unicode characters atmost and can be anempty string. It cancontain only digits, letters,hyphens (-), andunderscores (_) and mustnot start or end with aspace.
● Response example
Response body when action is set to filter{ "resources": [ { "resource_detail": { "topic_urn":"urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:resouece1", "display_name":"testtest" }, "resource_id": "cffe4fc4c9a54219b60dbaf7b586e132", "resource_name": "resouece1", "tags": [ { "key": "key1", "value": "value1" } ] } ], "total_count": 1000}
Response body when action is set to count{ "total_count": 1000}
Returned ValueSee section Returned Value.
Error CodeSee section Error Codes.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 64
5.5.2 Adding or Deleting Resource Tags in Batches
Description● API name
BatchCreateOrDeleteResourceTags● Function
Add or delete tags for a specified resource in batches.You can add a maximum of 10 tags to a resource.
NO TE
The API is idempotent. When you are to create tags, if there are duplicate keys in therequest body, an error is reported.If a to-be-created tag has the same key as an existing tag, the tag will be created andoverwrite the existing one.When tags are being deleted and some tags do not exist, the operation is consideredsuccessful by default. The character set of the tags will not be checked.
URI● URI format
POST /v2/{project_id}/{resource_type}/{resource_id}/tags/action● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
resource_type Yes String Resource typeThe value can be thefollowing:smn_topic: topicsmn_sms: SMSsmn_application:mobile push
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 65
Parameter Mandatory Type Description
resource_id Yes String Resource IDObtain a resource ID:● When resource_type
is set to smn_topic:– Add X-SMN-
RESOURCEID-TYPE=name inthe requestheader and setthe resource ID tothe topic name.
– Call theGetResourceInstances API toobtain theresource ID.
● When resource_typeis set to smn_sms,the resource ID is thesignature ID, whichcan be obtained onthe console.
Request● Parameter description
Parameter
Mandatory Type Description
tags Yes Resource_tagstructurearray
Tag list. For details, seeTable 5-10.When you delete tags, thetag structure cannot bemissing, and the keycannot be left blank or bean empty string. Thesystem does not check thecharacter set whendeleting a tag.
action Yes String Operation to beperformed, which can becreate or delete
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 66
Table 5-10 Resource_tag structure
Parameter Mandatory
Type Description
Constraint
key Yes String Tag key The key contains 36Unicode characters atmost and cannot be blankor an empty string. It cancontain only digits, letters,hyphens (-), andunderscores (_) and mustnot start or end with aspace.
value Yes String Tagvalue
Each value contains 43Unicode characters atmost and can be anempty string. It cancontain only digits, letters,hyphens (-), andunderscores (_) and mustnot start or end with aspace.
● Request example
POST https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/{resource_id}/tags/action
● Request bodyRequest body when action is set to create{ "action": "create", "tags": [ { "key": "key1", "value": "value1" }, { "key": "key", "value": "value3" } ]}
Request body when action is set to delete{ "action": "delete", "tags": [ { "key": "key1" }, { "key": "key2", "value": "value3" } ]}
ResponseNone
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 67
Returned ValueSee Returned Value.
Error CodeSee section Error Codes.
5.5.3 Adding a Resource Tag
Description● API name
CreateResourceTag● Function
You can add a maximum of 10 tags to a resource.The API is idempotent. If a to-be-created tag has the same key as an existingtag, the tag will be created and overwrite the existing one.
URI● URI format
POST /v2/{project_id}/{resource_type}/{resource_id}/tags● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
resource_type
Yes String Resource typeThe value can be thefollowing:smn_topic: topicsmn_sms: SMSsmn_application:mobile push
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 68
Parameter Mandatory Type Description
resource_id Yes String Resource IDObtain a resource ID:● When
resource_type is setto smn_topic:– Add X-SMN-
RESOURCEID-TYPE=name inthe requestheader and setthe resource IDto the topicname.
– Call theGetResourceInstances API toobtain theresource ID.
● Whenresource_type is setto smn_sms, theresource ID is thesignature ID, whichcan be obtained onthe console.
Request● Parameter description
Parameter
Mandatory Type Description
tag Yes Resourcetagstructure
Resource tag to be added. Fordetails, see Table 5-11.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 69
Table 5-11 Resource_tag structure
Parameter Mandatory
Type Description
Constraint
key Yes String Tag key The key contains 36Unicode characters atmost and cannot be blankor an empty string. It cancontain only digits, letters,hyphens (-), andunderscores (_) and mustnot start or end with aspace.
value Yes String Tagvalue
Each value contains 43Unicode characters atmost and can be anempty string. It cancontain only digits, letters,hyphens (-), andunderscores (_) and mustnot start or end with aspace.
● Request example
POST https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/{resource_id}/tags
● Example request{ "tag": { "key": "DEV", "value": "DEV1" }}
ResponseNone
Returned ValueSee Returned Value.
Error CodeSee section Error Codes.
5.5.4 Deleting a Resource Tag
Description● API name
DeleteResourceTag
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 70
● FunctionThe API is idempotent. When deleting a tag, the system does not check itscharacter set. The tag key cannot be left blank or be an empty string. If thekey of the tag to be deleted does not exist, 404 will be returned.
URI● URI format
DELETE /v2/{project_id}/{resource_type}/{resource_id}/tags/{key}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
resource_type Yes String Resource typeThe value can bethe following:smn_topic: topicsmn_sms: SMSsmn_application:mobile push
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 71
Parameter Mandatory Type Description
resource_id Yes String Resource IDObtain a resourceID:● When
resource_type isset to smn_topic:– Add X-SMN-
RESOURCEID-TYPE=namein the requestheader andset theresource ID tothe topicname.
– Call theGetResourceInstances APIto obtain theresource ID.
● Whenresource_type isset to smn_sms,the resource ID isthe signature ID,which can beobtained on theconsole.
Request● Request example
DELETE https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/{resource_id}/tags/{key}
ResponseNone
Returned ValueSee Returned Value.
Error CodeSee section Error Codes.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 72
5.5.5 Querying Resource Tags
Description● API name
ListResourceTags● Function
Query tags of a specified resource.
URI● URI format
GET /v2/{project_id}/{resource_type}/{resource_id}/tags● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
resource_type Yes String Resource typeThe value can bethe following:smn_topic: topicsmn_sms: SMSsmn_application:mobile push
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 73
Parameter Mandatory Type Description
resource_id Yes String Resource IDObtain a resourceID:● When
resource_typeis set tosmn_topic:– Add X-
SMN-RESOURCEID-TYPE=namein therequestheader andset theresource IDto the topicname.
– Call theGetResourceInstancesAPI toobtain theresource ID.
● Whenresource_typeis set tosmn_sms, theresource ID isthe signatureID, which canbe obtained onthe console.
Request● Parameter description
None● Request example
GET https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/{resource_id}/tags
Response● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 74
Parameter Type Description
tags Resource_tag structurearray
Tag list. For details, see Table5-12.
Table 5-12 Resource_tag structure
Parameter Mandatory
Type Description
Constraint
key Yes String Tag key The key contains 36Unicode characters atmost and cannot be blankor an empty string. It cancontain only digits, letters,hyphens (-), andunderscores (_) and mustnot start or end with aspace.
value Yes String Tagvalue
Each value contains 43Unicode characters atmost and can be anempty string. It cancontain only digits, letters,hyphens (-), andunderscores (_) and mustnot start or end with aspace.
● Response example
{ "tags": [ { "key": "key1", "value": "value1" }, { "key": "key2", "value": "value3" } ]}
Returned ValueSee section Returned Value.
Error CodeSee section Error Codes.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 75
5.5.6 Querying Tags in a Specified Project
Description● API name
GetProjectTags● Function
Query all tags of a resource type in a specified project.
URI● URI format
GET /v2/{project_id}/{resource_type}/tags● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
resource_type Yes String Resource typeThe value can be thefollowing:smn_topic: topicsmn_sms: SMSsmn_application:mobile push
Request● Parameter description
None● Request example
GET https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/tags
Response● Parameter description
Parameter Type Description
tags Tags structurearray
Tag list. For details, see Table 5-13.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 76
Table 5-13 Tags structure
Parameter Mandatory
Type Description Constraint
key Yes String Tag key A key contains 127Unicode characters andcannot be blank.
values Yes String list Value list Each value contains amaximum of 255Unicode characters. Ifthe value starts with anasterisk (*), thecharacter stringfollowing the asterisk isfuzzy-matched. Thevalues field cannot bemissing, but can be anempty list. If it is empty,any value will bematched. The values arein OR relationship.
● Response example
{ "tags": [ { "key": "key1", "values": ["value1""value2"] }, { "key": "key2", "values": ["value1","value2"] } ]}
Returned ValueSee section Returned Value.
Error CodeSee section Error Codes.
5.6 Application Operations
5.6.1 Creating a Platform Application
Description● API name
CreateApplication
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 77
● FunctionCreate a platform application.
URI● URI format
POST /v2/{project_id}/notifications/applications● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
Request● Parameter description
Parameter Mandatory
Type Description
name Yes String Application nameThe value can containletters, underscores (_), anddigits and cannot exceed 64characters.
platform Yes String Application platformCurrently, only HMS, APNS,and APNS_SANDBOX aresupported.HMS is a platform fordevelopers to push Andriodmessages.APNS and APNS_SANDBOXare platforms for pushingiOS messages.
platform_principal
Yes String ● For HMS, set it to theapp ID, which containsletters and digits anddoes not exceed 20characters.
● For APNS andAPNS_SANDBOX, set it tothe certificate of theplatform, which isencoded using Base64and cannot exceed 8 KB.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 78
Parameter Mandatory
Type Description
platform_credential
Yes String ● For HMS, set it to theapp secret, which is astring of 32 charactersconsisting of letters anddigits.
● For APNS andAPNS_SANDBOX, set it tothe certificate private key,which is encoded usingBase64 and cannotexceed 8 KB.
● Request example
POST https://{SMN_Endpoint}/v2/{project_id}/notifications/applications { "name": "application_name", "platform": "HMS", "platform_principal": "appId", "platform_credential": "appSecret"}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
application_urn String Unique resource ID of anapplication
● Response example
{ "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085", "application_urn": "urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:app-HMS-application_name"}
Returned ValueSee section Returned Value.
Error CodeSee section Error Codes.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 79
5.6.2 Updating a Platform Application
Description● API name
UpdateApplication● Function
Update a platform application.
URI● URI format
PUT /v2/{project_id}/notifications/applications/{application_urn}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
application_urn
Yes String Unique resource ID of anapplication. You can obtainit according to QueryingPlatform Applications.
Request● Parameter description
Parameter Mandatory
Type Description
platform_principal
Yes String ● For HMS, set it to the app ID,which contains letters anddigits and does not exceed 20characters.
● For APNS andAPNS_SANDBOX, set it to thecertificate of the platform,which is encoded usingBase64 and cannot exceed 8KB.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 80
Parameter Mandatory
Type Description
platform_credential
Yes String ● For HMS, set it to the appsecret, which is a string of 32characters consisting of lettersand digits.
● For APNS andAPNS_SANDBOX, set it to thecertificate private key, which isencoded using base64 andcannot exceed 8 KB.
● Request examplePUT https://{SMN_Endpoint}/v2/{project_id}/notifications/applications/{application_urn} { "platform_principal": "appId", "platform_credential": "appSecret"}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
● Response example{ "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085"}
Returned Value
See section Returned Value.
Error Code
See section Error Codes.
5.6.3 Deleting a Platform Application
Description● API name
DeleteApplication
● Function
Delete a platform application.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 81
URI● URI format
DELETE /v2/{project_id}/notifications/applications/{application_urn}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
application_urn
Yes String Unique resource ID of anapplication. You can obtainit according to QueryingPlatform Applications.
Request● Request example
DELETE https://{SMN_Endpoint}/v2/{project_id}/notifications/applications/{application_urn}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
● Response example
{ "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085"}
Returned ValueSee section Returned Value.
Error CodeSee section Error Codes.
5.6.4 Querying Platform Applications
Description● API name
ListApplication● Function
Query the platform application list.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 82
URI● URI format
GET /v2/{project_id}/notifications/applications?offset={offset}&limit={limit}&name={name}&platform={platform}
● Parameter description
Parameter Mandatory
Type Description
project_id Yes String Project IDSee Obtaining a Project ID.
offset No Integer OffsetIf the value is an integer greaterthan 0 but less than the numberof resources, all resources afterthis offset will be queried. Thedefault value is 0.
limit No Integer ● Number of resources returnedon each page
● The value range is 0–100.Commonly used values are 10,20, and 50. The default valueis 100.
name No String Application nameThe value contains a maximumof 64 characters and consists ofletters, underscores (_), anddigits. Backward fuzzy match issupported.
platform No String Application platformCurrently, only HMS, APNS, andAPNS_SANDBOX are supported.HMS is a platform for developersto push Andriod messages.APNS and APNS_SANDBOX areplatforms for pushing iOSmessages.
Request● Request example
GET https://{SMN_Endpoint}/v2/{project_id}/notifications/applications?offset=0&limit=100&name=application_name&platform=APNS
Response● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 83
Parameter Type Description
request_id String Request ID, which isunique
application_count Integer Number of returnedapplicationsNOTE
No matter what offset andlimit values you have set inthe request, this parameteralways returns the totalnumber of applications.
applications Application structurearray
See Table 5-14.
Table 5-14 Application structure
Parameter Type Description
name String Application name
platform String Application platform
create_time String Time when an application wascreatedThe UTC time is in YYYY-MM-DDTHH:MM:SSZ format.
application_urn String Unique resource ID of anapplication
application_id String Application ID, which is unique
enabled boolean Whether the platformapplication is enabled
apple_certificate_expiration_date
String Apple certificate expirationtimeThis item applies only to theAPNS and APNS_SANDBOXplatforms.The UTC time is in YYYY-MM-DDTHH:MM:SSZ format.
● Response example
{ "request_id": "1ba562636055494980c4bc896e4a6960", "application_count": 2, "applications": [{ "create_time": "2018-02-08T08:30:16Z", "apple_certificate_expiration_date": "2018-03-09T12:21:40Z", "name": "application_name001", "platform": "APNS",
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 84
"enabled": "true", "application_urn": "urn:smn:regionId:429ffced18074da0938112f2c362b935:app-APNS-application_name001", "application_id": "b1b8643dc12b4g77ad6e35a16003119b" }, { "create_time": "2018-01-11T12:58:58Z", "apple_certificate_expiration_date": "2018-03-09T12:21:40Z", "name": "application_name002", "platform": "APNS", "enabled": "true", "application_urn": "urn:smn:regionId:429ffced18074da0938112f2c362b935:app-APNS-application_name002", "application_id": "a3a4643dc12b4g77ad6e35a16002558c" }]}
Returned ValueSee Returned Value.
Error CodesSee Error Codes.
5.6.5 Querying Application Attributes
Description● API name
GetApplicationAttributes● Function
Query attributes of a platform application.
URI● URI format
GET /v2/{project_id}/notifications/applications/{application_urn}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
application_urn
Yes String Unique resource ID of anapplication. You can obtainit according to QueryingPlatform Applications.
Request● Request example
GET https://{SMN_Endpoint}/v2/{project_id}/notifications/applications/{application_urn}
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 85
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
attributes Application attributesstructure
See Table 5-15.
application_id String Application ID, which isunique
Table 5-15 Application_attributes structure
Parameter Type Description
enabled boolean Whether the platformapplication is enabled
apple_certificate_expiration_date
String Apple certificate expirationtimeThis item applies only to theAPNS and APNS_SANDBOXplatforms.The UTC time is in YYYY-MM-DDTHH:MM:SSZ format.
● Response example
{ "request_id": "c2b8643dc12b5e77ad6e35a16003229b", "application_id": "b1b8643dc12b4g77ad6e35a16003119b", "attributes": { "enabled": "true", "apple_certificate_expiration_date": "2018-03-09T12:21:40Z" }}
Returned ValueSee section Returned Value.
Error CodeSee section Error Codes.
5.7 Application Endpoint Operations
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 86
5.7.1 Adding an Application Endpoint
Description● API name
CreateApplicationEndpoint● Function
Add an endpoint to a platform application.
URI● URI format
POST /v2/{project_id}/notifications/applications/{application_urn}/endpoints● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
application_urn
Yes String Unique resource ID of anapplication. You can obtainit according to QueryingPlatform Applications.
Request● Parameter description
Parameter Mandatory Type Description
token Yes String Mobile devicetoken, whichcannot exceed512 bytes
user_data No String Description oradditionalinformation aboutthe endpointThe value is aUTF-8 encodedstring notexceeding 2048bytes.
● Request example
POST https://{SMN_Endpoint}/v2/{project_id}/notifications/applications/{application_urn}/endpoints{ "token": "3708232124742383445",
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 87
"user_data": "This is token for user001"}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
endpoint_urn String Unique resource ID of anendpoint
● Response example{ "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085", "endpoint_urn": "urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:endpoint-APNS-example_application_name-37a2cb947fa43a20bc66e91281194e7a"}
Returned Value
See section Returned Value.
Error Code
See section Error Codes.
5.7.2 Updating Application Endpoint Attributes
Description● API name
UpdateApplicationEndpoint
● Function
Update application endpoint attributes.
URI● URI format
PUT /v2/{project_id}/notifications/endpoints/{endpoint_urn}
● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 88
Parameter Mandatory Type Description
endpoint_urn Yes String Unique resource ID of anapplication endpoint. Youcan obtain it according toQuerying the EndpointList of an Application.
Request● Parameter description
Parameter Mandatory Type Description
enabled No String Whether a deviceis enabled. Thevalue can be trueor false.
user_data No String Description oradditionalinformation aboutthe endpoint. Thevalue is a UTF-8encoded stringnot exceeding2048 bytes.
● Request examplePUT https://{SMN_Endpoint}/v2/{project_id}/notifications/endpoints/{endpoint_urn}{ "enabled": "false", "user_data": "This is a APNS token for user001"}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
● Response example{"request_id": "6a63a18b8bab40ffb71ebd9cb80d0085"}
Returned Value
See section Returned Value.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 89
Error CodeSee section Error Codes.
5.7.3 Deleting an Application Endpoint
Description● API name
DeleteApplicationEndpoint● Function
Delete an application endpoint.
URI● URI format
DELETE /v2/{project_id}/notifications/endpoints/{endpoint_urn}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
endpoint_urn Yes String Unique resource ID of anapplication endpoint. Youcan obtain it according toQuerying the EndpointList of an Application.
Request● Request example
DELETE https://{SMN_Endpoint}/v2/{project_id}/notifications/endpoints/{endpoint_urn}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
● Response example
{ "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085"}
Returned ValueSee section Returned Value.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 90
Error CodeSee section Error Codes.
5.7.4 Querying the Endpoint List of an Application
Description● API name
ListEndpointsByApplication● Function
Query the endpoint list of an application.
URI● URI format
GET /v2/{project_id}/notifications/applications/{application_urn}/endpoints?offset={offset}&limit={limit}&token={token}&user_data={user_data}&enabled={enabled}
● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
application_urn
Yes String Unique resource ID of anapplication. You can obtainit based on QueryingPlatform Applications.
offset No Integer OffsetIf the value is an integergreater than 0 but lessthan the number ofresources, all resourcesafter this offset will bequeried. The default valueis 0.
limit No Integer ● The value range is 0–100.Commonly used valuesare 10, 20, and 50.
● Number of resourcesreturned on each page
The default value is 100.
enabled No String Whether a device isenabled. The value can betrue or false.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 91
Parameter Mandatory Type Description
token No String Device token, whichcontains a maximum of512 bytes
user_data No String Description or additionalinformation about theendpoint. The value doesnot exceed 2048 bytes.
Request● Request example
GET https://{SMN_Endpoint}/v2/{project_id}/notifications/applications/{application_urn}/endpoints?offset=0&limit=10
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
next_page_flag Boolean Whether a link to thenext page is provided
endpoints Application endpointstructure array
See Table 5-16.
Table 5-16 Application_endpoint structure
Parameter Type Description
create_time String Time when an application wascreatedThe UTC time is in YYYY-MM-DDTHH:MM:SSZ format.
endpoint_urn String Unique resource ID of anapplication endpoint
user_data String Description or additionalinformation about the endpointThe value is a UTF-8 encodedstring which does not exceed2048 Bytes.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 92
Parameter Type Description
enabled String Whether an endpoint isenabled for notificationsThe value can be true or false.
token String Device tokenThe value cannot exceed 512Bytes.
● Response example
{ "endpoints": [{ "create_time": "2018-01-12T01:25:14Z", "endpoint_urn": "urn:smn:regionId:429ffced18074da0938112f2c362b935:endpoint-APNS-application_name-62f0bafec61c45fbbb5d0fc6bd696a2d", "user_data": "no user data", "enabled": "true", "token": "1f2fda4c1013c47ac4c59bd22379d88e14b07b0ebf47f2f79d1a6b06ed03390d" }], "request_id": "c90d871f77f7425cae0a8b772a563d17", "next_page_flag": false}
Returned Value
See Returned Value.
Error Codes
See Error Codes.
5.7.5 Querying Application Endpoint Attributes
Description● API name
GetApplicationEndpointAttributes● Function
Query attributes of an endpoint.
URI● URI format
GET /v2/{project_id}/notifications/endpoints/{endpoint_urn}● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining a ProjectID.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 93
Parameter Mandatory Type Description
endpoint_urn Yes String Unique resource ID of anapplication endpoint. Youcan obtain it according toQuerying the EndpointList of an Application.
Request● Request example
GET https://{SMN_Endpoint}/v2/{project_id}/notifications/endpoints/{endpoint_urn}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which isunique
attributes Endpoint attributesstructure
See Table 5-17.
Table 5-17 Endpoint_attributes structure
Parameter Type Description
enabled boolean Whether an endpoint isenabled for notifications
token String Device token
user_data String Description or additionalinformation about theendpoint
● Response example{ "request_id": "0e1bf654b29f56d297eca7c9502a96ba", "attributes": { "enabled": "true", "token": "3708232124742383445", "user_data": "abc" }}
Returned Value
See section Returned Value.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 94
Error CodeSee section Error Codes.
5.8 Direct Application Messaging
5.8.1 Sending an Application Message
Description● API name
PublishAppMessage● Function
Send a message to an endpoint.
URI● URI format
POST /v2/{project_id}/notifications/endpoints/{endpoint_urn}/publish● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
endpoint_urn Yes String Unique resource ID ofan applicationendpoint. You canobtain it according toQuerying theEndpoint List of anApplication.
Request● Parameter description
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 95
Parameter Mandatory Type Description
message Yes String Message content. Currently,supported mobile pushplatforms include HMS,APNS, andAPNS_SANDBOX.● HMS is a platform for
developers to pushAndriod messages.
● APNS andAPNS_SANDBOX areplatforms for pushingiOS messages.
● Message content forHMS cannot exceed 2 KB.
● Message content forAPNS andAPNS_SANDBOX cannotexceed 4 KB.
For detailed formatrequirements, see sectionApplication MessageFormat.
time _to_live No String TTL of the message(counting from the timewhen you make the sendingrequest)SMN will count the time amessage already consumedin the SMN system beforeforwarding it to the mobilepush platform. The messagewill be forwarded only whenthe time it consumed inSMN is less than the TTL,and the consumed time isdeducted from the TTL. Ifthe consumed time hasexceeded the TTL, themessage will be discarded.The time period is measuredin seconds, and the defaultTTL is 3600s (one hour).The value must be apositive integer less than orequal to 604,800 (3600 x 24x 7).
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 96
● Request examplePOST https://{SMN_Endpoint}/v2/{project_id}/notifications/endpoints/{endpoint_urn}/publish{ "message":{ "hps":{ "msg":{ "action":{ "param":{ "intent":"#Intent;compo=com.HC.SmnAppPush.defaultAction/.Activity;S.W=U;end" }, "type":1 }, "body":{ "title":"hello world", "content":"hello world" }, "type":3 } } }}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
message_id String Message ID, which is unique
● Response example{ "message_id": "bf94b63a5dfb475994d3ac34664e24f2", "request_id": "9974c07f6d554a6d827956acbeb4be5f" }
Returned Value
See section Returned Value.
Error Code
See section Error Codes.
5.8.2 Sending an Application Message Using a MessageStructure
Description● API name
PublishAppStructureMessage
● Function
Send a message to an application endpoint using a message structure.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 97
URI● URI format
POST /v2/{project_id}/notifications/endpoints/{endpoint_urn}/publish● Parameter description
Parameter Mandatory Type Description
project_id Yes String Project IDSee Obtaining aProject ID.
endpoint_urn Yes String Unique resource ID ofan applicationendpoint. You canobtain it according toQuerying theEndpoint List of anApplication.
Request● Parameter description
Parameter Mandatory
Type Description
message_structure
Yes String Message content. Currently,supported mobile pushplatforms include HMS, APNS,and APNS_SANDBOX.● HMS is a platform for
developers to push Andriodmessages.
● APNS and APNS_SANDBOXare platforms for pushingiOS messages.
● Message content for HMScannot exceed 2 KB.
● Message content for APNSand APNS_SANDBOX cannotexceed 4 KB.
For detailed formatrequirements, see sectionApplication Message Format.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 98
Parameter Mandatory
Type Description
time _to_live No String TTL of the message (countingfrom the time when you makethe sending request)SMN will count the time amessage already consumed inthe SMN system beforeforwarding it to the mobilepush platform. The messagewill be forwarded only whenthe time it consumed in SMN isless than the TTL, and theconsumed time is deductedfrom the TTL.The time period is measured inseconds, and the default TTL is3600s (one hour). The valuemust be a positive integer lessthan or equal to 604,800 (3600x 24 x 7).
● Request example
POST https://{SMN_Endpoint}/v2/{project_id}/notifications/endpoints/{endpoint_urn}/publish{ "message_structure": "{ "HMS":"{ "hps":{ "msg":{ "action":{ "param":{ "intent":"#Intent;compo=com.HC.SmnAppPush.defaultAction/.Activity;S.W=U;end" }, "type":1 }, "body":{ "title":"hello world", "content":"hello world" }, "type":3 } } }" }"}
Response● Parameter description
Parameter Type Description
request_id String Request ID, which is unique
message_id String Message ID, which is unique
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 99
● Response example{ "message_id": "bf94b63a5dfb475994d3ac34664e24f2", "request_id": "9974c07f6d554a6d827956acbeb4be5f" }
Returned ValueSee section Returned Value.
Error CodeSee section Error Codes.
5.9 Version Querying
5.9.1 Listing All SMN API Versions
Description● API name
QueryApiSupportVersions● Function
List all SMN API versions.
URI● URI format
GET /
Request● Request example
GET https://{SMN_Endpoint}/
Response● Parameter description
Parameter Type Description
versions Versionsstructure
Version object list. For details, see Table5-18.
Table 5-18 Versions structure
Parameter Type Description
id String Version number, forexample, v2
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 100
Parameter Type Description
min_version String Minimum micro-versionnumber. If the APIs do notsupport micro-versions, noinformation will be returned.
status String Version status, which can bethe following:● CURRENT: widely used
version● SUPPORTED: earlier
version, which is stillsupported
● DEPRECATED: deprecatedversion, which may bedeleted later
updated String Version release time, whichmust be UTC time. Forexample, the release time ofv2 is 2014-06-28T12:20:21Z.
version String Maximum micro-versionnumber. If the APIs do notsupport micro-versions, noinformation will be returned.
links Links structure array URL of an API. For details,see Table 5-19.
Table 5-19 Links structure
Parameter Type Description
href String Shortcut link
rel String Shortcut link marker name
● Response example
{ "versions": [ { "id": "v2", "links": [ { "href": "https://127.0.0.1/v2", "rel": "self" } ], "min_version": "", "status": "CURRENT", "updated": "2018-09-19T00:00:00Z", "version": "" }
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 101
]}
Returned Value
See section Returned Value.
Error Code
See section Error Codes.
5.9.2 Querying the SMN API v2 Version
Description● API name
QueryV2ApiInfo
● Function
Query the SMN API v2 version information.
URI● URI format
GET /{api_version}
● Parameter description
Parameter Mandatory
Type Description
api_version Yes String Version to be queriedNOTE
Currently, only v2 issupported.
Request● Request example
GET https://{SMN_Endpoint}/v2
Response● Parameter description
Table 5-20 Parameter in the response
Parameter Type Description
version Object Version object
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 102
Table 5-21 Description of the version field
Parameter Type Description
id String Version number, for example, v2
links Links structurearray
URL of an API. For details, see Table5-22.
min_version String Minimum micro-version number. Ifthe APIs do not support micro-versions, no information will bereturned.
status String Version status, which can be thefollowing:● CURRENT: widely used version● SUPPORTED: earlier version which
is still supported● DEPRECATED: deprecated version
which may be deleted later
updated String Version release time, which must beUTC time. For example, the releasetime of v2 is 2014-06-28T12:20:21Z.
version String Maximum micro-version number. Ifthe APIs do not support micro-versions, no information will bereturned.
Table 5-22 Links structure
Parameter Type Description
href String Shortcut link
rel String Shortcut link marker name
● Response example
{ "version": { "id": "v2", "links": [ { "href": "https://127.0.0.1/v2", "rel": "self" } ], "min_version": "", "status": "CURRENT", "updated": "2018-09-19T00:00:00Z", "version": "" }}
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 103
Returned ValueSee section Returned Value.
Error CodeSee section Error Codes.
Simple Message NotificationAPI Reference 5 APIs
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 104
6 Public Parameters
6.1 Application Message Format
Table 6-1 Application message format
Type Example Value Remarks
HMStransparentpushmessage
"hps": {"msg" : {"type" : 1,"body" :{"key":"value"}}}
You can choose to specify the messagein text or JSON format.NOTE
● The JSON format is recommended, asshown in the example value.
● The message in text format is encodedusing UTF-8.
● The message body cannot exceed 2 KB.For details, visit Huawei MobileServices.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 105
Type Example Value Remarks
Huaweinotificationpushmessage
"hps": {"msg": {"type": 3,"body": {"content": "Pushmessage content","title": "Push messagecontent"},"action": {"type": 1,"param": {"intent":"#Intent;compo=com.rvr/.Activity;S.W=U;end"}}},"ext": {"biTag": "Trump","icon": "http://upload.w.org/00/150pxsvg.png"}}
Appleplatformmessage
{"aps": {"alert": "hello world"}}
The message body cannot exceed 4 KB.For details, visit Apple PushNotification Service.
6.2 General Request Return Code
6.2.1 Exception Response● Parameter description
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 106
Parameter
Type Description
request_id
String Request ID
code String See section Error Codes.
message String See section Error Codes.
● Example
{ "request_id": "aad0860d089c482b943971f802a6718e", "code": "SMN.0006", "message": "Topic not found."}
6.2.2 Returned Value● Normal
Returned Value Description
200 The task is submitted successfully.
201 Resource creation succeeds.
● Abnormal
Returned Value Description
400 Bad Request Incorrect request parameters.
401 Unauthorized Authentication failed.
403 Forbidden No permission to access therequested resource.
404 Not Found The requested resource does notexist.
500 Internal Server Error The request fails because the serveris abnormal.
501 Not Implemented The request fails because the serverdoes not support the requestedfunction.
502 Bad Gateway The request fails because thereturned response is invalid.
503 Service Unavailable The request fails because the systemis abnormal.
504 Gateway Timeout Gateway times out.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 107
6.3 Error CodesIf an error code starting with APIGW is returned after you call an API, rectify thefault by referring to the instructions provided in Error Codes.
Module HTTPStatusCode
Error Code Error Message Handling Measure
Tagmanagement
400 SMN.0038 Parameter: tagis invalid.
Enter a valid value fortag.
Tagmanagement
403 SMN.0075 Parameter: tagsare too many.
A message templatecan contain amaximum of 90 non-repeated variables.
Subscriptionmanagement
400 SMN.0159 The number ofendpoints hasreached themaximumallowed.
You can specify amaximum of 1000phone numbers.
Subscriptionmanagement
400 SMN.0160 Invalid endpoint. Specify a validendpoint.
Subscriptionmanagement
404 SMN.0167 Phone numberdoes not exist.
The phone numberdoes not exist.
Subscriptionmanagement
404 SMN.0168 Email Addressdoes not exist.
The email addressdoes not exist.
Textmessagetemplate
400 SMN.0082 The length ofthe remarkparameter valuehas reached themaximumallowed.
Enter a valid value forremark.
Textmessagetemplate
400 SMN.0152 The numberallocated to theSMS templatehas reached themaximumallowed.
You can create amaximum of 100 textmessage templates.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 108
Module HTTPStatusCode
Error Code Error Message Handling Measure
Textmessagetemplate
403 SMN.0153 Only enterpriseusers can createSMS messageTemplate.
Complete enterpriseauthentication.
Textmessagetemplate
403 SMN.0154 Only enterpriseusers who usethe certificateimages forauthenticationcan create smsmessagetemplates.
Contact customerservice for technicalsupport.
Textmessagetemplate
400 SMN.0155 Parameter:SmsTemplateType is invalid.
Specify a valid SMSmessage templatetype.
Textmessagetemplate
400 SMN.0156 Parameter:SmsTemplateName is invalid.
Enter a valid SMStemplate name.
Textmessagetemplate
400 SMN.0157 Parameter:SmsTemplateContent is invalid.
Specify valid SMSmessage templatecontent.
Textmessagetemplate
400 SMN.0161 Invalid SMStemplate ID.
Enter a valid SMSmessage template ID.
Textmessagetemplate
404 SMN.0162 SMS templatenot found.
The SMS messagetemplate does notexist. Specify a validtemplate.
Textmessagetemplate
400 SMN.0204 PromotionalSMS messagesmust containthe way tounsubscribe inthe end, forexample, byreplying "TD", or"T".
Promotional SMSmessage must containa way to unsubscribein the end, forexample, by replyingTD.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 109
Module HTTPStatusCode
Error Code Error Message Handling Measure
Textmessagetemplate
400 SMN.0215 The SMSmessagesignature IDdoes not matchthe signaturename in theSMS messagetemplatecontent.
Specify a signature IDthat matches thesignature name in thetemplate content.
Textmessagetemplate
400 SMN.0216 The templatecontent doesnot include anyvalid SMSmessagesignature.
Enter a valid signaturein the templatecontent.
Textmessagetemplate
400 SMN.0217 The templatecontent doesnot include anySMS messagesignature.
The SMS messagetemplate must containan approved andavailable signature, forexample, [VMALL].
Textmessagetemplate
400 SMN.0224 The SMSmessagetemplate isinvalid becausethe associatedsignature hasbeen deleted.
Specify anothertemplate ID.
Textmessagetemplate
400 SMN.0227 The messagecontainssensitive words.
Modify the messagecontent.
DirectSMSmessaging
403 SMN.0057 The number ofSMS messagesexceeds thelimit.
You can send at most60 SMS messages to asingle phone numberwithin one hour and200 within 12 hours.This limit is applicableonly to direct SMSmessage sending.There is no limit onthe number ofmessages you canpublish to a topic.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 110
Module HTTPStatusCode
Error Code Error Message Handling Measure
DirectSMSmessaging
404 SMN.0084 The SMSmessagesignature couldnot be found.
Enter an approvedSMS messagesignature.
DirectSMSmessaging
403 SMN.0086 The numberallocated to theSMS messagesignature hasreached themaximumallowed.
You can create amaximum of 10 SMSmessage signatures.
DirectSMSmessaging
400 SMN.0087 The SMSmessagesignature hasnot beenapproved.
Enter an approvedSMS messagesignature.
DirectSMSmessaging
400 SMN.0151 The messagesignature typecannot bepromotional.
Specify a transactionalSMS messagesignature.
DirectSMSmessaging
500 SMN.0158 Failed to uploadthe file.
Contact customerservice for technicalsupport.
DirectSMSmessaging
400 SMN.0188 Invalid SMStemplate type.
The SMS messagetemplate type isinvalid. It must be apromotional template.
DirectSMSmessaging
400 SMN.0229 Parameter:Invalidextend_src_id.
The value ofextend_src_id is astring containing amaximum of 8 digits.
Public 403 SMN.0001 No permissionto requestresources.
Add the requiredpermission.
Public 400 SMN.0015 Parameter:Offset or limit isinvalid.
Enter a valid offsetand limit.
Public 500 SMN.0016 DatabaseExceptions.
Contact customerservice for technicalsupport.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 111
Module HTTPStatusCode
Error Code Error Message Handling Measure
Public 400 SMN.0017 Parameter:Remark isinvalid.
Enter a valid value forremark.
Public 500 SMN.0018 Service internalerror.
Contact customerservice for technicalsupport.
Public 403 SMN.0022 Parameter:token is invalid.
Specify a valid token.
Public 400 SMN.0033 Parameter:push_policy isinvalid.
Enter a valid value forpush_policy.
Public 400 SMN.0034 Parameter:subscription_auth_policy isinvalid.
Enter a valid value forsubscription_auth_policy.
Public 400 SMN.0035 Parameter:validation_policyis invalid.
Enter a valid value forvalidation_policy.
Public 400 SMN.0036 Parameter:xdomain_type isinvalid.
Enter a valid value forxdomain_type.
Public 400 SMN.0059 Parameter:job_id is invalid.
Contact customerservice for technicalsupport.
Public 404 SMN.0060 Job not found. Contact customerservice for technicalsupport.
Public 400 SMN.0061 Parameter:Service name isinvalid.
Contact customerservice for technicalsupport.
Public 400 SMN.0062 Parameter:Show name isinvalid.
Contact customerservice for technicalsupport.
Public 404 SMN.0063 Cloud servicenot found.
Contact customerservice for technicalsupport.
Public 403 SMN.0065 The number ofemail messagesexceeds thelimit.
Contact customerservice for technicalsupport.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 112
Module HTTPStatusCode
Error Code Error Message Handling Measure
Public 400 SMN.0066 Parameter:Systemparameter nameis invalid.
Contact customerservice for technicalsupport.
Public 400 SMN.0067 Parameter:Systemparameter valueis invalid.
Contact customerservice for technicalsupport.
Public 404 SMN.0068 Systemparameter notfound.
Contact customerservice for technicalsupport.
Public 403 SMN.0069 Not authorizedto subscribeinternalendpoints.
Enter a correct HTTP/HTTPS endpoint.
Public 403 SMN.0070 No permissionto requestresources. Therole isop_restricted.Contactcustomerservice.
Check the accountbalance and top upyour account. If thefault persists, contactcustomer service.
Public 403 SMN.0071 No permissionto requestresources. Therole isop_suspended.
Check whether youraccount has beenfrozen.
Public 400 SMN.0074 Failed to addpermission.
Contact customerservice for technicalsupport.
Public 400 SMN.0077 Parameter:Status is invalid.
Enter a valid value forstatus.
Public 400 SMN.0080 The signIdparameter isinvalid.
Enter a valid signatureID in sign_id.
Public 400 SMN.0081 The signNameparameter isinvalid.
Enter a valid signaturename in sign_name. Itis a string of 2 to 8characters containingletters and digits.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 113
Module HTTPStatusCode
Error Code Error Message Handling Measure
Public 403 SMN.0083 Finish real-nameauthenticationbeforecontinuing.
Contact customerservice for technicalsupport.
Public 500 SMN.0089 An erroroccurred in theBSS system. Tryagain later.
Contact customerservice for technicalsupport.
Public 400 SMN.0090 Invalid domainID.
Enter a valid project IDin domain_id. Fordetails about how toobtain a project ID, seeObtaining a ProjectID.
Public 400 SMN.0092 The kafka_idparameter isinvalid.
Contact customerservice for technicalsupport.
Public 400 SMN.0093 The address_listparameter isinvalid.
Contact customerservice for technicalsupport.
Public 400 SMN.0094 The type ofqueueparameter isinvalid.
Contact customerservice for technicalsupport.
Public 400 SMN.0095 The count ofqueueparameter isinvalid.
Contact customerservice for technicalsupport.
Public 404 SMN.0096 Kafka not found. Contact customerservice for technicalsupport.
Public 400 SMN.0097 The namesparameter isinvalid.
Contact customerservice for technicalsupport.
Public 404 SMN.0098 This queue doesnot exist.
Specify a valid DMSqueue.
Public 403 SMN.0099 The SMN servicehas not beenauthorized tosend messagesto this queue.
Grant permissions toSMN in the queuepolicy.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 114
Module HTTPStatusCode
Error Code Error Message Handling Measure
Public 400 SMN.0100 The eventTypeparameter isinvalid.
Enter a valid value forevent_type.
Public 400 SMN.0103 The start_timeparameter valueis invalid.
Enter a valid starttime.
Public 400 SMN.0104 The end_timeparameter valueis invalid.
Enter a valid end time.
Public 400 SMN.0108 Parameter: Typeis invalid.
Enter a valid value fortype.
Public 404 SMN.0109 Start date is notfound.
The start date cannotbe left blank.
Public 400 SMN.0110 Parameter: Startdate is invalid.
Enter a valid startdate.
Public 404 SMN.0111 End date is notfound.
The end date cannotbe left blank.
Public 400 SMN.0112 Parameter: Enddate is invalid.
Enter a valid end date.
Public 400 SMN.0113 The start timeand end timemust be withinthe past 3months.
The start time and endtime must be withinthe past 3 months.
Public 400 SMN.0114 The end timemust be laterthan the starttime.
Enter the correct starttime or end time.
Public 403 SMN.0147 Only enterpriseusers who usethe certificateimages forauthenticationcan createmessagesignatures.
Contact customerservice for technicalsupport.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 115
Module HTTPStatusCode
Error Code Error Message Handling Measure
Public 400 SMN.0150 Complete real-nameregistrationusing yourcompany'scertificate.
Contact customerservice for technicalsupport.
Public 403 SMN.0165 Parameter:tenant_token isinvalid.
Specify a valid tenanttoken.
Public 400 SMN.0189 Failed to obtainthe certificaterequired forreviewing theSMS messagetemplatefunction.
Contact customerservice for technicalsupport.
Public 400 SMN.0191 Parameter:Invalidenterprise name.
Contact customerservice for technicalsupport.
Public 400 SMN.0192 Parameter:Invalidenterprisecertificate ID.
Contact customerservice for technicalsupport.
Public 403 SMN.0195 Completeenterprise real-nameauthenticationfirst.
Complete the real-name authentication.
Public 403 SMN.0228 Do not havepermission touse this API.Contactcustomer serviceto apply forpermission.
Contact customerservice to apply forpermission to use thisAPI.
Public 400 SMN0261 Check whetheryour accountbalance issufficient andtop up youraccount ifnecessary.
Check the accountbalance and top upyour account.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 116
Module HTTPStatusCode
Error Code Error Message Handling Measure
Platformapplication
400 SMN.0115 Parameter:Applicationname is invalid.
Enter a validapplication name.
Platformapplication
403 SMN.0116 Platform notsupported.
This platform is notsupported.
Platformapplication
403 SMN.0117 Certificate typeis not supported.
The certificate type isnot supported.
Platformapplication
400 SMN.0118 WrongCertificate.
Specify a validcertificate.
Platformapplication
403 SMN.0119 PlatformPrincipal must be atmost 8192 byteslong in UTF-8encoding.
Enter a valid value forplatform_principal,which contains UTF-8characters and doesnot exceed 8192 bytes.
Platformapplication
403 SMN.0120 PlatformCredential must be atmost 8192 byteslong in UTF-8encoding.
Enter a valid value forplatform_credential,which contains UTF-8characters and doesnot exceed 8192 bytes.
Platformapplication
201 SMN.0121 An applicationwith the samename butdifferentpropertiesalready exists.
Enter a validapplication name.
Platformapplication
404 SMN.0122 Application notfound.
Enter a validapplication name.
Platformapplication
400 SMN.0123 Parameter:ApplicationUrnis invalid.
Enter a validapplication URN.
Platformapplication
400 SMN.0124 Parameter:applicationattribute isinvalid.
Specify a validattribute.
Platformapplication
404 SMN.0125 Endpoint doesnot exist.
Specify an existingapplication endpoint.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 117
Module HTTPStatusCode
Error Code Error Message Handling Measure
Platformapplication
400 SMN.0126 ContentType iswrong.
Contact customerservice for technicalsupport.
Platformapplication
403 SMN.0127 File is too large. Contact customerservice for technicalsupport.
Platformapplication
403 SMN.0128 Password isempty.
Contact customerservice for technicalsupport.
Platformapplication
400 SMN.0129 Certificate typeis wrong.
Contact customerservice for technicalsupport.
Platformapplication
404 SMN.0130 The applicationdoes not exist.
Enter a validapplication URN.
Platformapplication
403 SMN.0131 The value of theTokenparameter isinvalid.
Specify a valid token.
Platformapplication
400 SMN.0132 The value of theUser_dataparameter isinvalid.
Enter valid user data.
Platformapplication
400 SMN.0133 The devicetoken alreadyexists.
You cannot create thesame endpoint twice.
Platformapplication
400 SMN.0134 The endpointURN is invalid.
Specify a validendpoint URN.
Platformapplication
400 SMN.0135 The endpointdoes not exist.
Specify an existingendpoint.
Platformapplication
400 SMN.0136 The value of theenabledparameter isinvalid.
Enter a valid value forenabled.
Platformapplication
400 SMN.0137 The applicationURN is invalid.
Enter a validapplication URN.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 118
Module HTTPStatusCode
Error Code Error Message Handling Measure
Platformapplication
201 SMN.0190 This endpointalready exists.
Enter anotherendpoint.
Platformapplication
400 SMN0230 Parameter:Invalid title.
Enter a valid title.
Subscriptionmanagement
400 SMN.0011 Parameter:Protocol isinvalid.
Specify a correctprotocol.
Subscriptionmanagement
400 SMN.0012 Parameter:Endpoint isinvalid.
Specify a validendpoint.
Subscriptionmanagement
404 SMN.0013 Subscriptionresource notfound.
Specify an existingsubscription endpoint.
Subscriptionmanagement
400 SMN.0014 Parameter:SubscriptionUrnis invalid.
Enter a validsubscription URN.
Subscriptionmanagement
400 SMN.0043 Parameter:subscription isinvalid.
Enter a valid value forsubscription.
Subscriptionmanagement
403 SMN.0078 The maximumnumber ofsubscriptionshas beenreached.
The number ofsubscriptions hasreached the limit.
Publishing amessage
403 SMN.0008 Parameter:Subject isinvalid.
Enter a valid value forsubject.
Publishing amessage
403 SMN.0009 Parameter:Message isinvalid.
Enter a valid message.
Publishing amessage
400 SMN.0019 ProducerExceptions.
Contact customerservice for technicalsupport.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 119
Module HTTPStatusCode
Error Code Error Message Handling Measure
Publishing amessage
400 SMN.0021 MessageStructure is invalid.
Specify a correctmessage structure.
Publishing amessage
400 SMN.0140 The topic URNconfigured forthe messagesending failureevent is invalid.
Enter a valid topicURN.
Publishing amessage
400 SMN.0141 The topicconfigured forthe messagesending failureevent does notexist.
Enter a valid topicURN.
Publishing amessage
400 SMN.0142 The topic URNconfigured forthe messagesending successevent is invalid.
Enter a valid topicURN.
Publishing amessage
400 SMN.0143 The topicconfigured forthe messagesending successevent does notexist.
Enter a valid topicURN.
Publishing amessage
400 SMN.0144 The topic URNconfigured forthe responsemessage eventis invalid.
Enter a valid topicURN.
Publishing amessage
400 SMN.0145 The topicconfigured forthe responsemessage eventdoes not exist.
Enter a valid topicURN.
Publishing amessage
400 SMN.0148 Parameter:user_id isinvalid.
Enter a valid user ID.
Messagetemplate
400 SMN.0024 Parameter:content isinvalid.
Enter valid messagetemplate content.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 120
Module HTTPStatusCode
Error Code Error Message Handling Measure
Messagetemplate
200 SMN.0025 Templatealready exists.
You cannot create thesame template twice.
Messagetemplate
404 SMN.0027 Template notfound.
Specify an existingmessage template.
Messagetemplate
400 SMN.0031 Parameter:template_id isinvalid.
Enter a valid templateID.
Messagetemplate
400 SMN.0032 Parameter:message_template_name isinvalid.
Enter a valid value formessage_template_name.
Messagetemplate
400 SMN.0042 Parameter:Message_template_name isinvalid.
Enter a valid value formessage_template_name.
Messagetemplate
400 SMN.0044 Exceededtemplate limit.
You can create amaximum of 100 textmessage templates.
Messagetemplate
404 SMN.0076 Default messagetemplate notfound.
Create a defaultmessage templateusing the sametemplate name.
Messagetemplate
404 SMN.0091 Default systemmessagetemplate notfound.
Create a defaultmessage templateusing the sametemplate name.
Messagetemplate
404 SMN.0101 The graph doesnot exist in thefunctiongraphservice.
Enter a validFunctionGraphendpoint.
Messagetemplate
400 SMN.0102 Parameter:message_id isinvalid.
Enter a valid messageID.
Topicmanagement
400 SMN.0002 Parameter:Name is invalid.
Enter a valid topicname.
Topicmanagement
400 SMN.0003 Parameter:DisplayName isinvalid.
Enter a valid topicdisplay name.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 121
Module HTTPStatusCode
Error Code Error Message Handling Measure
Topicmanagement
403 SMN.0004 Exceeded topiclimit.
You can create amaximum of 3000topics.
Topicmanagement
400 SMN.0005 Parameter:TopicUrn isinvalid.
Enter a valid topicURN.
Topicmanagement
404 SMN.0006 Topic not found. The topic does notexist.
Topicmanagement
403 SMN.0007 Exceededsubscriptionlimit.
A maximum of 10,000subscriptions can beadded to a topic.
Topicmanagement
404 SMN.0045 Attribute notfound.
Specify an existingattribute.
Topicmanagement
400 SMN.0046 Parameter:Attribute nameis invalid.
Enter a valid attributename.
Topicmanagement
403 SMN.0047 Parameter:Value exceedsthe maximumlength.
Enter a valid value.
Topicmanagement
400 SMN.0048 Parameter:Access policy isinvalid.
Enter a valid value foraccess_policy.
Topicmanagement
400 SMN.0049 Parameter:Access policyversion isinvalid.
Enter a valid accesspolicy version.
Topicmanagement
400 SMN.0050 Parameter:Access policy IDis invalid.
Enter a valid policy ID.
Topicmanagement
400 SMN.0051 Parameter:Access policystatement isinvalid.
Enter a valid policystatement.
Topicmanagement
400 SMN.0052 Parameter:Access policystatement ID isinvalid.
Enter a valid policystatement ID.
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 122
Module HTTPStatusCode
Error Code Error Message Handling Measure
Topicmanagement
400 SMN.0053 Parameter:Access policystatementresource isinvalid.
Enter a valid policystatement resource.
Topicmanagement
400 SMN.0054 Parameter:Access policystatement effectis invalid.
Enter a valid policystatement effect.
Topicmanagement
400 SMN.0055 Parameter:Access policystatementaction is invalid.
Enter a valid policystatement action.
Topicmanagement
400 SMN.0056 Parameter:Access policystatementprincipal isinvalid.
Enter a valid policystatement principal.
Topicmanagement
400 SMN.0058 Parameter:Access policystatementcondition isinvalid.
Enter a valid policystatement condition.
Topicmanagement
400 SMN.0072 Parameter:Service isinvalid.
Enter a valid value forservice.
Topicmanagement
400 SMN.0073 Parameter:Invalid action.
Enter a valid value foraction.
6.4 Obtaining a Project ID
ScenariosA project ID is required for some URLs when an API is called. Therefore, you needto obtain a project ID in advance. Two methods are available:
● Obtain the Project ID by Calling an API● Obtain the Project ID from the Console
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 123
Obtain the Project ID by Calling an APIYou can obtain the project ID by calling the API used to query for projects basedon specified criteria.
The API used to obtain a project ID is GET https://{Endpoint}/v3/projects.{Endpoint} is the IAM endpoint and can be obtained from Regions andEndpoints. For details about API authentication, see Authentication.
The following is an example response. The value of id is the project ID.
{ "projects": [ { "domain_id": "65382450e8f64ac0870cd180d14e684b", "is_domain": false, "parent_id": "65382450e8f64ac0870cd180d14e684b", "name": "project_name", "description": "", "links": { "next": null, "previous": null, "self": "https://www.example.com/v3/projects/a4a5d4098fb4474fa22cd05f897d6b99" }, "id": "a4a5d4098fb4474fa22cd05f897d6b99", "enabled": true } ], "links": { "next": null, "previous": null, "self": "https://www.example.com/v3/projects" }}
Obtain a Project ID from the ConsoleTo obtain a project ID from the console, perform the following operations:
1. Log in to the management console.2. Click the username and select My Credentials from the drop-down list.
On the API Credentials page, view the project ID in the project list.
Figure 6-1 Viewing the project ID
Simple Message NotificationAPI Reference 6 Public Parameters
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 124
A Appendix
A.1 Topic Attribute ListAttribute Name Function Default Value
access_policy Configures topic accesspolicy, which is used tolimit the accesspermission of otherusers.
Empty string
introduction Configures the topicintroduction, which isdisplayed in the email orSMS confirmationmessages.
Empty string
A.2 SMS Message Delivery Status (CMPP)Status Description
DELIVRD The message is successfully delivered.
EXPIRED Message delivery times out.
DELETED The message has been deleted.
UNDELIV The message delivery has failed.
ACCEPTD The message is accepted by the receiver.
UNKNOWN The message status is unknown.
REJECTD The message is rejected.
Simple Message NotificationAPI Reference A Appendix
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 125
A.3 Country/Region CodeCountry/Region Country/Region Code
Afghanistan 93
Albania 355
Algeria 213
American Samoa 1684
Andorra 376
Angola 244
Anguilla 1264
Antigua and Barbuda 1268
Argentina 54
Armenia 374
Aruba 297
Australia 61
Austria 43
Azerbaijan 994
Bahamas 1242
Bahrain 973
Bangladesh 880
Barbados 1246
Belarus 375
Belgium 32
Belize 501
Benin 229
Bermuda 1441
Bhutan 975
Bolivia 591
Bosnia and Herzegovina 387
Botswana 267
Brazil 55
Simple Message NotificationAPI Reference A Appendix
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 126
British Indian OceanTerritory
246
Brunei 673
Bulgaria 359
Burkina Faso 226
Burundi 257
Cambodia 855
Cameroon 237
Canada 1
Cape Verde 238
Cayman Islands 1345
Central African Republic 236
Chad 235
Chile 56
Colombia 57
Comoros 269
Republic Of The Congo 242
Democratic Republic ofthe Congo
243
Cook Islands 682
Costa Rica 506
Croatia 385
Curacao 599
Cyprus 357
Czechia 420
Denmark 45
Djibouti 253
Dominica 1767
Dominican Republic 1809
Ecuador 593
Egypt 20
El Salvador 503
Simple Message NotificationAPI Reference A Appendix
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 127
Equatorial Guinea 240
Eritrea 291
Estonia 372
Ethiopia 251
Falkland Islands 500
Faroe Islands 298
Fiji 679
Finland 358
France 33
French Guiana 594
French Polynesia 689
Gabon 241
Gambia 220
Georgia 995
Germany 49
Ghana 233
Gibraltar 350
Greece 30
Greenland 299
Grenada 1473
Guadeloupe 590
Guatemala 502
Guernsey 44
Guinea 224
Guinea-Bissau 245
Guyana 592
Haiti 509
Honduras 504
Hong Kong (China) 852
Hungary 36
Iceland 354
Simple Message NotificationAPI Reference A Appendix
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 128
India 91
Indonesia 62
Iraq 964
Ireland 353
Isle of Man 44
Israel 972
Italy 39
Ivory Coast 225
Jamaica 1876
Japan 81
Jersey 44
Jordan 962
Kazakhstan 7
Kenya 254
Kuwait 965
Kyrgyzstan 996
Laos 856
Latvia 371
Lebanon 961
Lesotho 266
Liberia 231
Libya 218
Liechtenstein 423
Lithuania 370
Luxembourg 352
Macau (China) 853
Macedonia 389
Madagascar 261
Malawi 265
Malaysia 60
Maldives 960
Simple Message NotificationAPI Reference A Appendix
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 129
Mali 223
Malta 356
Marshall Islands 692
Martinique 596
Mauritania 222
Mauritius 230
Mexico 52
Moldova 373
Monaco 377
Mongolia 976
Montenegro 382
Montserrat 1664
Morocco 212
Mozambique 258
Myanmar 95
Namibia 264
Nauru 674
Nepal 977
Netherlands 31
New Caledonia 687
New Zealand 64
Nicaragua 505
Niger 227
Nigeria 234
Niue 683
Norfolk Island 672
Norway 47
Oman 968
Pakistan 92
Palau 680
Palestinian Territory 970
Simple Message NotificationAPI Reference A Appendix
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 130
Panama 507
Papua New Guinea 675
Paraguay 595
Peru 51
Philippines 63
Poland 48
Portugal 351
Qatar 974
Réunion Island 262
Romania 40
Russia 7
Rwanda 250
Saint Kitts and Nevis 1869
Saint Lucia 1758
Saint Pierre and Miquelon 508
Saint Vincent and TheGrenadines
1784
Samoa 685
San Marino 378
Sao Tome and Principe 239
Saudi Arabia 966
Senegal 221
Serbia 381
Seychelles 248
Sierra Leone 232
Singapore 65
Sint Maarten (Dutch Part) 1721
Slovakia 421
Slovenia 386
Solomon Islands 677
Somalia 252
Simple Message NotificationAPI Reference A Appendix
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 131
South Africa 27
South Korea 82
Spain 34
Sri Lanka 94
Suriname 597
Swaziland 268
Sweden 46
Switzerland 41
Taiwan (China) 886
Tajikistan 992
Tanzania 255
Thailand 66
Timor L'este 670
Togo 228
Tonga 676
Trinidad and Tobago 1868
Tunisia 216
Turkey 90
Turkmenistan 993
Turks and Caicos Islands 1649
Tuvalu 688
Uganda 256
Ukraine 380
United Arab Emirates 971
United Kingdom 44
United States 1
Uruguay 598
Uzbekistan 998
Vanuatu 678
Venezuela 58
Vietnam 84
Simple Message NotificationAPI Reference A Appendix
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 132
Virgin Islands, British 1284
Wallis and Futuna 681
Yemen 967
Zambia 260
Zimbabwe 263
Simple Message NotificationAPI Reference A Appendix
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 133
B Change History
Date Description
2020-09-30 This issue is the fourteenth official release, whichincorporates the following changes:Optimized the entire document.
2019-07-05 This issue is the fourteenth official release, whichincorporates the following changes:Added "API Usage Guidelines" and "REST APIs".
2018-11-30 This issue is the thirteenth official release, whichincorporates the following changes:
2018-09-30 This issue is the twelfth official release, whichincorporates the following changes:Added Version Querying.
Simple Message NotificationAPI Reference B Change History
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 134
Date Description
2018-04-30 This issue is the eleventh official release, whichincorporates the following changes:● Added the "Error Code" section.● Added content for using TMS tags.● Added an API to send promotional SMS messages of
different content in batches.● Added the tags structure, match condition structure,
resource structure, resource tag structure, andpromotional SMS messaging result structure.
● Added description for error code 401.● Added error code description.● Updated description of error code SMN.0113.● Updated description for APIs to send promotional
SMS messages in batches, delete an SMS messagesignature, created an SMS message template, querySMS message templates, and query SMS messagetemplate details.
● Updated section "Country/Region Codes Supportedby SMS Messaging"
2018-03-30 This issue is the tenth official release, which incorporatesthe following changes:● Added the API to send transactional SMS messages in
batches.● Added the API to send different transactional SMS
messages to different phone numbers.● Added the SMS message delivery result structure.● Added the SMS message structure.● Added error code SMNE005.● Updated description for the API to send a
transactional SMS message.● Deleted the promotional SMS message delivery result
structure.
Simple Message NotificationAPI Reference B Change History
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 135
Date Description
2018-01-30 This issue is the ninth official release, which incorporatesthe following changes:● Added the API to create SMS message templates.● Added the API to list SMS message templates.● Added the API to query SMS message template
details.● Added the API to delete an SMS message template.● Added the API to send promotional SMS messages in
batches.● Updated error code description.● Added SMS message template structure description.● Added the promotional SMS message delivery result
structure.● Added SMS message event description.
2017-11-30 This issue is the eighth official release, whichincorporates the following changes:Added the FunctionGraph subscription protocol.
2017-10-30 This issue is the seventh official release, whichincorporates the following changes:● Added the DMS subscription protocol.● Added the API to query SMS message delivery status.● Added the API to query delivered SMS message
content.● Added the API to query SMS message events.● Added the API to update SMS message events.
2017-08-18 This issue is the sixth official release, which incorporatesthe following changes:Added the FunctionStage subscription protocol.
2017-06-30 This issue is the fifth official release, which incorporatesthe following changes:● Added SMS message signature APIs.● Added error code description for SMS message
signatures.
2017-03-13 This issue is the fourth official release, whichincorporates the following changes:Added the topic introduction attribute.
Simple Message NotificationAPI Reference B Change History
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 136
Date Description
2016-10-29 This issue is the third official release, which incorporatesthe following changes:● Added API names.● Modified the operation for generating the AK/SK.● Added the API for directly pushing an SMS message.
2016-09-30 This issue is the second official release, whichincorporates the following changes:● Added the API for querying topic attributes.● Added the API for modifying topic attributes.● Added the API for deleting a specified topic attribute.● Added the API for deleting all topic attributes.
2016-08-25 This issue is the first official release.
Simple Message NotificationAPI Reference B Change History
Issue 01 (2020-09-30) Copyright © Huawei Technologies Co., Ltd. 137