{
  "message": "Method not allowed!",
  "hint": {
    "title": "HTML Renderer API",
    "description": "将 HTML 或公网 URL 渲染为 PDF、PNG 或 JPEG。",
    "request": {
      "method": "POST",
      "content_sources": [
        "html",
        "url"
      ],
      "direct_html_upload": {
        "content_type": "text/html",
        "body": "HTML 文件本身",
        "parameters": "query"
      },
      "parameters_location": [
        "JSON body",
        "query string"
      ],
      "parameter_priority": "同名参数同时存在时，JSON body 优先"
    },
    "parameters": {
      "html": {
        "location": "JSON body",
        "required": false,
        "description": "HTML 字符串，与 url 二选一"
      },
      "url": {
        "location": "JSON body",
        "required": false,
        "description": "公网可访问的页面地址，与 html 二选一",
        "note": "html 和 url 同时传时使用 url"
      },
      "format": {
        "location": [
          "body",
          "query"
        ],
        "required": false,
        "default": "pdf",
        "values": [
          "pdf",
          "png",
          "jpeg",
          "jpg"
        ],
        "description": "输出文件格式"
      },
      "width": {
        "location": [
          "body",
          "query"
        ],
        "required": false,
        "default": 1280,
        "type": "integer",
        "unit": "px",
        "description": "视口宽度，对图片输出更有意义"
      },
      "height": {
        "location": [
          "body",
          "query"
        ],
        "required": false,
        "default": 720,
        "type": "integer",
        "unit": "px",
        "description": "视口高度"
      },
      "fullPage": {
        "location": [
          "body",
          "query"
        ],
        "required": false,
        "default": true,
        "type": "boolean",
        "description": "是否截取整个页面，仅图片格式有效"
      },
      "quality": {
        "location": [
          "body",
          "query"
        ],
        "required": false,
        "default": 80,
        "type": "integer",
        "range": [
          0,
          100
        ],
        "description": "JPEG 图片质量，仅 jpeg/jpg 有效"
      }
    },
    "pdf": {
      "page_size": "A4",
      "print_background": true,
      "margin": "20px"
    },
    "response": {
      "success": {
        "description": "响应 body 为生成文件的二进制数据",
        "formats": {
          "pdf": {
            "content_type": "application/pdf",
            "filename": "output.pdf"
          },
          "png": {
            "content_type": "image/png",
            "filename": "output.png"
          },
          "jpeg": {
            "content_type": "image/jpeg",
            "filename": "output.jpg"
          },
          "jpg": {
            "content_type": "image/jpeg",
            "filename": "output.jpg"
          }
        }
      },
      "error": {
        "content_type": "application/json",
        "body": {
          "error": "错误类型",
          "message": "错误描述"
        }
      }
    },
    "status_codes": {
      "400": "缺少 html/url，或 format 不支持",
      "405": "请求方法不是 POST",
      "500": "渲染失败，例如超时、URL 无法访问或 HTML 异常"
    },
    "examples": [
      {
        "name": "HTML → PDF",
        "description": "默认输出 PDF",
        "method": "POST",
        "content_type": "application/json",
        "body": {
          "html": "<h1>你好</h1><p>这是一段内容</p>"
        },
        "output": "test.pdf"
      },
      {
        "name": "HTML → PNG",
        "method": "POST",
        "content_type": "application/json",
        "body": {
          "html": "<h1>你好</h1>",
          "format": "png"
        },
        "output": "test.png"
      },
      {
        "name": "HTML → JPEG",
        "method": "POST",
        "content_type": "application/json",
        "body": {
          "html": "<h1>你好</h1>",
          "format": "jpeg",
          "quality": 80
        },
        "output": "test.jpg"
      },
      {
        "name": "指定视口",
        "method": "POST",
        "content_type": "application/json",
        "body": {
          "html": "<h1>卡片</h1>",
          "format": "png",
          "width": 800,
          "height": 600,
          "fullPage": false
        },
        "output": "card.png"
      },
      {
        "name": "URL → PDF",
        "method": "POST",
        "content_type": "application/json",
        "body": {
          "url": "https://example.com"
        },
        "output": "example.pdf"
      },
      {
        "name": "URL → PNG",
        "method": "POST",
        "content_type": "application/json",
        "body": {
          "url": "https://example.com",
          "format": "png",
          "fullPage": true
        },
        "output": "example.png"
      },
      {
        "name": "使用 Query 参数",
        "method": "POST",
        "url": "/?format=png&width=1280&fullPage=true",
        "content_type": "application/json",
        "body": {
          "html": "<h1>你好</h1>"
        },
        "output": "test.png"
      },
      {
        "name": "上传 HTML 文件",
        "method": "POST",
        "content_type": "text/html",
        "body": "HTML 文件二进制内容",
        "query": {},
        "output": "page.pdf"
      },
      {
        "name": "上传 HTML 文件 → PNG",
        "method": "POST",
        "url": "/?format=png&width=1280&fullPage=true",
        "content_type": "text/html",
        "body": "HTML 文件二进制内容",
        "output": "page.png"
      }
    ]
  }
}