To send a Short Message Service (SMS) API request, you must send an HTTP GET request to the SMS endpoint. You must add the request parameters that correspond to the API operation being called. After you call the API, the system returns a response.

Request syntax

SMS API operations use the RPC protocol. You can call SMS API operations by sending HTTP GET requests. SMS supports both HTTP and HTTPS requests. For data security, we recommend that you send HTTPS requests. All requests and responses are encoded in UTF-8. The request syntax is described as follows:

https://Endpoint/?Action=xx&Version=xx&Parameters
  • Endpoint: the endpoint of the SMS API. The endpoint is Dysmsapi.aliyuncs.com.
  • Action: the name of the operation being performed. For example, to send text messages, you must set the Action parameter to SendSms.
  • Version: the version of the SMS API. The current SMS API version is 2018-05-01.
  • Parameters: the request parameters for the operation. Separate multiple parameters with ampersands (&). Request parameters include both common parameters and operation-specific parameters. Common parameters specify the information such as the API version and identity credentials. For more information, see Common parameters.

The following example demonstrates how to call the SendSms operation in SMS to send text messages:

Note The following sample code has been formatted to improve readability.
http(s)://dysms.aliyuncs.com? Action=SendSms
&ContentCode=SMS_0000
&PhoneNumbers=["123","456","789"]
&ContentParam={"code":"1234","product":"ytx"}
&ExternalId=abcdefgh
&SignName=Alibaba Cloud
&<Common request parameters>