跳转到主要内容
GET
/
v2
/
apps
/
{app_id}
/
network
/
errors
网络错误
curl --request GET \
  --url https://api.squarecloud.app/v2/apps/{app_id}/network/errors \
  --header 'Authorization: <authorization>'
import requests

url = "https://api.squarecloud.app/v2/apps/{app_id}/network/errors"

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/errors', 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/errors",
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/errors"

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/errors")
.header("Authorization", "<authorization>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.squarecloud.app/v2/apps/{app_id}/network/errors")

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": {
    "summary": {
      "total": 42,
      "by_class": {
        "4xx": 0,
        "5xx": 42
      }
    },
    "by_status": [
      { "status": 502, "requests": 30 },
      { "status": 504, "requests": 12 }
    ],
    "timeseries": [
      {
        "date": "2025-12-01T12:00:00.000Z",
        "buckets": { "502": 5, "504": 2 },
        "total": 7
      }
    ],
    "top_paths": [
      {
        "path": "/api/users",
        "method": "GET",
        "total": 18,
        "by_status": { "502": 15, "504": 3 }
      }
    ],
    "by_method": [
      {
        "method": "GET",
        "total": 30,
        "by_status": { "502": 22, "504": 8 }
      }
    ]
  }
}
返回应用在某一时间窗口内的聚合边缘错误计数,按状态码、时间分桶、请求路径和 HTTP 方法分组。默认仅包含 5xx 响应;传入 include_4xx=true 可同时统计 4xx 响应。
缓存未命中速率限制:每个所有者每 60 秒 15 次请求。当没有匹配的错误,或时间窗口早于应用的创建日期时,返回空明细。
Authorization
string
必填
你账户的 API 密钥。你可以在账户设置中找到它。

参数

app_id
string
必填
应用的 ID。你可以在应用仪表盘的 URL 中找到它。
start
string
必填
分析窗口的 ISO 8601 起始时间戳。
end
string
必填
ISO 8601 结束时间戳。必须晚于 start
include_4xx
string
是否在 5xx 错误之外同时包含 4xx 响应。接受 truefalse。默认为 false

响应

status
string
指示调用是否成功。成功时为 success,否则为 error
response
object
该窗口的聚合错误明细。
{
  "status": "success",
  "response": {
    "summary": {
      "total": 42,
      "by_class": {
        "4xx": 0,
        "5xx": 42
      }
    },
    "by_status": [
      { "status": 502, "requests": 30 },
      { "status": 504, "requests": 12 }
    ],
    "timeseries": [
      {
        "date": "2025-12-01T12:00:00.000Z",
        "buckets": { "502": 5, "504": 2 },
        "total": 7
      }
    ],
    "top_paths": [
      {
        "path": "/api/users",
        "method": "GET",
        "total": 18,
        "by_status": { "502": 15, "504": 3 }
      }
    ],
    "by_method": [
      {
        "method": "GET",
        "total": 30,
        "by_status": { "502": 22, "504": 8 }
      }
    ]
  }
}