一、 文档概述
1.1格式说明
1.1.1调用方式明
使用http协议调用,可以GET也可以POST调用,也可以直接使用浏览器打开接口地址进行访问,和测试。
1.1.2提交编码
提交的数据要求UTF-8编码,要注意在浏览器高级选项中选中"总是以UTF-8发送URL"。
1.1.3多线程访问
开通的账号默认最大线程数为3个,如果线程并发量超出会报错,导致提交失败,多次超限并发访问可能会锁账号。如需对账号开启更多线程,请联系我们相关人员开启。
1.2加密算法说明
1.2.1 seqid
序列号(seqid)格式 : yyMMddHHmmssxxxxxx 前十二位为时间,后六位为自定义数字,例 160615134758000001
1.2.2 sign
签名(sign) : md5(seqid + md5(password)), md5为32位小写格式
二、 功能接口说明
2.1发送短信
2.1.1接口地址
HTTPS:https://sms.ccell.cn/sms3_api/jsonapi/jsonrpc2.jsp
2.1.2参数说明
2.1.2.1请求参数
请求包体必须为标准的JSON
请求包体说明:
{ "id": id , "method":"接口类型,发送为send(必填)", "params":{ "userid":"账号(必填)", "seqid":"序列号(必填,必须唯一)", "sign":"签名(必填)", "submit": [{ "content":"短信内容(必选)", "phone":"电话号码,若多个号码用”,”隔开(必选)" },{ "content":"短信内容(必选)", "phone":"电话号码,若多个号码用”,”隔开(必选)" }, …… ,{ "content":"短信内容(必选)", "phone":"电话号码,若多个号码用”,”隔开(必选)" }] } }
注意:每次请求提交的号码数请控制在500个以内。多个号码的分隔符为英文半角”,”。
请求包体示例(密码为123456):
{ "id":1, "method":"send", "params":{ "userid":"200001", "seqid":"160615134758000001", "sign":"d679463dd87931f880095f213e3ae96f", "submit":[ { "content":"验证码为1234。【签名】", "phone":"13800000000,13600000xxx" },{ "content":"验证码为1235。【签名】", "phone":"13800000001" }, ...... ,{ "content":"验证码为1334。【签名】", "phone":"13800300000" }] } }
请求示例(Get):
https://sms.ccell.cn/sms3_api/jsonapi/jsonrpc2.jsp?{"id":1,"method":"send","params":{"userid":"200001","seqid" : "160615134758000001","sign":"d679463dd87931f880095f213e3ae96f","submit":[{"content":"验证码为1234。【签名】","phone":"13800000000,13600001234"},{"content":"验证码为1235。【签名】","phone":"13800000001"},{"content":"验证码为1334。【签名】","phone":"13800300000"}]}}
2.1.2.2返回值说明
返回值为标准的JSON
返回值包体说明:
{ "id":id, "result":[{ "info":"描述", "msgid":"序列号", "phone":"手机号码", "return":"状态码" },{ "info":"描述", "msgid":"序列号", "phone":"手机号码", "return":"状态码" }, ...... { "info":"描述", "msgid":"序列号", "phone":"手机号码", "return":"状态码" }] }
返回值包体示例:
{ "id":1, "result":[{ "info":"成功", "msgid":"4495599595170205200", "phone":"13800000000", "return":"0" },{ "info":"成功", "msgid":"4495599595680112600", "phone":"13800000001", "return":"0" }, ...... { "info":"成功", "msgid":"4495599598710528600", "phone":"13800300000", "return":"0" }] }
注意:msgid为唯一序列,状态报告会原样返回。如果验证不成功会返回{"error":{"code":状态码,"message":"描述"},"id":1}形式的返回值。
2.2获取状态报告
2.2.1接口地址
https://sms.ccell.cn/sms3_api/jsonapi/jsonrpc2.jsp
2.2.2参数说明
2.2.2.1请求参数
请求包体必须为标准的JSON
请求包体说明:
{ "id":id, "method":"接口类型,状态为report(必填)", "params":{ "userid":"账号(必填)", "seqid":"序列号(必填,必须唯一)", "sign":"签名(必填)" } }
请求包体示例(密码为123456):
{ "id":1, "method":"report", "params":{ "userid":"200001", "seqid":"160615134758000001", "sign":"d679463dd87931f880095f213e3ae96f" } }
请求示例(Get):
https://sms.ccell.cn/sms3_api/jsonapi/jsonrpc2.jsp?{"id":1,"method":"report","params":{"userid":"200001","seqid" : "160615134758000001","sign":"d679463dd87931f880095f213e3ae96f"}}
2.2.2.2返回值说明
返回值为标准的JSON
返回值包体说明:
{ "id":id, "result":[ { "info":"描述", "linkid":"原样返回的自定义序列码,没有使用为空", "msgid":"序列号", "phone":"手机号码", "recvtime":"时间", "status":"状态码" },{ "info":"描述", "linkid":"原样返回的自定义序列码,没有使用为空", "msgid":"序列号", "phone":"手机号码", "recvtime":"时间", "status":"状态码" }, ...... ,{ "info":"描述", "linkid":"原样返回的自定义序列码,没有使用为空", "msgid":"序列号", "phone":"手机号码", "recvtime":"时间", "status":"状态码" }] }
返回值包体示例:
{ "id":1, "result" : [{ "info" : "成功", "linkid" : "100001111110", "msgid" : "4495599595170205200", "phone" : "13800000000", "recvtime" : "2015-10-10 10:54:15.0", "status" : "0" }, { "info" : "ERRORRD", "linkid" : "100001111111", "msgid" : "4495599595680112600", "phone" : "13800000001", "recvtime" : "2015-10-10 10:54:15.0", "status" : "-1" }, ...... ,{ "info" : "成功", "linkid" : "100001111112", "msgid" : "4495599598710528600", "phone" : "13800300000", "recvtime" : "2015-10-10 10:54:15.0", "status" : "0" }] }
注意:每次连接最多返回300条状态。如果没有状态会返回空的{"id":1,"result":[]}。如果验证不成功会返回{"error":{"code":状态码,"message":"描述"},"id":1}形式的返回值。
2.3获取上行
2.3.1接口地址
https://sms.ccell.cn/sms3_api/jsonapi/jsonrpc2.jsp
2.3.2参数说明
2.3.2.1请求参数
请求包体必须为标准的JSON
请求包体说明:
{ "id":id, "method":"接口类型,上行为upmsg (必填)", "params":{ "userid":"账号(必填)", "seqid":"序列号(必填,必须唯一)", "sign":"签名(必填)" } }
请求包体示例(密码为123456):
{ "id":1, "method":"upmsg", "params":{ "userid":"200001", "seqid":"160615134758000001", "sign":"d679463dd87931f880095f213e3ae96f" } }
请求示例(Get):
https://sms.ccell.cn/sms3_api/jsonapi/jsonrpc2.jsp?{"id":1,"method":"upmsg","params":{"userid":"200001","seqid" : "160615134758000001","sign":"d679463dd87931f880095f213e3ae96f"}}
2.3.2.2返回值说明
返回值为标准的JSON
返回值包体说明:
{ "id" : id, "result" : [{ "msgcontent" : "上行内容", "phone" : "手机号码", "spnumber" : "端口号", "motime" : "时间" }, { "msgcontent" : "上行内容", "phone" : "手机号码", "spnumber" : "端口号", "motime" : "时间" }, ...... ,{ "msgcontent" : "上行内容", "phone" : "手机号码", "spnumber" : "端口号", "motime" : "时间" }] }
返回值包体示例:
{ "id" : 1, "result" : [{ "msgcontent" : "知道了", "phone" : "13800000000", "spnumber" : "0001", "motime" : "2015-10-10 17:48:46" }, { "msgcontent" : "ok", "phone" : "13800000001", "spnumber" : "0001", "motime" : "2015-10-10 18:15:19" }, ...... , { "msgcontent" : "收到", "phone" : "13800300000", "spnumber" : "0001", "motime" : "2015-10-10 18:15:29" }] }
注意:每次连接最多返回100条上行。如果没有上行会返回空的{"id":1,"result":[]}。如果验证不成功会返回{"error":{"code":状态码,"message":"描述"},"id":1}形式的返回值。
2.4发送短信高级附加功能
2.4.1接口地址
https://sms.ccell.cn/sms3_api/jsonapi/jsonrpc2.jsp
2.4.2参数说明
2.4.2.1请求参数
特别提醒:
该功能是在普通发送短信的基础上增加了可选参数sendtime、linkid、spcode。spcode的功能短信账号默认未开通,如果未开通的情况下使用,提交短信会报错,不能正常提交,请谨慎操作。如需spcode功能请联系相关人员开通。
请求包体必须为标准的JSON
请求包体说明:
{ "id" : id, "method" : "接口类型,发送为send(必填)", "params" : { "userid" : "账号(必填)", "seqid":"序列号(必填,必须唯一)", "sign":"签名(必填)", "submit" : [{ "content " : "短信内容(必选)", "phone " : "电话号码,若多个号码用”,”隔开(必选)", "sendtime " : "定时发送时间,不选或空为立即发送(可选)", "linkid " : "自定义序列码,状态报告会原样返回(可选)", "spcode " : "扩展号(可选,未分配不要使用)" }, { "content " : "短信内容(必选)", "phone " : "电话号码,若多个号码用”,”隔开(必选)", "sendtime " : "定时发送时间,不选或空为立即发送(可选)", "linkid " : "自定义序列码,状态报告会原样返回(可选)", "spcode " : "扩展号(可选,未分配不要使用)" }, ...... , { "content " : "短信内容(必选)", "phone " : "电话号码,若多个号码用”,”隔开(必选)", "sendtime " : "定时发送时间,不选或空为立即发送(可选)", "linkid " : "自定义序列码,状态报告会原样返回(可选)", "spcode " : "扩展号(可选,未分配不要使用)" }] } }
注意:phone、content为必选参数。sendtime 、linkid、spcode为可选参数。sendtime时间格式为YYYY-MM-DD HH:MM:SS(如:2016-01-01 08:30:30)。spcode需要账号支持才能使用,如果账号未分配扩展号,请不要使用。每次请求提交的号码数请控制在500个以内。多个号码的分隔符为英文半角”,”。
请求包体示例(密码为123456):
{ "id" : 1, "method" : send, "params" : { "userid" : "200001", "seqid":"160615134758000001", "sign":"d679463dd87931f880095f213e3ae96f", "submit" : [{ "content " : "验证码为1234。【签名】", "phone" : "13800000000,13600000xxx", "sendtime" : "2016-01-01 08:30:30", "linkid" : "100001111110", "spcode " : "168168" }, { "content " : "验证码为1235。【签名】", "phone" : "13800000001", "sendtime" : "2016-01-01 08:30:30", "linkid" : "100001111111", "spcode" : "168168" }, ...... , { "content " : "验证码为1334。【签名】", "phone" : "13800300000", "sendtime" : "2016-01-01 08:30:30", "linkid" : "100001111112", "spcode" : "168168" }] } }
请求示例(Get):
https://sms.ccell.cn/sms3_api/jsonapi/jsonrpc2.jsp?{"id":1,"method":"send","params":{"userid":"200001","seqid" : "160615134758000001","sign":"d679463dd87931f880095f213e3ae96f","submit":[{"content":"验证码为1234。【签名】","phone":"13800000000,13600001234","sendtime": "2016-01-01 08:30:30","linkid":"100001111110","spcode":"168168"},{"content":"验证码为1235。【签名】","phone":"13800000001","sendtime": "2016-01-01 08:30:30","linkid":"100001111111","spcode":"168168"},{"content":"验证码为1334。【签名】","sendtime": "2016-01-01 08:30:30","phone":"13800300000","linkid":"100001111112","spcode":"168168"}]}}
2.4.2.2返回值说明
返回值为标准的JSON
返回值包体说明:
{ "id" : id, "result" : [{ "info" : "描述", "linkid" : "自定义序列码", "msgid" : "序列号", "phone" : "手机号码", "return" : "状态码" }, { "info" : "描述", "linkid" : "自定义序列码", "msgid" : "序列号", "phone" : "手机号码", "return" : "状态码" }, ...... { "info" : "描述", "linkid" : "自定义序列码", "msgid" : "序列号", "phone" : "手机号码", "return" : "状态码" }] }
返回值包体示例:
{ "id" : 1, "result" : [{ "info" : "成功", "linkid" : "100001111110", "msgid" : "4495599595170205200", "phone" : "13800000000", "return" : "0" }, { "info" : "成功", "linkid" : "100001111111", "msgid" : "4495599595680112600", "phone" : "13800000001", "return" : "0" }, ...... { "info" : "成功", "linkid" : "100001111112", "msgid" : "4495599598710528600", "phone" : "13800300000", "return" : "0" }] }
注意:msgid为唯一序列,状态报告会原样返回。如果验证不成功会返回{"error":{"code":状态码,"message":"描述"},"id":1}形式的返回值。
2.5查看用户信息
2.5.1接口地址
https://sms.ccell.cn/sms3_api/jsonapi/jsonrpc2.jsp
2.5.2参数说明
2.5.2.1请求参数
请求包体必须为标准的JSON
请求包体说明:
{ "id" : id, "method" : "接口类型,用户信息为info(必填)", "params" : { "userid" : "账号(必填)", "password " : "密码(必填)" } }
请求包体示例:
{ "id" : 1, "method" : info, "params" : { "userid" : "200001", "password " : "123456" } }
请求示例(Get):
https://sms.ccell.cn/sms3_api/jsonapi/jsonrpc2.jsp?{"id":1,"method":"info","params":{"userid":"200001","password":"123456"}}
2.5.2.2返回值说明
返回值为标准的JSON
返回值包体说明:
{ "id" : id, "result" : { "API_THREADS" : "线程数", "CREDIT" : "信用额", "API_CALLBACK" : "回调地址,HTTP,SGIP1.2中有用", "API_PARAMS" : "API 参数", "PRODUCTID" : "产品ID", "API_TYPE" : "接口类型:HTTP,XML/HTTP,JOSN/HTTP,CMPP2.0,CMPP3.0,SGMP3.0,SGIP1.2", "NAME" : "用户名,云平台的登录账号", "SMS_SUFFIX" : "短信后缀", "SIGNCODE" : "签名,空:不验签名,*:任意签名,其它:指定签名多个用,分开.用于其于账号的签名认证,发送时还要通过基于通道的签名认证", "STATUS" : "状态:0正常,1.停用", "API_SPEED" : "发送速度控值", "ID" : "短信帐号", "RICHES" : "余额", "API_USERIP" : "用户IP限制", "CREATETIME" : "创建时间" } }
返回值包体示例:
{ "id" : 1, "result" : { "API_THREADS" : "1", "CREDIT" : "0", "API_CALLBACK" : "", "API_PARAMS" : "", "PRODUCTID" : "sms002", "API_TYPE" : "HTTP", "NAME" : "aser24571@163.com", "SMS_SUFFIX" : "", "SIGNCODE" : "*", "STATUS" : "0", "API_SPEED" : "400", "ID" : "200001", "RICHES" : "100000010", "API_USERIP" : "", "CREATETIME" : "" } }
三、 附件
3.1状态码说明
状态码 | 说明 |
0 | 成功 |
1001001 | 参数不完整 |
1001002 | 余额不足 |
1001003 | 账号已冻结 |
1001004 | 密码不正确 |
1001005 | 访问IP受限 |
1001006 | 并发数超限 |
1001007 | 短信附加语不符 |
1004001 | 手机号不可识别 |
1004002 | 未配置有效发送规则 |
1004003 | 短信内容必须有签名 |
1004004 | 短信内容必须指定签名 |
1004005 | 短信内容指定签名 |
1004006 | 无可用通道 |
1004007 | 模板不匹配 |
1004008 | 不能发黑名单号码 |
1004009 | 非白名单号码 |
1004010 | 不能发黑词内容 |
1004011 | 内容中不包括白词 |
1004012 | 定时发送时间参数不正确 |
1004013 | 定时发送时间不能大于50天 |
1004014 | 定时发送时间不能小于当前时间 |
1004015 | 短信签名限20字符 |
1001999 | 接口系统错 |