動態 QR Code API 文件 | QR Cake

    使用 QR Cake API 建立、更新並管理動態 QR Code。產生 API 金鑰、測試請求,把 QR Code 工作流程接到你自己的工具裡。

    JSON REST API建立動態 QR CodeAPI 金鑰驗證

    快速上手

    QR Cake API 讓 QR Cake 使用者可以管理自己帳戶底下的 QR Code。

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

    身分驗證

    在後台建立一組 API 金鑰,並放在 x-api-key 請求標頭中送出。

    x-api-key: <API Key>
    Content-Type: application/json

    在這裡管理 API 金鑰: 後台 API 金鑰.

    API 請求測試工具

    直接在本頁測試各個端點。輸入你的 API 金鑰、選一個端點,就能看到即時回應。

    互動式 API 測試工具

    直接在瀏覽器中對所選的 QR Cake API 端點發出請求。

    GET
    x-api-key: YOUR_API_KEY
    解析後的 URL
    https://api.qrcake.com/v1/product/api/product
    送出請求之後,可以在這裡看到即時狀態碼和回應內容。

    術語說明

    產品

    QR Code

    使用者

    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

    取得 QR Code 清單

    列出目前 API 金鑰可以存取的 QR Code。

    在 GitBook 中開啟
    路徑: /product
    URL: https://api.qrcake.com/v1/product/api/product
    請求詳情
    請求標頭
    • x-api-key: <API Key>
    • Accept: application/json
    回應
    200 OK
    [
      {
        "accountId": "string",
        "productId": "string",
        "userId": "string",
        "redirect": "string",
        "state": "ACTIVE",
        "metadata": {},
        "createdAt": 0,
        "updatedAt": 0
      }
    ]
    401 未授權
    {
      "message": {}
    }

    Products 就是 QR Code。

    GET

    取得單一 QR Code

    取得一個 QR Code 的詳細資料。

    在 GitBook 中開啟
    路徑: /product/{productId}
    URL: https://api.qrcake.com/v1/product/api/product/{productId}
    請求詳情
    路徑參數
    • productId (string)
    請求標頭
    • x-api-key: <API Key>
    • Accept: application/json
    回應
    200 OK
    {
      "accountId": "string",
      "productId": "string",
      "userId": "string",
      "redirect": "string",
      "state": "ACTIVE",
      "metadata": {},
      "createdAt": 0,
      "updatedAt": 0
    }
    401 未授權
    {
      "message": {}
    }
    POST

    建立 QR Code

    建立一個新的 QR Code 產品。

    在 GitBook 中開啟
    路徑: /product
    URL: https://api.qrcake.com/v1/product/api/product
    請求詳情
    請求標頭
    • x-api-key: <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 未授權
    {
      "message": {}
    }

    POST 的主體必須轉成字串(例如 JSON.stringify(payload))。

    PUT

    更新 QR Code

    更新一個既有的 QR Code(product)。

    在 GitBook 中開啟
    路徑: /product/{productId}
    URL: https://api.qrcake.com/v1/product/api/product/{productId}
    請求詳情
    路徑參數
    • productId (string)
    請求標頭
    • x-api-key: <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 未授權
    {
      "message": {}
    }

    PUT 的主體必須轉成字串。

    DELETE

    刪除 QR Code

    刪除一個 QR Code。

    在 GitBook 中開啟
    路徑: /product/{productId}
    URL: https://api.qrcake.com/v1/product/api/product/{productId}
    請求詳情
    路徑參數
    • productId (string)
    請求標頭
    • x-api-key: <API Key>
    • Accept: application/json
    回應
    200 OK
    {
      "productId": "string"
    }
    401 未授權
    {
      "message": {}
    }
    GET

    權限

    回傳這組 API 金鑰擁有的權限。

    在 GitBook 中開啟
    路徑: /permission
    URL: https://api.qrcake.com/v1/product/api/permission
    請求詳情
    請求標頭
    • x-api-key: <API Key>
    • Accept: application/json
    回應
    200 OK
    {
      "success": true,
      "result": {
        "tier": "subscriber",
        "active": true,
        "analytics": true,
        "productLimit": 100,
        "productTotal": 3,
        "productActiveLimit": 100,
        "productActiveTotal": 3
      }
    }
    401 未授權
    {
      "message": {}
    }

    支援的 QR Code 類型

    建立或更新 QR Code 產品時,請使用這些中繼資料類型。

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

    可以先從我們首頁的 動態 QR Code可編輯 QR Code 開始了解。