营销短信API

接口说明:客户接口部分提供WebService方式的接口,接口编码方式采用统一的UTF-8,如需HTTP协议接口,请联系客服

一、发送接口

请求地址是客户接口程序调用时请求的WebService地址,地址是

http://客户端地址/SmsWebService.asmx?wsdl

入口地址一般不会发生变化,当发生变化的时候,会通知接口用户

二、发送接口

2.1 调用接口

SendSms(string userid, string account, string password, string mobile, string content, string sendTime, string extno)

2.2 参数说明

参数名称 含义 说明
userid 企业id 企业ID
account 发送用户帐号 用户帐号
password 发送帐号密码 用户账号对应的密码
mobile 全部被叫号码 发信发送的目的号码.多个号码之间用半角逗号隔开
content 发送内容 短信的内容,内容需要UTF-8编码
sendTime 定时发送时间 为空表示立即发送,定时发送格式2010-10-24 09:08:10
extno 扩展子号 请先询问配置的通道是否支持扩展子号,如果不支持,请填空。子号只能为数字,且最多10位数

2.3 请求和响应

响应为WsSendResponse,具体定义如下:

元素名称 含义 说明
ReturnStatus 任务状态 Success 成功,Faild 失败
Message 描述 提交成功为 ok,其他为失败信息的描述
RemainPoint 剩余短信条数 剩余短信条数
TaskID 任务ID 每批次任务唯一的ID,用来匹配状态报告
SuccessCounts 成功条数 成功提交的号码数

2.3.1 SOAP 1.2请求

以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值

POST /clientsite/SmsWebService.asmx HTTP/1.1

Host: localhost

Content-Type: application/soap+xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" > < /soap12:Envelope >

< soap12:Body >

< SendSms xmlns="http://tempuri.org/" >

< userid > string < /userid >

< account > string < /account >

< password > string < /password >

< mobile > string < /mobile >

< content > string < /content >

< sendTime > string < /sendTime >

< extno > string < /extno >

< /SendSms >

< /soap12:Body >

< /soap12:Envelope >

2.3.2 SOAP 1.2响应

HTTP/1.1 200 OK

Content-Type: application/soap+xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"?>

< soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">

< soap12:Body >

< SendSmsResponse xmlns="http://tempuri.org/" >

< SendSmsResult >

< ReturnStatus >string< /ReturnStatus >

< Message >string< /Message >

< RemainPoint >int< /RemainPoint >

< TaskID >int< /TaskID >

< SuccessCounts >int< /SuccessCounts >

< /SendSmsResult >

< /SendSmsResponse >

< /soap12:Body >

< /soap12:Envelope >

2.3.3 HTTP POST请求

以下是 HTTP POST 请求和响应示例。所显示的占位符需替换为实际值。

POST /clientsite/SmsWebService.asmx/SendSms HTTP/1.1

Host: localhost

Content-Type: application/x-www-form-urlencoded

Content-Length: length

userid=string &account=string& password=string &mobile=string &content=string &sendTime=string &extno=

2.3.4 HTTP POST请求

HTTP/1.1 200 OK

Content-Type: text/xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< WsSendResponse xmlns="http://tempuri.org/" >

< ReturnStatus >string< /ReturnStatus >

< Message >string< /Message >

< RemainPoint >int< /RemainPoint >

< TaskID >int< /TaskID >

< SuccessCounts >int< /SuccessCounts >

< /WsSendResponse >

三、余额接口

3.1 调用接口

QueryOverage(string userid, string account, string password)

3.2 参数说明

参数名称 含义 说明
userid 企业id 企业ID
account 用户帐号 用户帐号
password 帐号密码 用户账号对应的密码

3.3 请求和响应

响应为WsOverageResponse,具体定义如下:

元素名称 含义 说明
ReturnStatus 获取状态 Success 成功,Faild 失败
Message 描述 获取成功为 ok,其他为失败信息的描述
PayInfo 付费方式 预付费,后付费
Overage 余额 剩余余额
SendTotal 总条数 总充值条数

3.3.1 SOAP 1.2请求

以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。

POST /clientsite/SmsWebService.asmx HTTP/1.1

Host: localhost

Content-Type: application/soap+xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" >

< soap12:Body >

< QueryOverage xmlns="http://tempuri.org/" >

< userid >string< /userid >

< account >string< /account >

< password >string< /password >

< /QueryOverage >

< /soap12:Body >

< /soap12:Envelope >

3.3.2 SOAP 1.2响应

HTTP/1.1 200 OK

Content-Type: application/soap+xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" >

