Query Account Revenue Details
Updated: 2022-09-23 10:07:04
API Description
1、接口URL中的{userId}为直播账号ID
2、根据是否提交channelId来查询账号收入详细信息
3、接口支持https协议
API URL
http://api.polyv.net/live/v2/user/{userId}/get-income-detail
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details on obtaining keys |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See signature generation rules |
| startDate | true | String | Query start date, format: yyyy-MM-dd |
| endDate | true | String | Query end date, format: yyyy-MM-dd |
| channelId | false | String | Channel ID to query. If not submitted or set to 0, all channels are queried. |
| page | false | Integer | Page number, defaults to 1 if not submitted |
| pageSize | false | Integer | Number of records per page, defaults to 12 if not submitted |
Example
http://api.polyv.net/live/v2/user/{userId}/get-income-detail
Form Parameters:
endDate=2021-12-11&appId=frlr1zazn3&sign=4EFC44F3108FA3DAF0DF1578E9DE49A4&pageSize=20&page=1&startDate=2019-11-24&channelId=1965681×tamp=1621844561516
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure. See global error description |
| status | String | Response status text |
| message | String | Response description. When code is 400 or 500, provides auxiliary error reason |
| data | Object | Revenue details returned on success. See data field description |
Data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| pageSize | Integer | Number of records per page, defaults to 12 if not submitted |
| pageNumber | Integer | Current page number |
| totalItems | Integer | Total number of records |
| contents | Array | Query result list, revenue details. See Contents parameter description |
| startRow | Integer | Position of the first record on the current page in the total result set |
| firstPage | Boolean | Whether it is the first page, values: true/false, defaults to false |
| lastPage | Boolean | Whether it is the last page, values: true/false, defaults to false |
| prePageNumber | Integer | Previous page number |
| limit | Integer | Number of items per page |
| totalPages | Integer | Total number of pages |
| endRow | Integer | Position of the last record on the current page in the total result set |
| nextPageNumber | Integer | Next page number |
| offset | Integer | Pagination starting record |
Contents Parameter Description
| Parameter | Type | Description |
|---|---|---|
| userId | String | POLYV user ID, consistent with the Polyv official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
| amount | Float | Amount, in yuan |
| goodNum | Integer | Number of virtual gift tips |
| channelId | String | Channel ID |
| payType | String | Revenue type cash: Cash tips pay: Paid viewing good: Virtual gift tips (cash gifts) point: Points tips (points gifts) |
| payTypeName | String | Name of the revenue type: Virtual Gift Tips (Cash Gifts), Cash Tips, Paid Viewing, Points Tips (Points Gifts) |
| viewerName | String | Nickname of the paying viewer |
| payTime | Long | Payment time, 13-digit millisecond timestamp |
| weixinAppId | String | WeChat Official Account AppId |
| outTradeNo | String | Internal order number of Polyv system |
| openId | String | Unique user identifier openId under the Official Account |
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(AccountTest.class);
/**
* 查询账号收入详情
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetIncomeDetail() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url=String.format("http://api.polyv.net/live/v2/user/%s/get-income-detail",userId);
String startDate="2019-11-24";
String endDate="2021-12-11";
String channelId="1965681";
String page=String.valueOf(1);
String pageSize=String.valueOf(20);
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("startDate", startDate);
requestMap.put("endDate", endDate);
requestMap.put("channelId", channelId);
requestMap.put("page", page);
requestMap.put("pageSize", pageSize);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFormBody(url, requestMap);
log.info("测试查询账号收入详情,返回值:{}", response);
//do somethings
}
Response Example
For global error descriptions, see Global Error Description
Success Example
{
"code":200,
"status":"success",
"message":"",
"data":{
"pageSize":20,
"pageNumber":1,
"totalItems":2,
"contents":[
{
"userId":"1b448be323",
"amount":0.01,
"goodNum":1,
"channelId":1965681,
"payType":"good",
"payTypeName":"道具打赏",
"viewerName":"王勋",
"payTime":1616749953000,
"weixinAppId":"视频直播平台",
"outTradeNo":"4200000986202103266004002654",
"openId":"ovtl9twa7JHyHBBA8QUNVjjM4WIs"
},
{
"userId":"1b448be323",
"amount":0.02,
"goodNum":null,
"channelId":1965681,
"payType":"cash",
"payTypeName":"现金打赏",
"viewerName":"长沙观众/95916",
"payTime":1604911816000,
"weixinAppId":"视频直播平台",
"outTradeNo":"4200000848202011099220088137",
"openId":"ovtl9t5XNOfIGQ5q-MQ5thHRhGjc"
}
],
"startRow":1,
"firstPage":true,
"lastPage":true,
"prePageNumber":1,
"limit":2,
"totalPages":1,
"nextPageNumber":1,
"endRow":2,
"offset":0
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
