cURL
curl --request POST \
--url https://apiv1.cakeip.com/openapi/account/queryTrafficUsage \
--header 'Content-Type: application/json' \
--data '
{
"appKey": "<string>",
"type": "day",
"startDay": "2024-01-01",
"endDay": "2024-01-02",
"provider": 1
}
'import requests
url = "https://apiv1.cakeip.com/openapi/account/queryTrafficUsage"
payload = {
"appKey": "<string>",
"type": "day",
"startDay": "2024-01-01",
"endDay": "2024-01-02",
"provider": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
appKey: '<string>',
type: 'day',
startDay: '2024-01-01',
endDay: '2024-01-02',
provider: 1
})
};
fetch('https://apiv1.cakeip.com/openapi/account/queryTrafficUsage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiv1.cakeip.com/openapi/account/queryTrafficUsage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'appKey' => '<string>',
'type' => 'day',
'startDay' => '2024-01-01',
'endDay' => '2024-01-02',
'provider' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiv1.cakeip.com/openapi/account/queryTrafficUsage"
payload := strings.NewReader("{\n \"appKey\": \"<string>\",\n \"type\": \"day\",\n \"startDay\": \"2024-01-01\",\n \"endDay\": \"2024-01-02\",\n \"provider\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apiv1.cakeip.com/openapi/account/queryTrafficUsage")
.header("Content-Type", "application/json")
.body("{\n \"appKey\": \"<string>\",\n \"type\": \"day\",\n \"startDay\": \"2024-01-01\",\n \"endDay\": \"2024-01-02\",\n \"provider\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiv1.cakeip.com/openapi/account/queryTrafficUsage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"appKey\": \"<string>\",\n \"type\": \"day\",\n \"startDay\": \"2024-01-01\",\n \"endDay\": \"2024-01-02\",\n \"provider\": 1\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "查询成功",
"data": [
{
"time": "2024-01-01",
"traffic": 100.5
},
{
"time": "2024-01-02",
"traffic": 200.3
}
],
"total": 2,
"sum": 300.8
}{
"error": 123,
"message": "<string>"
}代理商相关
查询流量消耗
查询流量消耗
POST
/
account
/
queryTrafficUsage
cURL
curl --request POST \
--url https://apiv1.cakeip.com/openapi/account/queryTrafficUsage \
--header 'Content-Type: application/json' \
--data '
{
"appKey": "<string>",
"type": "day",
"startDay": "2024-01-01",
"endDay": "2024-01-02",
"provider": 1
}
'import requests
url = "https://apiv1.cakeip.com/openapi/account/queryTrafficUsage"
payload = {
"appKey": "<string>",
"type": "day",
"startDay": "2024-01-01",
"endDay": "2024-01-02",
"provider": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
appKey: '<string>',
type: 'day',
startDay: '2024-01-01',
endDay: '2024-01-02',
provider: 1
})
};
fetch('https://apiv1.cakeip.com/openapi/account/queryTrafficUsage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiv1.cakeip.com/openapi/account/queryTrafficUsage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'appKey' => '<string>',
'type' => 'day',
'startDay' => '2024-01-01',
'endDay' => '2024-01-02',
'provider' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiv1.cakeip.com/openapi/account/queryTrafficUsage"
payload := strings.NewReader("{\n \"appKey\": \"<string>\",\n \"type\": \"day\",\n \"startDay\": \"2024-01-01\",\n \"endDay\": \"2024-01-02\",\n \"provider\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apiv1.cakeip.com/openapi/account/queryTrafficUsage")
.header("Content-Type", "application/json")
.body("{\n \"appKey\": \"<string>\",\n \"type\": \"day\",\n \"startDay\": \"2024-01-01\",\n \"endDay\": \"2024-01-02\",\n \"provider\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiv1.cakeip.com/openapi/account/queryTrafficUsage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"appKey\": \"<string>\",\n \"type\": \"day\",\n \"startDay\": \"2024-01-01\",\n \"endDay\": \"2024-01-02\",\n \"provider\": 1\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "查询成功",
"data": [
{
"time": "2024-01-01",
"traffic": 100.5
},
{
"time": "2024-01-02",
"traffic": 200.3
}
],
"total": 2,
"sum": 300.8
}{
"error": 123,
"message": "<string>"
}Body
application/json
查询流量消耗请求
查询流量消耗请求参数
AppKey密钥
查询粒度:day=按天统计,5min=按5分钟统计
Available options:
day, 5min Example:
"day"
开始日期(格式:YYYY-MM-DD)
Example:
"2024-01-01"
结束日期(格式:YYYY-MM-DD)
Example:
"2024-01-02"
池子类型:1=优选池(默认)。2=标准池已下架,但保留以查询历史数据
Available options:
1, 2 Example:
1
Response
流量消耗查询响应
流量消耗查询响应。data为数组格式,每条记录包含时间和流量值。时间格式根据查询粒度不同:type=day时为'YYYY-MM-DD',type=5min时为'YYYY-MM-DD HH:mm:ss'
状态码,0为操作成功
Available options:
0, -1 Example:
0
响应消息
Example:
"查询成功"
流量使用记录列表
Show child attributes
Show child attributes
Example:
[ { "time": "2024-01-01", "traffic": 100.5 }, { "time": "2024-01-02", "traffic": 200.3 } ]
记录数
Example:
2
总流量消耗(单位:MB)
Example:
300.8
⌘I

