======对接接口====== **Rest 包头标准**
注意: 为了确保数据隐私和安全, REST API须通过HTTPS方式请求
**请求URL**
https://api.ucpaas.com/{SoftVersion}/Accounts/{accountSid}/{function}/{operation}?sig={SigParameter}
**URL参数属性说明**\\
^属性 ^ ^说明 ^
|SoftVersion | |云之讯REST API版本号,当前版本号为:2014-06-30 |
|Account | |此参数为默认固定值 |
|accountSid | | 注册云之讯官网,在控制台中即可获取此参数 |
|function | | 业务功能 |
|operation | | 业务操作,业务功能的各类具体操作分支 |
|SigParameter | | 请求URL必须带有此参数 |
**HTTP标准包头字段(必填)** \\
^属性 ^ ^说明 ^
|Accept | |客户端响应接收数据格式:application/xml、application/json |
|Content-Type | |类型:application/xml;charset=utf-8、application/json;charset=utf-8 |
|Authorization | |验证信息 |
|Content-Length | |包体长度 |
**关键点**\\
SigParameter是REST API 验证参数:
1、URL后必须带有sig参数,sig= MD5(账户Id + 账户授权令牌 + 时间戳),共32位(注:转成大写)
2、使用MD5加密(账户Id + 账户授权令牌 + 时间戳),共32位
3、时间戳是当前系统时间(24小时制),格式“yyyyMMddHHmmss”。时间戳有效时间为50分钟
Authorization是包头验证信息:
1、使用Base64编码(账户Id + 冒号 + 时间戳)
2、冒号为英文冒号
3、时间戳是当前系统时间(24小时制),格式“yyyyMMddHHmmss”,需与SigParameter中时间戳相同
**开发者信息说明**
1.开发者账号ID--Account Sid
a.开发者在UcPaaS平台的唯一标示,在SDK登录、REST请求中使用;
b.开发者账号ID在网站注册后,系统自动生成,不可以更改
2.账户授权令牌--Auth Token
a.相当于开发者账号ID(Account Sid)的密码,在SDK登录、REST请求中使用;
b.系统自动生成;如果出现开发者Token泄露的情况,系统支持开发者Token重置。
c.需要注册手机进行验证后方可查看
======增加短信模板接口======
**请求URL**
https://api.ucpaas.com/2014-06-30/Accounts/{accountSid}/Messages/addsmstemplate?sig={SigParameter}
**请求包体**
^属性 ^类型 ^约束 ^说明|
|appid |String |必选 |为哪个应用创建模板|
|type |String |必选 |短信类型:0:通知短信、5:会员服务短信、4:验证码短信(此类型content内必须至少有一个参数{1}) |
|templateName |String |必选 |短信模板名称,限6个汉字或20个数字、英文字、符号。 |
|autograph |String |必选 |短信签名,建议使用公司名/APP名/网站名,限2-12个汉字、英文字母和数字,不能纯数字 |
|content |String |必选 |短信内容,最长500字,不得含有【】符号,可支持输入参数,参数示例“{1}”、“{2}” |
----
POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Messages/addsmstemplate?sig=769190B9A223549407D2164CAE92152E
Host:api.ucpaas.com
Accept:application/json
Content-Type:application/json;charset=utf-8
Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODUwMjE=
{
"template" : {
"appId" : "e462aba25bc6498fa5ada7eefe1401b7",
"type" : "0",
"templateName" : "模板名称",
"autograph" : "您公司或APP的名称",
"content" : "发送给用户的短信具体内容"
}
}
{
"resp": {
"respCode" : "000000",
"addsmstemplate" :
{
"createDate" : 20170531185016,
"templateID" : "62222"
}
}
}
POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Messages/addsmstemplate?sig=7A685B0216D1CA6839C00C2BB18A109D
Host:api.ucpaas.com
Accept:application/xml
Content-Type:application/xml;
charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODQ4NDI=
https://api.ucpaas.com/2014-06-30/Accounts/{accountSid}/Messages/editsmstemplate?sig={SigParameter}
**请求包体**
^属性 ^类型 ^约束 ^说明|
|templateId|String |必选 |需要修改的短信模板ID|
|type |String |必选 |类型:0:通知短信、5:会员服务短信、4:验证码短信(此类型content内必须至少有一个参数{1}) |
|templateName |String |必选 |限6个汉字或20个数字、英文字、符号。模板名称可重复 |
|autograph |String |必选 |限2-12个汉字、英文字母和数字,不能纯数字 |
|content |String |必选 |最长500字,不得含有【】符号,可支持输入参数,参数示例“{1}”、“{2}” |
----
POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Messages/editsmstemplate?sig=769190B9A223549407D2164CAE92152E
Host:api.ucpaas.com
Accept:application/json
Content-Type:application/json;charset=utf-8
Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODUwMjE=
{
"template" : {
"appId" : "e462aba25bc6498fa5ada7eefe1401b7",
"type" : "0",
"templateName" : "模板名称",
"autograph" : "您公司或APP的名称",
"content" : "发送给用户的短信具体内容"
}
}
{
"resp": {
"respCode" : "000000",
"editsmstemplate" :
{
"createDate" : 20170531185016,
"templateID" : "62222"
}
}
}
POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Messages/editsmstemplate?sig=7A685B0216D1CA6839C00C2BB18A109D
Host:api.ucpaas.com
Accept:application/xml
Content-Type:application/xml;
charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODQ4NDI=
https://api.ucpaas.com/2014-06-30/Accounts/{accountSid}/Messages/getsmstemplate?sig={SigParameter}
**请求包体**
^属性 ^类型 ^约束 ^说明|
|templateId|String |必选 |需要查询的短信模板ID|
**响应包体**
^属性 ^类型 ^约束 ^说明|
|templateId|String |必选 |需要查询的短信模板ID|
|type|String |必选 |短信模板的类型:0验证/1通知/2会员服务|
|createDate|String |必选 |模板创建时间|
|updateDate|String |必选 |模板更新时间|
|templateName|String |必选 |模板名称|
|autograph|String |必选 |短信签名|
|content|String |必选 |短信内容|
|examine|String |必选 |审核状态,1:待审核,2:审核通过,3:审核不通过|
|npreason|String |必选 |审核不通过的原因|
|locked|String |必选 |群发锁定状态:0未锁/1已被锁定|
----
POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Messages/getsmstemplate?sig=769190B9A223549407D2164CAE92152E
Host:api.ucpaas.com
Accept:application/json
Content-Type:application/json;charset=utf-8
Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODUwMjE=
{
"template" : {
"templateId" : "40545"
}
}
{
"resp": {
"respCode" : "000000",
"editsmstemplate" :
{
"templateId" : "40545",
"type" : "0",
"createDate" : 20170531185016,
"updateDate" : 20170531185016,
"templateName" : "模板名称",
"autograph" : "短信签名",
"content" : "短信内容",
"examine" : "0",
"npreason" : "审核不通过原因",
"locked" : "0"
}
}
}
POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Messages/getsmstemplate?sig=7A685B0216D1CA6839C00C2BB18A109D
Host:api.ucpaas.com
Accept:application/xml
Content-Type:application/xml;
charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODQ4NDI=
https://api.ucpaas.com/2014-06-30/Accounts/{accountSid}/Messages/deletesmstemplate?sig={SigParameter}
**请求包体**
^属性 ^类型 ^约束 ^说明|
|templateId|String |必选 |需要删除的短信模板ID|
----
POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Messages/deletesmstemplate?sig=769190B9A223549407D2164CAE92152E
Host:api.ucpaas.com
Accept:application/json
Content-Type:application/json;charset=utf-8
Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODUwMjE=
{
"template" : {
"templateId" : "40545"
}
}
{
"resp": {
"respCode" : "000000",
"deletesmstemplate" :
{
"deleteDate" : 20170531185016,
"templateID" : "40545"
}
}
}
POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Messages/deletesmstemplate?sig=7A685B0216D1CA6839C00C2BB18A109D
Host:api.ucpaas.com
Accept:application/xml
Content-Type:application/xml;
charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODQ4NDI=
{
"resp": {
"respCode" : "000000",
"examinesmstemplate" :
{
"templateId" : "40545",
"examine" : "1",
"npreason" : "审核不通过的原因",
"reportTime" : 20170531185016
}
}
}
**XML推送示例**