< soap12:Body >

< QueryOverageResponse xmlns="http://tempuri.org/" >

< QueryOverageResult >

< ReturnStatus >string< /ReturnStatus >

< Message >string< /Message >

< PayInfo >string< /PayInfo >

< Overage >int< /Overage >

< SendTotal >int< /SendTotal >

< /QueryOverageResult >

< /QueryOverageResponse >

< /soap12:Body >

< /soap12:Envelope >

3.3.3 HTTP POST请求

以下是 HTTP POST 请求和响应示例。所显示的占位符需替换为实际值。

POST /clientsite/SmsWebService.asmx/QueryOverage HTTP/1.1

Host: localhost

Content-Type: application/x-www-form-urlencoded

Content-Length: length

userid=string &account=string &password=string

3.3.4 HTTP POST响应

HTTP/1.1 200 OK

Content-Type: text/xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< WsOverageResponse xmlns="http://tempuri.org/" >

< ReturnStatus >string< /ReturnStatus >

< Message >string < /Message >

< PayInfo >string< /PayInfo >

< Overage >int< /Overage >

< SendTotal >int< /SendTotal >

< /WsOverageResponse >

四、状态报告接口

注意:相同的状态报告,只能获取一次。

4.1 调用接口

QueryStatus(string userid, string account, string password, string statusNum)

4.2 参数说明

参数名称 含义 说明
userid 企业id 企业ID
account 用户帐号 用户帐号
password 帐号密码 用户账号对应的密码
statusNum 每次取得号码数 必须为数字,默认4000,可不填,最小10,最大10000

4.3 请求和响应

响应为WsStatusResponse,具体定义如下:

父元素名称 元素名称 含义 说明
QueryStatusResult ReturnStatus 获取状态 1 成功,0 暂无状态报告,其它状态皆为失败,具体失败原因见描述
QueryStatusResult Message 描述 获取成功为 ok,其他为失败信息的描述
QueryStatusResult StatusList 状态列表 状态列表
StatusList WsStatusBox+ 状态容器 后面加号表示一个状态列表内可由多个容器组合
WsStatusBox Mobile 手机号码 接收手机号码
WsStatusBox TaskID 任务ID 发送短信时返回的任务ID
WsStatusBox Status 状态 10 发送成功,20 发送失败
WsStatusBox ReceiveTime 接收时间 手机接收短信时间
WsStatusBox ErrorCode 发送返回值 由上级通道返回,不同的通道返回值可能不同,部分通道返回值为 DELIVRD
WsStatusBox Extno 子号 即自定义扩展号

4.3.1 SOAP 1.2请求

以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。

POST /clientsite/SmsWebService.asmx HTTP/1.1

Host: localhost

Content-Type: application/soap+xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" >

< soap12:Body >

< QueryStatus xmlns="http://tempuri.org/" >

< userid >string< /userid >

< account >string< /account >

< password >string< /password >

< statusNum >string< /statusNum >

< /QueryStatus >

< /soap12:Body >

< /soap12:Envelope >

4.3.2 SOAP 1.2响应

HTTP/1.1 200 OK

Content-Type: application/soap+xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" >

< soap12:Body >

< QueryStatusResponse xmlns="http://tempuri.org/" >

< QueryStatusResult >

< ReturnStatus >int< /ReturnStatus >

< Message >string< /Message >

< StatusList >

< WsStatusBox >

< Mobile >string< /Mobile >

< TaskID >int< /TaskID >

< Status >int< /Status >

< ReceiveTime >string< /ReceiveTime >

< ErrorCode >string< /ErrorCode >

< Extno >string< /Extno >

< /WsStatusBox >

< WsStatusBox >

< Mobile >string< /Mobile >

< TaskID >int< /TaskID >

< Status >int< /Status >

< ReceiveTime >string< /ReceiveTime >

< ErrorCode >string< /ErrorCode >

< Extno >string< /Extno >

< /WsStatusBox >

< /StatusList >

< /QueryStatusResult >

< /QueryStatusResponse >

< /soap12:Body >

< /soap12:Envelope >

4.3.3 HTTP POST请求

以下是 HTTP POST 请求和响应示例。所显示的占位符需替换为实际值

POST /clientsite/SmsWebService.asmx/QueryStatus HTTP/1.1

Host: localhost

Content-Type: application/x-www-form-urlencoded

Content-Length: length

userid=string &account=string &password=string &statusNum=string

4.3.4 HTTP POST响应

HTTP/1.1 200 OK

Content-Type: text/xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< WsStatusResponse xmlns="http://tempuri.org/" >

