应用 - 网络
网络日志
获取应用各域名的逐请求边缘日志。
GET
/
v2
/
apps
/
{app_id}
/
network
/
logs
网络日志
curl --request GET \
--url https://api.squarecloud.app/v2/apps/{app_id}/network/logs \
--header 'Authorization: <authorization>'import requests
url = "https://api.squarecloud.app/v2/apps/{app_id}/network/logs"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.squarecloud.app/v2/apps/{app_id}/network/logs', 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://api.squarecloud.app/v2/apps/{app_id}/network/logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.squarecloud.app/v2/apps/{app_id}/network/logs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.squarecloud.app/v2/apps/{app_id}/network/logs")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.squarecloud.app/v2/apps/{app_id}/network/logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": "success",
"response": [
{
"timestamp": "2025-12-01T12:00:00.000Z",
"client": {
"ip": "203.0.113.45",
"country": "BR",
"location": "São Paulo",
"asn": "12345 - Example ISP",
"agent": "Mozilla/5.0",
"category": null
},
"request": {
"mitigated": false,
"method": "GET",
"host": "my-app.squareweb.app",
"path": "/api/users",
"query": "?limit=10",
"protocol": "HTTP/2",
"referer": null
},
"response": {
"status": 200,
"contentType": "application/json",
"cache": "MISS"
}
}
]
}
返回应用主域名及任何已配置的自定义域名的逐请求边缘日志(HTTP、国家/地区、状态、字节数)。最大保留窗口为 7 天;起始时间会被限制到应用的创建日期。
仅在 Pro 和 Enterprise 套餐上可用。缓存未命中速率限制:每个所有者每 60 秒 10 次请求。
参数
应用的 ID。你可以在应用仪表盘的 URL 中找到它。
ISO 8601 起始时间戳。不能早于应用的创建日期,也不能早于 7 天前。
ISO 8601 结束时间戳。必须晚于
start。响应
指示调用是否成功。成功时为
success,否则为 error。响应的内容。
显示 展开对象
显示 展开对象
请求的时间戳,ISO 格式。
{
"status": "success",
"response": [
{
"timestamp": "2025-12-01T12:00:00.000Z",
"client": {
"ip": "203.0.113.45",
"country": "BR",
"location": "São Paulo",
"asn": "12345 - Example ISP",
"agent": "Mozilla/5.0",
"category": null
},
"request": {
"mitigated": false,
"method": "GET",
"host": "my-app.squareweb.app",
"path": "/api/users",
"query": "?limit=10",
"protocol": "HTTP/2",
"referer": null
},
"response": {
"status": 200,
"contentType": "application/json",
"cache": "MISS"
}
}
]
}
⌘I
网络日志
curl --request GET \
--url https://api.squarecloud.app/v2/apps/{app_id}/network/logs \
--header 'Authorization: <authorization>'import requests
url = "https://api.squarecloud.app/v2/apps/{app_id}/network/logs"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.squarecloud.app/v2/apps/{app_id}/network/logs', 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://api.squarecloud.app/v2/apps/{app_id}/network/logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.squarecloud.app/v2/apps/{app_id}/network/logs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.squarecloud.app/v2/apps/{app_id}/network/logs")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.squarecloud.app/v2/apps/{app_id}/network/logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": "success",
"response": [
{
"timestamp": "2025-12-01T12:00:00.000Z",
"client": {
"ip": "203.0.113.45",
"country": "BR",
"location": "São Paulo",
"asn": "12345 - Example ISP",
"agent": "Mozilla/5.0",
"category": null
},
"request": {
"mitigated": false,
"method": "GET",
"host": "my-app.squareweb.app",
"path": "/api/users",
"query": "?limit=10",
"protocol": "HTTP/2",
"referer": null
},
"response": {
"status": 200,
"contentType": "application/json",
"cache": "MISS"
}
}
]
}

