sendsms
概览
- API URL:/api/v1/zoloz/globalsms/sendsms
- API 描述:该接口用于将指定的短信内容发送给指定的手机号码。目前仅支持向部分归属地的号码发送短信,具体请与ZOLOZ对接人员沟通。
计费说明
当sendsms API调用成功,resultStatus
=S
时,则收取短信费。
短信类型 | 计费说明 |
纯英文短信(GSM-7编码) |
|
其他语言短信(UCS-2编码) |
|
请求参数
字段名称 | 数据类型 | 最大长度 | 是否必填 | 默认值 | 描述 | 示例值 |
mobile | String | 20 | 是 | - | 接收短信的手机号码。号码格式为国际区号+号码。 | "6221245567****" |
message | String | 2000 | 是 | - | 短信内容。 | "123456 is your verification code. Don't share it with anyone." |
bizType | String | - | 是 | - | 短信对应的业务类型。取值如下:
说明:请传入正确的 | "1" |
senderId | String | 256 | 否 | 平台默认的senderId | 用户收到短信后显示的发件人。具体请与ZOLOZ对接人员沟通并注册 说明:客户测试时如果没有 | "U****e" |
返回参数
字段名称 | 数据类型 | 必须返回 | 描述 | 示例值 |
result | 是 | API请求结果,包含结果状态、结果码和结果消息。 | { "resultStatus": "S", "resultCode": "SUCCESS", "resultMessage": "Success" } | |
transactionId | String | 否 | ZOLOZ服务器生成的唯一事务ID。此ID将作为Global SMS querysms API请求的输入参数。 说明:当短信发送过程中出现错误时,例如参数无效,则不返回事务ID。 | "G0062000061MT20230325dAqiXBpQUbVB9h****" |
处理结果
根据请求结果执行下一步的响应动作,具体如下:
- 当result.resultStatus的值为
S
时,表示调用ZOLOZ Global SMS sendsms API成功。 - 当result.resultStatus的值为
F
时,表示调用ZOLOZ Global SMS sendsms API失败。请检查错误码获取有关该错误的更多信息,并分析导致该错误的原因。
API通用结果码
有关通用结果码的完整列表,请参见API通用结果码。
API特有结果码
Global SMS sendsms API的结果码见下表。
结果码 | 结果状态 | 英文描述 | 中文描述 |
SUCCESS | S | Success | API调用成功 |
RETRY_LATER | F | Please retry after 10 seconds | 请在10秒后重试 |
CONTENT_TOO_LONG | F | The content is too long | 短信内容太长 |
INVALID_PHONE_NUMBER | F | Invalid phone number, please check the phone number format | 电话号码无效,请检查电话号码的格式。 |
INVALID_PHONE_NUMBER_QUANTITY | F | Invalid phone number quantity, please check the phone number quantity | 电话号码数量无效,请检查电话号码数量。 |
SENDERID_TOO_LONG | F | SenderId is too long | senderId太长 |
INVALID_CONTENT | F | The content is invaild | 短信内容无效 |
INVALID_CONTENT_OR_OTP | F | The content or the OTP is invalid | 简介或验证码不能为空 |
FREQUENCY_LIMIT_DAY | F | The specific phone number cannot be sent more than ten times on the same day | 特定电话号码在同一天内的发送次数不能超过十次。 |
QUANTITY_LIMIT_DAY | F | Sending quantity limit for the single number or the account | 单个号码或账户的发送数量限制 |
CONTENT_INCONSISTENT | F | The content is inconsistent | 内容不一致 |
MERCHANT_INFO_MISSING | F | Merchant info missing | 商户信息丢失 |
EXTERNAL_ERROR | F | External error | 外部错误 |
ILLEGAL_STATE | F | Illegal state | 非法状态 |
PARAM_ERROR | F | Param error | 参数错误 |
UNKNOWN_EXCEPTION | F | Unknown exception | 未知错误 |
代码示例
请求示例
{
"mobile": "6221245567****",
"message": "123456 is your verification code. Don't share it with anyone.",
"bizType": "1",
"senderId": "U****e"
}
返回示例
{
"result": {
"resultCode": "SUCCESS",
"resultMessage": "Success",
"resultStatus": "S"
}
"transactionId": "G0062000061MT20230325dAqiXBpQUbVB9h****"
}