deno.com
本页内容

身份验证

开发者可以使用 Subhosting REST API 来配置项目、域名、KV 数据库和其他资源。

端点和身份验证 Jump to heading

Subhosting 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 访问权限。这是一个您可以用来访问 API 的 Deno 脚本示例。

// 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);

您找到所需的信息了吗?

隐私政策