deno.com
在本頁面上

身份驗證

開發人員可以使用子託管 REST API 來佈建專案、網域、KV 資料庫和其他資源。

端點與身份驗證 跳到標題

子託管 REST API v1 的基本 URL 如下。

https://api.deno.com/v1/

v1 API 使用 HTTP Bearer Token 身份驗證。您可以在儀表板中建立存取權杖以使用 API,請點擊此處。大多數 API 請求也需要您的組織 ID。您可以從您的組織的 Deno Deploy 儀表板中檢索您的組織 ID。

Find your org ID here

結合您的組織 ID 和存取權杖,您可以透過列出與您的組織關聯的所有專案來測試您的 API 存取權。這是一個範例 Deno 腳本,您可以用來存取 API。

// Replace these with your own!
const organizationId = "a75a9caa-b8ac-47b3-a423-3f2077c58731";
const token = "ddo_u7mo08lBNHm8GMGLhtrEVfcgBsCuSp36dumX";

const res = await fetch(
  `https://api.deno.com/v1/organizations/${organizationId}/projects`,
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${token}`,
    },
  },
);

const response = await res.json();
console.log(response);

您找到需要的資訊了嗎?

隱私權政策