< ReturnStatus >int< /ReturnStatus >

< Message >string< /Message >

< StatusList >

< WsStatusBox >

< Mobile >string< /Mobile >

< TaskID >int< /TaskID >

< Status >int< /Status >

< ReceiveTime >string< /ReceiveTime >

< ErrorCode >string< /ErrorCode >

< Extno >string< /Extno >

< /WsStatusBox >

< WsStatusBox >

< Mobile >string< /Mobile >

< TaskID >int< /TaskID >

< Status >int< /Status >

< ReceiveTime >string< /ReceiveTime >

< ErrorCode >string< /ErrorCode >

< Extno >string< /Extno >

< /WsStatusBox >

< /StatusList >

< /WsStatusResponse >

五、上行回复接口

注意:相同的上行回复,只能获取一次

5.1 调用接口

QueryCall(string userid, string account, string password, string callNum)

5.2 参数说明

参数名称 含义 说明
userid 企业id 企业ID
account 用户帐号 用户帐号
password 帐号密码 用户账号对应的密码
callNum 每次取得号码数 必须为数字,默认500,可不填,最小10,最大10000

5.3 请求和响应

响应为WsCallResponse,具体定义如下:

父元素名称 元素名称 含义 说明
QueryStatusResult ReturnStatus 获取状态 1 成功, 0 暂无上行回复,其它状态皆为失败,具体失败原因见描述
QueryCallResult Message 描述 获取成功为 ok,其他为失败信息的描述
QueryCallResult CallList 上行列表 上行列表
CallList WsCallBox+ 上行容器 后面加号表示一个上行列表内可由多个容器组合
WsCallBox Mobile 手机号码 上行手机号码
WsCallBox TaskID 任务ID 发送短信时返回的任务ID,如果是直接上行,这里可能为空
WsCallBox Content 上行内容 上行回复的内容
WsCallBox ReceiveTime 接收时间 手机上行短信时间
WsCallBox Extno 子号 即自定义扩展号

5.3.1 SOAP 1.2请求

以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。

POST /clientsite/SmsWebService.asmx HTTP/1.1

Host: localhost

Content-Type: application/soap+xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" >

< soap12:Body >

< QueryCall xmlns="http://tempuri.org/" >

< userid >string< /userid >

< account >string< /account >

< password >string< /password >

< callNum >string< /callNum >

< /QueryCall >

< /soap12:Body >

< /soap12:Envelope >

5.3.2 SOAP 1.2响应

HTTP/1.1 200 OK

Content-Type: application/soap+xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" >

< soap12:Body >

< QueryCallResponse xmlns="http://tempuri.org/" >

< QueryCallResult >

< ReturnStatus >int< /ReturnStatus >

< Message >string< /Message >

< CallList >

< WsCallBox >

< /WsCallBox >

< TaskID >int< /TaskID >

< Content >string< /Content >

< ReceiveTime >string< /ReceiveTime >

< Extno >string< /Extno >

< /WsCallBox >

< WsCallBox >

< Mobile >string< /Mobile >

< TaskID >int< /TaskID >

< Content >string< /Content >

< ReceiveTime >string< /ReceiveTime >

< Extno >string< /Extno >

< /WsCallBox >

< /CallList >

< /QueryCallResult >

< /QueryCallResponse >

< /soap12:Body >

< /soap12:Envelope >

5.3.3 HTTP POST请求

以下是 HTTP POST 请求和响应示例。所显示的占位符需替换为实际值。

POST /clientsite/SmsWebService.asmx/QueryCall HTTP/1.1

Host: localhost

Content-Type: application/x-www-form-urlencoded

Content-Length: length

userid=string &account=string &password=string &callNum=string

5.3.4 HTTP POST响应

HTTP/1.1 200 OK

Content-Type: text/xml; charset=utf-8

Content-Length: length

< ?xml version="1.0" encoding="utf-8"? >

< WsCallResponse xmlns="http://tempuri.org/" >

< ReturnStatus >int< /ReturnStatus >

< Message >string< /Message >

< CallList >

< WsCallBox >

< Mobile >string< /Mobile >

< TaskID >int< /TaskID >

< Content >string< /Content >

< ReceiveTime >string< /ReceiveTime >

< Extno >string< /Extno >

< /WsCallBox >

< WsCallBox >

< Mobile >string< /Mobile >

< TaskID >int< /TaskID >

< Content >string< /Content >

< ReceiveTime >string< /ReceiveTime >

< Extno >string< /Extno >

< /WsCallBox >

< /CallList >

< /WsCallResponse >