## 一、概述
查询当前卡片中单卡流量;
## 二、接口
~~~[api]
post:/common/query/flow
*string:rayOauthServerAppId=默认值#头部参数,应用的appId,联系厂商获取
*string:rayOauthServerTimeStamp=默认值#头部参数,当前时间戳,参考前述算法
*string:rayOauthServerSignature=默认值#头部参数,签名,参考前述算法
*string:userCode=默认值#卡片的用户码
<<<
success
{
"status": 200,
"code": 200,
"message": "操作成功",
"bizCode": 0,
"timestamp": "1648035781699",
"result": {
"listobject": [
{
"quotaId": 1,
"orderId": 1,
"cardId": 1,
"packageId": 5,
"packageType": 1,
"usedFlow": 3358599.0,
"leftFlow": 5.9555961E7,
"usedRate": 0.05,
"isUsingNow": 1,
"validTime": "2022-03-02 15:49:20",
"invalidTime": "2022-03-30 23:59:59",
"reviseValidTime": "2022-03-02 15:49:20",
"reviseInvalidTime": "2022-03-30 23:59:59",
"flowQuota": 6.291456E7,
"quotaSource": 1,
"createTime": "2021-09-02 15:50:02",
"version": 1
}
]
}
}
<<<
error
{
"status": 200,
"code": 1006,
"message": "当前请求appId无效,请确认是否存在并启用",
"infoCode": "log202203221515192df",
"bizCode": 0,
"timestamp": "1647933319987"
}
~~~
## 三、关键字段
| 字段名称 || 说明 |
| --- | --- |---|
|statu||状态 200:成功|
|code||状态码 200:成功|
|message||提示消息|
|bizCode||0|
|timestamp||时间戳|
|result|listobject|返回结果|
|| packageId| 套餐包类型 1:基础包 2:加油包 |
|| packageType | 套餐包类型 1:基础包 2:加油包 |
|| usedFlow | 已用流量(kb) |
|| leftFlow| 剩余流量(kb) |
|| isUsingNow| 当前是否在用 1是 2 否 |
||flowQuota|总流量(kb)|
||validTime|开始时间|
||invalidTime|失效时间|
||reviseValidTime|调整后有效时间(如果跟上面时间不一致,以此时间为准)|
||reviseInvalidTime|调整后失效时间|
## 四、参考代码
```
Log4jV2Util.initLog4jV2TestEnv();
String hostUrl = "http://{hosturl}";
String apiUrl = "/common/query/flow";
String appId = "ray40c9903c6";
String appSecret = "46bacebf-f63c-41cc-b29c-5812994a5e83";
Map<String, String> paramap = new HashMap();
paramap.put("userCode", "34750");
String result = OauthCaller.call(hostUrl, apiUrl, appId, appSecret, paramap);
Logger logger = LoggerFactory.getLogger(OauthClientTest.class);
logger.warn(result);
```