API 文档

    为集成 QR Cake 提供的开发者资源与指南。

    JSON REST API动态二维码创建Bearer 授权

    快速入门

    QR Cake API 可让 QR Cake 用户管理自己账户中的二维码。

    基础 URL
    https://api.qrcake.com/v1/product

    身份验证

    在控制台中创建 API 密钥,并将其放入 Authorization 请求头中发送。

    Authorization: Bearer <API Key>
    Content-Type: application/json

    在以下位置管理 API 密钥 控制台 API 密钥.

    API 请求测试器

    直接在此页面测试接口。输入你的 API 密钥,选择一个接口,即可查看实时响应。

    交互式 API 测试器

    直接在浏览器中向所选的 QR Cake API 接口发起请求。

    GET
    Authorization: Bearer <API Key>
    解析后的 URL
    https://api.qrcake.com/v1/product/user/product
    发送请求后,可在此查看实时状态和响应结果。

    术语

    产品

    二维码

    用户

    QR Cake 账户

    请求体(POST/PUT)

    对于 POST 和 PUT 请求,请求体必须先序列化为字符串。如果你发送的是 JSON,请传入 JSON 字符串(例如 JSON.stringify(payload)).

    const payload = { redirect: "https://example.com", metadata: {} };
    
    await fetch(url, {
      method: "POST",
      body: JSON.stringify(payload),
    });
    GET

    获取二维码列表

    列出 API 密钥可访问的二维码。

    在 GitBook 中打开
    路径: /user/product
    URL: https://api.qrcake.com/v1/product/user/product
    请求详情
    标头
    • Authorization: Bearer <API Key>
    • Accept: application/json
    响应
    200 OK
    [
      {
        "accountId": "string",
        "productId": "string",
        "userId": "string",
        "redirect": "string",
        "state": "ACTIVE",
        "metadata": {},
        "createdAt": 0,
        "updatedAt": 0
      }
    ]
    401 Unauthorized
    {
      "message": {}
    }

    Products 即二维码。

    GET

    获取单个二维码

    获取一个二维码。

    在 GitBook 中打开
    路径: /product/{productId}
    URL: https://api.qrcake.com/v1/product/product/{productId}
    请求详情
    路径参数
    • productId (string)
    标头
    • Authorization: Bearer <API Key>
    • Accept: application/json
    响应
    200 OK
    {
      "accountId": "string",
      "productId": "string",
      "userId": "string",
      "redirect": "string",
      "state": "ACTIVE",
      "metadata": {},
      "createdAt": 0,
      "updatedAt": 0
    }
    401 Unauthorized
    {
      "message": {}
    }
    POST

    创建二维码

    创建一个新的二维码。

    在 GitBook 中打开
    路径: /product
    URL: https://api.qrcake.com/v1/product/product
    请求详情
    标头
    • Authorization: Bearer <API Key>
    • Content-Type: application/json
    • Accept: application/json
    请求体模板
    {
      "redirect": "https://example.com",
      "metadata": {},
      "state": "ACTIVE"
    }
    响应
    200 OK
    {
      "accountId": "string",
      "productId": "string",
      "userId": "string",
      "redirect": "string",
      "state": "ACTIVE",
      "metadata": {},
      "createdAt": 0,
      "updatedAt": 0
    }
    401 Unauthorized
    {
      "message": {}
    }

    POST 请求正文必须是字符串化的(例如,JSON.stringify(payload))。

    PUT

    更新二维码

    更新一个已有的二维码。

    在 GitBook 中打开
    路径: /product/{productId}
    URL: https://api.qrcake.com/v1/product/product/{productId}
    请求详情
    路径参数
    • productId (string)
    标头
    • Authorization: Bearer <API Key>
    • Content-Type: application/json
    • Accept: application/json
    请求体模板
    {
      "redirect": "https://example.com",
      "metadata": {},
      "state": "ACTIVE"
    }
    响应
    200 OK
    {
      "accountId": "string",
      "productId": "string",
      "userId": "string",
      "redirect": "string",
      "state": "ACTIVE",
      "metadata": {},
      "expiresAt": 0,
      "createdAt": 0,
      "updatedAt": 0
    }
    401 Unauthorized
    {
      "message": {}
    }

    PUT 请求正文必须字符串化。

    DELETE

    删除二维码

    删除一个二维码。

    在 GitBook 中打开
    路径: /product/{productId}
    URL: https://api.qrcake.com/v1/product/product/{productId}
    请求详情
    路径参数
    • productId (string)
    标头
    • Authorization: Bearer <API Key>
    • Accept: application/json
    响应
    200 OK
    {
      "productId": "string"
    }
    401 Unauthorized
    {
      "message": {}
    }
    GET

    权限

    返回授予 API 键的权限。

    在 GitBook 中打开
    路径: /permission
    URL: https://api.qrcake.com/v1/product/permission
    请求详情
    标头
    • Authorization: Bearer <API Key>
    • Accept: application/json
    响应
    200 OK
    {
      "success": true,
      "result": {
        "analytics": true,
        "productLimit": 100,
        "tier": "subscriber",
        "productTotal": 3,
        "productActiveLimit": 100,
        "productActiveTotal": 3
      }
    }
    401 Unauthorized
    {
      "message": {}
    }

    支持的二维码类型

    创建或更新 QR 产品时使用这些元数据类型。

    redirect, link, image, video, file, pdf, audio, app, event, vCard

    先从我们首页的 动态二维码可编辑二维码 开始了解。