查看自动切换状态

返回账号的自动切换设置、供应商健康状态和最近 50 条切换记录。

GET/api/settings/fallback
认证
控制台会话 Cookie。
成功状态
200

请求参数

此操作无需提交参数。

请求示例

JavaScript 示例可在本站已登录的浏览器中运行。cURL 和 Python 示例读取你本机的 cookies.txt Cookie 文件。请将会话 Cookie 视为私密凭据。

cURL
curl -i -X GET 'https://social2api.com/api/settings/fallback' \
  --cookie ./cookies.txt
Python
from urllib.error import HTTPError
from urllib.request import Request, HTTPCookieProcessor, build_opener
from http.cookiejar import MozillaCookieJar

request = Request(
    "https://social2api.com/api/settings/fallback",
    method="GET",
)
cookies = MozillaCookieJar("./cookies.txt")
cookies.load(ignore_discard=True)
send = build_opener(HTTPCookieProcessor(cookies)).open
try:
    with send(request) as response:
        print(response.status, response.read().decode("utf-8"))
except HTTPError as error:
    print(error.code, error.read().decode("utf-8"))
JavaScript
const response = await fetch("/api/settings/fallback", {
  method: "GET",
  credentials: "same-origin",
});
console.log(response.status, await response.text());

响应

200 · 示例响应
{
  "enabled": true,
  "providers": [
    {
      "id": "tikhub",
      "label": "TikHub",
      "configured": false,
      "status": "missing_config",
      "tasks": [
        "rednote",
        "douyin",
        "channels"
      ],
      "cooldownUntil": null,
      "lastError": null
    },
    {
      "id": "dataxapi",
      "label": "DataXAPI",
      "configured": false,
      "status": "missing_config",
      "tasks": [
        "rednote",
        "douyin",
        "channels"
      ],
      "cooldownUntil": null,
      "lastError": null
    },
    {
      "id": "socialtoai",
      "label": "SocialToAI",
      "configured": false,
      "status": "missing_config",
      "tasks": [
        "rednote",
        "douyin",
        "channels"
      ],
      "cooldownUntil": null,
      "lastError": null
    }
  ],
  "events": []
}
错误示例
{
  "error": "请先登录。"
}
字段类型说明
enabledboolean该账号是否允许自动切换数据源。
providers[].idstring供应商 ID。
providers[].labelstring供应商显示名称。
providers[].configuredboolean当前部署是否配置该供应商。
providers[].statusmissing_config | unchecked | healthy | cooldown当前实例的供应商状态。
providers[].tasksstring[]该供应商在当前部署启用的任务 ID。
providers[].cooldownUntilISO 8601 date-time | null当前冷却结束时间。
providers[].lastErrorstring | null最近记录的供应商故障原因。
events[].idstring切换记录 ID。
events[].atISO 8601 date-time记录时间。
events[].taskstring触发切换的取数任务。
events[].fromstring来源供应商 ID。
events[].tostring目标供应商 ID。
events[].reasonstring触发切换的原因。

错误状态

HTTP原因与处理
401控制台会话缺失、过期或无效。
405请求方法不受支持。
503此部署未配置该控制台服务。

使用细节

  • 默认依次尝试 TikHub、DataXAPI、SocialToAI,跳过未配置、冷却或不支持输入的供应商。关闭自动切换时只尝试第一个已配置且适用的供应商。