======Client 管理API====== Client在云之讯融合通讯开放平台是与开发者的应用绑定的子账号,是平台提供给开发者自行管理其客户的账户,即开发者可以根据创建的子账户管理和区分其应用下的不同客户,这样就可以更加方便,便捷的管理应用下的不同客户。 如果开发者的应用接入使用到平台的资源时,可以根据需求为该应用下的每个客户申请绑定一个Client子账户,这样就可以通过Client子账户进行统一方便管理使用到平台的业务。 例如开发者的应用需要用到平台的语音功能,则需要使用Client管理API,开发者的应用只需要使用到短信通知,短信验证码等直接应用到手机号即可完成的业务功能,可不需要使用Client管理API。 ===== 申请Client账号 ===== 通过HTTPS POST方式提交请求,云之讯融合通讯开放平台收到请求后,返回Client信息。 ==== 1.1 请求 ==== **请求地址** /{SoftVersion}/Accounts/{AccountSid}/Clients **请求包头** 详情请查阅[[rest_api介绍及接入#统一请求包头|统一请求包头]],并使用开发者账号进行验证。 **请求包体** ^属性 ^类型 ^约束 ^说明 | |appId |String |必选 |应用Id| |clientType |String |必选 |0 开发者计费;1 云平台计费。默认为0。| |charge |String |必选 |充值金额(开发者计费即ClientType为0时,为可选参数),默认为0。| |friendlyName |String |可选 |Client名称。可由英文字母和阿拉伯数字组成Client名称,同一个应用下唯一。| |mobile |String |可选 |绑定的手机号码。同一个应用内唯一。| **XML请求示例** POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Clients.xml?sig=3C861C9CFA64862A79B906D80EDB79BA Host:api.ucpaas.com Accept:application/xml Content-Type:application/xml;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxNzE2MzI= e462aba25bc6498fa5ada7eefe1401b7 97854038 1 1 18612345678 **JSON请求示例** POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Clients?sig=027282406B5E0E66F4EFE2A86B7A60F7 Host:api.ucpaas.com Accept:application/json Content-Type:application/json;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxNzMwMzg= { "client" : { "friendlyName" : "76598140", "appId" : "e462aba25bc6498fa5ada7eefe1401b7", "charge" : "1", "mobile" : "18612345678", "clientType" : "1" } } ==== 1.2 响应 ==== **响应包体** ^属性 ^类型 ^约束 ^说明 | |respCode |String |必选 |请求状态码,取值000000(成功)| |clientNumber |String |必选 |Client号码。由14位数字组成| |clientPwd |String |必选 |Client密码。由8位数字和字母组成| |createDate |String |必选 |Client的创建时间| |balance |String |可选 |用户余额(云平台计费类型)| **XML响应示例** 000000 1 66807000020828 a9316df8 2014-06-23 17:16:27 **JSON响应示例** { "resp" : { "respCode" : "000000", "client" : { "balance" : 1, "clientNumber" : 66807000020827, "clientPwd" : "c4ad7da6", "createDate" : "2014-06-23 17:15:04" } } } ===== 释放Client账号 ===== 通过HTTPS POST方式提交请求,云之讯融合通讯开放平台收到请求后,返回释放Client的结果。 ==== 1.1 请求 ==== **请求地址** /{SoftVersion}/Accounts/{AccountSid}/dropClient **请求包头** 详情请查阅[[rest_api介绍及接入#统一请求包头|统一请求包头]],并使用开发者账号进行验证。 **请求包体** ^属性 ^类型 ^约束 ^说明 | |clientNumber |String |必选 |clientNumber号码| |appId |String |必选 |应用Id| **XML请求示例** POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/dropClient.xml?sig=2209C6E331431BF9E876C07D602EBB9D Host:api.ucpaas.com Accept:application/xml Content-Type:application/xml;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODIxNTk= 66807000020841 66807000020841 **JSON请求示例** POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/dropClient?sig=AB552DCBD925CDC7D209AC3156F5E5AE Host:api.ucpaas.com Accept:application/json Content-Type:application/json;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODI1Mjk= { "client" : { "clientNumber" : "66807000020842", "appId" : "e462aba25bc6498fa5ada7eefe1401b7" } } ==== 1.2 响应 ==== **响应包体** ^属性 ^类型 ^约束 ^说明 | |respCode |String |必选 |请求状态码,取值000000(成功)| **XML响应示例** 000000 **JSON响应示例** { "resp" : { "respCode" : "000000" } } ===== 分页获取Client列表 ===== 通过HTTPS POST方式提交请求,云之讯融合通讯开放平台收到请求后根据Client开始序号查询并批量返回Client信息。 ==== 1.1 请求 ==== **请求地址** /{SoftVersion}/Accounts/{AccountSid}/clientList **请求包头** 详情请查阅[[rest_api介绍及接入#统一请求包头|统一请求包头]],并使用开发者账号进行验证。 **请求包体** ^属性 ^类型 ^约束 ^说明 | |appId |String |必选 |应用Id| |start |String |必选 |开始的序号,默认从0开始| |limit |String |必选 |一次查询的最大条数,最小是1条,最大是100条| **XML请求示例** POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/clientList.xml?sig=C2D547C252A2D051B2EF1A8B5A8AADFD Host:api.ucpaas.com Accept:application/xml Content-Type:application/xml;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxNzE3MzY= e462aba25bc6498fa5ada7eefe1401b7 0 2 **JSON请求示例** POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/clientList?sig=7786FBFF899296E1684EB333913FFF77 Host:api.ucpaas.com Accept:application/json Content-Type:application/json;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODEzMDY= { "client" : { "appId" : "e462aba25bc6498fa5ada7eefe1401b7", "start" : "0", "limit" : "2" } } ==== 1.2 响应 ==== **响应包体** ^属性 ^类型 ^约束 ^说明 | |respCode |String |必选 |请求状态码,取值000000(成功)| |count |String |必选 |Client的数量| |client |String |必选 |节点的名称| |friendlyName |String |必选 |Client绑定的昵称| |clientType |String |必选 |Client类型(即平台是否对Client计费)| |mobile |String |必选 |Client绑定的手机号码| |balance |String |必选 |Client余额| |clientNumber |String |必选 |Client号码。由14位数字组成| |clientPwd |String |必选 |Client的密码| |createDate |String |必选 |Client的创建时间| **XML响应示例** 000000 2 /*Client为节点*/ 0 66807000020819 72398162 1 2014-06-23 15:04:09 26928205 18612345678 1000000 66807000020828 a9316df8 1 2014-06-23 17:16:27 97854038 18612345678 **JSON响应示例** { "resp" : { "respCode" : "000000", "count" : 2, "client" : [ { "balance" : 0, "clientNumber" : 66807000020819, "clientPwd" : 72398162, "clientType" : 1, "createDate" : "2014-06-23 15:04:09", "friendlyName" : 26928205, "mobile" : 18612345678 }, { "balance" : 1000000, "clientNumber" : 66807000020828, "clientPwd" : "a9316df8", "clientType" : 1, "createDate" : "2014-06-23 17:16:27", "friendlyName" : 97854038, "mobile" : 18612345678 } ] } } ===== 以Client账号方式查询Client信息 ===== 通过HTTPS GET方式提交请求,云之讯融合通讯开放平台收到请求后根据Client名称查询并返回Client信息。 ==== 1.1 请求 ==== **请求地址** /{SoftVersion}/Accounts/{AccountSid}/Clients **请求包头** 详情请查阅[[rest_api介绍及接入#统一请求包头|统一请求包头]],并使用开发者账号进行验证。 **请求包体** ^属性 ^类型 ^约束 ^说明 | |appId |String |必选 |应用Id| |clientNumber |String |必选 |clientNumber号码| **XML请求示例** GET/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Clients.xml?sig=0E270413B0B038B7AEB6997F510F98EB&clientNumber=66807000020851&appId=e462aba25bc6498fa5ada7eefe1401b7 Host:api.ucpaas.com Accept:application/xml Content-Type:application/xml;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODU4MDE= **JSON请求示例** GET/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/Clients?sig=83D00E8EF62FC601A4035AE7EEF6197F&clientNumber=66807000020851&appId=e462aba25bc6498fa5ada7eefe1401b7 Host:api.ucpaas.com Accept:application/json Content-Type:application/json;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODU5MDM= ==== 1.2 响应 ==== **响应包体** ^属性 ^类型 ^约束 ^说明 | |respCode |String |必选 |请求状态码,取值000000(成功)| |count |String |必选 |Client的数量| |client |String |必选 |节点的名称| |friendlyName |String |必选 |Client绑定的昵称| |clientType |String |必选 |Client类型(即平台是否对Client计费)| |mobile |String |必选 |Client绑定的手机号码| |balance |String |必选 |Client余额| |clientNumber |String |必选 |Client号码。由14位数字组成| |clientPwd |String |必选 |Client的密码| |createDate |String |必选 |Client的创建时间| |roam |String |可选 |是否开通呼转1:开通,0:未开通| **XML响应示例** 000000 1 /*Client为节点*/ 0 66807000020851 afabcaa9 1 2014-06-23 18:41:51 71127894 18612345678 1 **JSON响应示例** { "resp" : { "respCode" : "000000", "count" : 1, "client" : { "balance" : 0, "clientNumber" : 66807000020851, "clientPwd" : "afabcaa9", "clientType" : 1, "createDate" : "2014-06-23 18:41:51", "friendlyName" : 71127894, "mobile" : 18612345678 "roam" : 1 } } } ===== 以手机号码方式查询Client信息 ===== 通过HTTPS GET方式提交请求,云之讯融合通讯开放平台收到请求后根据手机号码查询与该手机号码绑定的Client,并返回Client信息。 ==== 1.1 请求 ==== **请求地址** /{SoftVersion}/Accounts/{AccountSid}/ClientsByMobile **请求包头** 详情请查阅[[rest_api介绍及接入#统一请求包头|统一请求包头]],并使用开发者账号进行验证。 **请求包体** ^属性 ^类型 ^约束 ^说明 | |appId |String |必选 |应用Id| |mobile |String |必选 |绑定的手机号码。同一个应用内唯一。| **XML请求示例** GET/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/ClientsByMobile.xml?sig=0E270413B0B038B7AEB6997F510F98EB&mobile=18612345678&appId=e462aba25bc6498fa5ada7eefe1401b7 Host:api.ucpaas.com Accept:application/xml Content-Type:application/xml;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODU4MDE= **JSON请求示例** GET/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/ClientsByMobile?sig=83D00E8EF62FC601A4035AE7EEF6197F&mobile=18612345678&appId=e462aba25bc6498fa5ada7eefe1401b7 Host:api.ucpaas.com Accept:application/json Content-Type:application/json;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODU5MDM= ==== 1.2 响应 ==== **响应包体** ^属性 ^类型 ^约束 ^说明 | |respCode |String |必选 |请求状态码,取值000000(成功)| |count |String |必选 |Client的数量| |client |String |必选 |节点的名称| |friendlyName |String |必选 |Client绑定的昵称| |clientType |String |必选 |Client类型(即平台是否对Client计费)| |mobile |String |必选 |Client绑定的手机号码| |balance |String |必选 |Client余额| |clientNumber |String |必选 |Client号码。由14位数字组成| |clientPwd |String |必选 |Client的密码| |createDate |String |必选 |Client的创建时间| |roam |String |可选 |是否开通呼转1:开通,0:未开通| **XML响应示例** 000000 1 /*Client为节点*/ 0 66807000020851 afabcaa9 1 2014-06-23 18:41:51 71127894 18612345678 1 **JSON响应示例** { "resp" : { "respCode" : "000000", "count" : 1, "client" : { "balance" : 0, "clientNumber" : 66807000020851, "clientPwd" : "afabcaa9", "clientType" : 1, "createDate" : "2014-06-23 18:41:51", "friendlyName" : 71127894, "mobile" : 18612345678 "roam" : 1 } } } ===== Client充值 ===== 通过HTTPS POST方式提交充值请求,云之讯融合通讯开放平台收到请求后,返回Client充值结果。 ==== 1.1 请求 ==== **请求地址** /{SoftVersion}/Accounts/{AccountSid}/chargeClient **请求包头** 详情请查阅[[rest_api介绍及接入#统一请求包头|统一请求包头]],并使用开发者账号进行验证。 **请求包体** ^属性 ^类型 ^约束 ^说明 | |appId |String |必选 |应用Id| |clientNumber |String |必选 |clientNumber账号| |chargeType |String |必选 |0 充值;1 回收。| |charge |String |必选 |充值或回收的金额。| **XML请求示例** POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/chargeClient.xml?sig=7026AE218B34FA76644DFC43BC3EB630 Host:api.ucpaas.com Accept:application/xml Content-Type:application/xml;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODI5NTA= 66807000020850 1 1 e462aba25bc6498fa5ada7eefe1401b7 **JSON请求示例** POST/2014-06-30/Accounts/e03bc9106c6ed0eaebfce8c368fdcd48/chargeClient?sig=77AF046725D906A133D05693553FA84A Host:api.ucpaas.com Accept:application/json Content-Type:application/json;charset=utf-8 Authorization:ZTAzYmM5MTA2YzZlZDBlYWViZmNlOGMzNjhmZGNkNDg6MjAxNDA2MjMxODI5MDM= { "client" : { "clientNumber" : "66807000020850", "appId" : "e462aba25bc6498fa5ada7eefe1401b7", "charge" : "1", "chargeType" : "1" } } ==== 1.2 响应 ==== **响应包体** ^属性 ^类型 ^约束 ^说明 | |respCode |String |必选 |请求状态码,取值000000(成功)| **XML响应示例** 000000 **JSON响应示例** { "resp" : { "respCode" : "000000" } }