获取子账户

获取子账户是云通讯平台为开发者提供的子账户批量获取接口,通过此REST API可以在您需要获取大量子账户基本信息时使用。支持版本{2013-12-26}

REST API: 获取子账户

通过HTTPS POST方式提交请求,云通讯平台收到请求后根据子账户开始序号查询并批量返回子账户信息。

接口Demo示例可在REST Server Demo中找到,开发者可根据使用的语言下载对应的Demo

1、请求

1.1 请求地址

/{SoftVersion}/Accounts/{accountSid}/GetSubAccounts
					

1.2 请求包头

请参阅:Rest 介绍》统一请求包头,使用主账户进行验证

1.3 请求包体

属性 类型 约束 说明
appId String 必选 应用Id
startNo String 可选 开始的序号,默认从0开始
offset String 可选 一次查询的最大条数,最小是1条,最大是100条

1.4 XML请求示例

POST /2013-12-26/Accounts/abcdefghijklmnopqrstuvwxyz012345/GetSubAccounts?sig=155EAA68C5DFB6B762A42D88F406ABCD HTTP/1.1
Host:192.168.0.1:8883
content-length: 139
Accept:application/xml;
Content-Type:application/xml;charset=utf-8;
Authorization:ZmY4MDgwODEzYzM3ZGE1MzAxM2M4MDRmODA3MjAwN2M6MjAxMzAyMDExNTABCDE=

<?xml version='1.0' encoding='utf-8'?>
<SubAccount>
  <appId>ff8080813c37da53013c8054f5123456</appId>
  <startNo>1</startNo>
  <offset>10</offset>
</SubAccount>
					

1.5 JSON请求示例

POST /2013-12-26/Accounts/abcdefghijklmnopqrstuvwxyz012345/GetSubAccounts?sig=155EAA68C5DFB6B762A42D88F406ABCD HTTP/1.1
Host:192.168.0.1:8883
content-length: 139
Accept:application/json;
Content-Type:application/json;charset=utf-8;
Authorization:ZmY4MDgwODEzYzM3ZGE1MzAxM2M4MDRmODA3MjAwN2M6MjAxMzAyMDExNTABCDE=

{'appId':'ff8080813c37da53013c8054f5612345','startNo':'1','offset':'10'}
					

2、响应

2.1 响应包体

属性 类型 约束 说明
statusCode String 必选 请求状态码,取值000000(成功),可参考Rest 错误代码
totalCount String 必选 子账号的数量
SubAccount String 必选 节点的名称
subAccountSid String 必选 子账户Id。由32个英文字母和阿拉伯数字组成的子账户唯一标识符
subToken String 必选 子账户的授权令牌。由32个英文字母和阿拉伯数字组成
dateCreated String 必选 子账户的创建时间
voipAccount String 必选 通讯账号。由14位数字组成,用于客户端SDK登录,作为语音通话及IM功能的唯一标识帐号
voipPwd String 必选 通讯密码。由8位数字和字母组成
friendlyName String 必选 子账号名称

2.1 XML响应示例

HTTP/1.1 200 OK
Content-Length:586

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
  <statusCode>000000</statusCode>
  <totalCount>2</totalCount>
  <SubAccount>
    <subAccountSid>abcdefghijklmnopqrstuvwxyz123456</subAccountSid>
    <subToken>666961bb08a14f568d421e6fe57d2d3c</subToken>
    <friendlyName>2981</friendlyName>
    <dateCreated>2013-02-01 15:22:46</dateCreated>
    <voipAccount>80000123456789</voipAccount>
    <voipPwd>xRkazyz3</voipPwd>
  </SubAccount>
  <SubAccount>
    <subAccountSid>abcdefghijklmnopqrstuvwxyz123457</subAccountSid>
    <subToken>666961bb08a14f568d421e6fe57d2d3c</subToken>
    <friendlyName>2983</friendlyName>
    <dateCreated>2013-02-01 15:22:46</dateCreated>
    <voipAccount>80000123456780</voipAccount>
    <voipPwd>xRkazyz3</voipPwd>
  </SubAccount>
</Response>
					

2.3 JSON响应示例

HTTP/1.1 200 OK
Content-Length:586

{"statusCode":"000000","totalCount":"2","SubAccount":[{"subAccountSid":"abcdefghijklmnopqrstuvwxyz123456","subToken":"666961bb08a14f568d42176fe571234","friendlyName":" 2983"
"dateCreated":"2013-09-27 11:42:24","voipAccount":"80000123456789","voipPwd":" xRkazyz3"},{"subAccountSid":"abcdefghijklmnopqrstuvwxyz123457","subToken":"666961bb08a14f568d42176fe571234","friendlyName":" 2980"
"dateCreated":"2013-09-27 11:42:24","voipAccount":"80000123456780","voipPwd":" xRkazyz3"}]}