Polyv Help Center

Help Center

accountService

Updated: 2023-09-22 17:47:34

1. Query User Space and Traffic Information

Description

通过日期查询用户账号的空间及流量使用情况
接口地址(仅做说明使用):https://api.polyv.net/v2/user/%s/main

Call Constraints

  1. The API has a call frequency limit. For details, please refer to [/vod/java/limit]. For common call exceptions, please refer to [/vod/java/exceptionDoc].

Unit Test

    @Test
    public void testGetAccountSpaceFlow() throws Exception, NoSuchAlgorithmException {
        VodAccountSpaceDataRequest vodAccountSpaceDataRequest = new VodAccountSpaceDataRequest();
        VodAccountSpaceDataResponse vodAccountSpaceDataResponse;
        try {
            vodAccountSpaceDataRequest.setDate(super.getDate(2020, 10, 13));
            vodAccountSpaceDataResponse = new VodAccountServiceImpl().getAccountSpaceFlow(vodAccountSpaceDataRequest);
            Assert.assertNotNull(vodAccountSpaceDataResponse);
            if (vodAccountSpaceDataResponse != null) {
                log.debug("测试查询用户空间及流量情况成功,{}", JSON.toJSONString(vodAccountSpaceDataResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Description

  1. If the request is correct, a VodAccountSpaceDataResponse object is returned. The B-end processes business logic based on this object.

  2. If the request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. If the server encounters an exception during processing, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), for example: [ Error returned by Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Name Required Type Description
date false Date The date to query, format: yyyy-MM-dd

Response Object Description

Parameter Name Type Description
totalFlow Long Total user traffic, in bytes
usedSpace Long Used space, in bytes
usedFlow Long Used traffic, in bytes
totalSpace Long Total user space, in bytes
userId String POLYV user ID
email String POLYV user email

联系客服,在线咨询