Polyv Help Center

Help Center

Allocate Sub-Account Resources

Updated: 2022-09-02 18:08:07

Interface Description

1、分配分帐号资源
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议

Interface URL

http://api.polyv.net/live/v4/group/user/package-validity/update

Request Method

POST

Interface Constraints

  1. The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls are subject to frequency limits. Click for details

  2. For group account interface signatures, use the appId and appSecret of the primary group account.

  3. Sub-account usage billing packages follow the primary group account. Minute-based billing can only allocate minutes, and concurrent billing can only allocate concurrency.

  4. Setting a resource validity period requires the account to own the resource. The expiration date must be later than the activation date, and the activation date must be greater than or equal to the current day.

  5. When concurrency is provided, the concurrency activation date and concurrency expiration date are required. The same applies to available minutes, on-demand traffic, and on-demand storage.

Request Parameter Description

Parameter Required Type Description
appId true String Primary group account appId
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 to generate the signature is key to 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
email true String Sub-account email
balance false Float Amount, cannot be less than 0
concurrent false Integer Concurrency count
concurrentActivateDate false Long Concurrency activation date, 13-digit millisecond timestamp, only year-month-day is considered
concurrentEndDate false Long Concurrency expiration date, 13-digit millisecond timestamp, only year-month-day is considered
minutes false Integer Available minutes (minutes)
minutesActivateDate false Long Available minutes activation date, 13-digit millisecond timestamp, only year-month-day is considered
minutesEndDate false Long Available minutes expiration date, 13-digit millisecond timestamp, only year-month-day is considered
remainFlow false Integer On-demand traffic, unit: G
remainFlowActivateDate false Long On-demand traffic activation date, 13-digit millisecond timestamp, only year-month-day is considered
remainFlowEndDate false Long On-demand traffic expiration date, 13-digit millisecond timestamp, only year-month-day is considered
remainSpace false Integer On-demand storage, unit: G
remainSpaceActivateDate false Long On-demand storage activation date, 13-digit millisecond timestamp, only year-month-day is considered
remainSpaceEndDate false Long On-demand storage expiration date, 13-digit millisecond timestamp, only year-month-day is considered
linkMicLimit false Integer Maximum number of participants in a live co-stream, up to 16
linkMicMinutes false Integer Live co-stream minutes
guideMinutes false Integer Cloud studio minutes
maxChannels false Integer Maximum number of creatable channels

Example

http://api.polyv.net/live/v4/group/user/package-validity/update?appId=gc3eo6bh28&timestamp=1660214092000&sign=61250FACAC4A0091294CFE81CA4E2973

Request Body Parameters

{
    "email": "grouptest0501@polyv.net",
    "remainFlow": 10,
    "remainFlowEndDate": 1662825600000,
    "remainSpace": 5,
    "remainSpaceEndDate": 1665763200000,
    "remainSpaceActivateDate": 1663171200000
}

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 the business. 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. Only used for troubleshooting and debugging, should not be tied to business logic
error Object Error information when the status code is not 200. See Error Field Description
data Boolean Returns true on successful request, returns empty on failure

Error Parameter Description

Parameter Type Description
code Integer Error code, used to determine the specific error reason
desc String Error description, corresponds to error.code

Java Request Example

For quick integration of basic code, 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.


Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "71c487ed89a94ca0b29e8779ea96f84b.63.16529473248590749",
    "data": true,
    "success": true
}

Error Example

{
    "code": 400,
    "status": "error",
    "error": {
        "code": 10003,
        "desc": "时间戳过期"
    },
    "success": false
}
联系客服,在线咨询