Create Group Sub-Account
API Description
1、创建集团分帐号
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
API URL
http://api.polyv.net/live/v4/group/user/create
Request Method
POST
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
For group account APIs, use the appId and appSecret of the primary group account for signature calculation.
Sub-account usage billing follows the primary group account. Minute-based billing can only allocate minutes, and concurrent billing can only allocate concurrent connections.
If the
expireDateparameter is not provided or is in an incorrect format, the sub-account expiration defaults to that of the primary account.Account creation and resource allocation are asynchronous operations. Please call this creation API and wait 1~3 seconds before using Query Sub-Account List and Remaining Resources to retrieve account information.
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Primary group account appId See Get Credentials for Group Account 2.0 |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret used for signature generation is critical for communication data security. It must not be stored or used directly on the client. All APIs must be called through your own server to relay requests to the POLYV server for response data. See Signature Generation Rules |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| true | String | Email address | |
| password | true | String | Password, must contain both numbers and letters, length 8~32 characters |
| contacts | true | String | Contact person |
| phone | true | String | Phone number. A phone number cannot be bound to more than 3 email addresses |
| maxChannels | true | Integer | Maximum number of channels that can be created |
| minutes | false | Integer | Minutes. Required if the primary account uses minute-based billing |
| concurrent | false | Integer | Concurrent connections. Required if the primary account uses concurrent billing. Set to -1 for unlimited |
| balance | false | Float | Amount, cannot be less than 0 |
| memo | false | String | Remark, up to 50 characters |
| expireType | false | String | Expiration type group: Follows the primary account custom: Custom |
| expireDate | false | String | Account expiration date, format yyyyMMdd, e.g., 20220428 |
| remainFlow | false | Integer | Video-on-demand traffic, unit G, default 100G |
| remainSpace | false | Integer | Video-on-demand storage, unit G, default 100G |
| aiPptVideoDuration | false | Integer | Allocated video creation minutes, cannot be less than 0 |
| aiPptVideoWithDigitalHumanDuration | false | Integer | Allocated video creation (with digital human) minutes, cannot be less than 0 |
| liveStatsCallbackUrl | false | String | Live streaming statistics callback URL, must start with http://或https://开头 |
| aiPptVideoCallbackUrl | false | String | Video creation information callback URL, must start with http://或https://开头 |
Example
http://api.polyv.net/live/v4/group/user/create?appId=g8dtv537aq×tamp=1653485157000&sign=5F9F4CB3EEA92C7897418718973A2462
Request Body Parameters
{
"email": "polyvtest@polyv.net",
"password": "***",
"contacts": "polyvtest",
"phone": 16666666666,
"expireType": "custom",
"expireDate": 20220520,
"memo": "这是备注",
"maxChannels": 100,
"minutes": 100,
"remainFlow": 100,
"remainSpace": 100,
"balance": 100,
"liveStatsCallbackUrl": "https://www.abc.com/live-stats-callback",
"aiPptVideoCallbackUrl": "https://www.abc.com/ai-ppt-video-callback"
}
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Status code, same as HTTP status code, used to determine the basic response status |
| status | String | Response result, determined by business logic. Returns success on success, error on failure |
| success | Boolean | Whether the response was successful |
| requestId | String | Request ID, a unique UUID generated for each request. For debugging and troubleshooting only, not for business logic |
| error | Object | Error information when status code is not 200 See Error Field Description |
| data | Object | See Data Field Description |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to identify the specific error reason |
| desc | String | Error description, corresponding to error.code |
Data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| appId | String | Application ID |
| appSecret | String | Application Secret |
| userId | String | User global ID |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.
It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(getClass());
/**
* 创建集团分帐号
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void createGroupUserTest() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.groupAppId;
String appSecret = super.groupAppSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/group/user/create";
String email = "polyvtest123456@polyv.net";
String password = "polyvtest123456";
String contacts = "张三";
String phone = "17600000000";
String maxChannels = "10";
String concurrent = "1000";
String liveStatsCallbackUrl = "https://www.abc.com/live-stats-callback";
String aiPptVideoCallbackUrl = "https://www.abc.com/ai-ppt-video-callback";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("email", email);
jsonMap.put("password", password);
jsonMap.put("contacts", contacts);
jsonMap.put("phone", phone);
jsonMap.put("maxChannels", maxChannels);
jsonMap.put("concurrent", concurrent);
jsonMap.put("liveStatsCallbackUrl", liveStatsCallbackUrl);
jsonMap.put("aiPptVideoCallbackUrl", aiPptVideoCallbackUrl);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("测试创建集团分帐号成功:{}", response);
//do somethings
}
Response Example
For system-wide global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"requestId": "c7e83b9751fa4bfe9f57ba45494c147a.57.16529371726540445",
"data": {
"appId": "xxxxx",
"appSecret": "xxxxxxxxxxxx",
"userId": "xxxxxx"
},
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"error": {
"code": 10003,
"desc": "时间戳过期"
},
"success": false
}
