📡API 接口文档

所有接口需要 X-API-Key 请求头认证。Base URL: https://work.issac.cc\/api.php

POST /api.php?action=report — 上报任务

curl -X POST "https://work.issac.cc\/api.php?action=report" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "platform": "xiaohongshu",
    "task_type": "publish",
    "title": "今日推荐",
    "content": "正文内容...",
    "content_url": "https://www.xiaohongshu.com/explore/xxx",
    "status": "success",
    "error_message": "",
    "executed_at": "2026-07-18 10:30:00",
    "duration_ms": 12000,
    "metadata": {"note_id": "xxx"}
  }'
字段必填说明
platform平台标识: xiaohongshu, weibo, douyin 等
task_type任务类型: publish, schedule, draft
title任务标题(≤500字)
content内容正文
content_url发布后的链接
statussuccess / failed / pending / cancelled
error_message失败时的错误信息
executed_at执行时间(默认当前时间)
duration_ms执行耗时(毫秒)
metadata扩展数据 (JSON 对象)

GET /api.php?action=tasks — 查询任务

# 今日所有任务
curl "https://work.issac.cc\/api.php?action=tasks&date=today" -H "X-API-Key: KEY"

# 筛选
curl "https://work.issac.cc\/api.php?action=tasks&platform=xiaohongshu&status=success&page=1&page_size=10" -H "X-API-Key: KEY"

GET /api.php?action=stats — 统计数据

curl "https://work.issac.cc\/api.php?action=stats" -H "X-API-Key: KEY"
# 返回: today 统计 + platforms 分布 + all_time_total

GET /api.php?action=daily_stats — 每日趋势

curl "https://work.issac.cc\/api.php?action=daily_stats&days=30" -H "X-API-Key: KEY"

GET/PUT /api.php?action=settings — 系统设置

# 获取设置
curl "https://work.issac.cc\/api.php?action=settings" -H "X-API-Key: KEY"

# 更新设置
curl -X PUT "https://work.issac.cc\/api.php?action=settings" \
  -H "X-API-Key: KEY" \
  -d '{"settings": {"webhook_url": "https://hooks.slack.com/xxx"}}'

🐍Python 示例代码

import requests
from datetime import datetime

API_URL = "https://work.issac.cc\/api.php"
API_KEY = "YOUR_API_KEY"

def report_task(platform, task_type, title, content="", 
                content_url="", status="success", error_message="",
                duration_ms=0, metadata=None):
    payload = {
        "platform": platform,
        "task_type": task_type,
        "title": title,
        "content": content,
        "content_url": content_url,
        "status": status,
        "error_message": error_message,
        "executed_at": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
        "duration_ms": duration_ms,
        "metadata": metadata or {}
    }
    resp = requests.post(
        f"{API_URL}?action=report",
        headers={"X-API-Key": API_KEY, "Content-Type": "application/json"},
        json=payload, timeout=10
    )
    return resp.json()

# 使用示例
result = report_task(
    platform="xiaohongshu",
    task_type="publish",
    title="今日面包推荐 | 全麦吐司测评",
    content="今天分享一款全麦吐司...",
    content_url="https://www.xiaohongshu.com/explore/xxx",
    status="success",
    duration_ms=15000,
    metadata={"note_id": "abc123", "tags": ["面包", "测评"]}
)
print(result)