Skip to main content

管理 API 令牌

¥Managing API tokens

☑️ Prerequisites
  • 仅当授予适当的权限时,管理员才可以创建、读取、更新或删除 API 令牌(请参阅 配置管理员角色)。

    ¥Administrators can create, read, update, or delete API tokens only if proper permissions are granted (see Configuring administrator roles).

  • 仅当授予 API 令牌 > 读取权限时,才能在管理面板中访问设置界面的全局设置 > API 令牌子部分。

    ¥The Global settings > API Tokens sub-section of the settings interface is accessible in the admin panel only if the API tokens > Read permission is granted.

API 令牌允许用户验证 REST 和 GraphQL API 查询(请参阅 开发者文档)。管理员可以通过以下方式管理 API 令牌

¥API tokens allow users to authenticate REST and GraphQL API queries (see Developer Documentation). Administrators can manage API tokens from

Settings icon

设置 > 全局设置 > API 令牌。

¥Settings > Global settings > API Tokens.

API tokensAPI tokens

API 令牌设置子部分显示一个表格,其中列出了所有已创建的 API 令牌。

¥The API Tokens settings sub-section displays a table listing all of the created API tokens.

该表显示每个 API 令牌的名称、描述、创建日期和上次使用日期。从该表中,管理员还可以:

¥The table displays each API token's name, description, date of creation, and date of last use. From the table, administrators can also:

  • 单击

    ¥Click on the

edit button

编辑 API 令牌的名称、描述、类型、持续时间或 重新生成令牌

¥to edit an API token's name, description, type, duration or regenerate the token.

  • 单击

    ¥Click on the

delete button

删除 API 令牌。

¥to delete an API token.

创建新的 API 令牌

¥Creating a new API token

要创建新的 API 令牌:

¥To create a new API token:

  1. 单击创建新的 API 令牌按钮。

    ¥Click on the Create new API Token button.

  2. 在 API token 版本界面中,配置新的 API token:

    ¥In the API token edition interface, configure the new API token:

    设置名称指示
    名称写入 API 令牌的名称。
    描述(可选)编写 API 令牌的描述。
    令牌持续时间选择令牌持续时间:7 天、30 天、90 天或无限制。
    令牌类型选择令牌类型:只读、完全访问或自定义。
  3. (可选)对于自定义令牌类型,通过单击内容类型名称并使用复选框启用或禁用权限来定义 API 端点的特定权限。

    ¥(optional) For the Custom token type, define specific permissions for your API endpoints by clicking on the content-type name and using checkboxes to enable or disable permissions.

  4. 单击“保存”按钮。新的 API 令牌将显示在界面顶部,并带有复制按钮 copy button

    ¥Click on the Save button. The new API token will be displayed at the top of the interface, along with a copy button.

Custom API tokenCustom API token
提醒

出于安全原因,API 令牌仅在创建后立即显示。刷新页面或导航到管理面板中的其他位置时,新创建的 API 令牌将被隐藏,并且不会再次显示。

¥For security reasons, API tokens are only shown right after they have been created. When refreshing the page or navigating elsewhere in the admin panel, the newly created API token will be hidden and will not be displayed again.

重新生成 API 令牌

¥Regenerating an API token

要重新生成 API 令牌:

¥To regenerate an API token:

  1. 单击 API 令牌的编辑按钮。

    ¥Click on the API token's edit button.

  2. 单击“重新生成”按钮。

    ¥Click on the Regenerate button.

  3. 单击对话框中的“重新生成”按钮进行确认。

    ¥Click on the Regenerate button to confirm in the dialog.

  4. 复制界面顶部显示的新 API 令牌。

    ¥Copy the new API token displayed at the top of the interface.