Skip to main content

用于访问你的内容的 Strapi API

¥Strapi APIs to access your content

创建并配置 Strapi 项目、使用 内容类型生成器 创建数据结构并开始通过 内容管理者 添加数据后,你可能想要访问你的内容。

¥Once you've created and configured a Strapi project, created a data structure with the Content-Type Builder and started adding data through the Content Manager, you likely would like to access your content.

从前端应用,你的内容可以通过 Strapi 的 Content API 访问,该 API 公开:

¥From a front-end application, your content can be accessed through Strapi's Content API, which is exposed:

REST 和 GraphQL API 代表暴露给外部应用的 Content API 的顶层。Strapi 还提供 2 个更底层的 API:

¥REST and GraphQL APIs represent the top-level layers of the Content API exposed to external applications. Strapi also provides 2 lower-level APIs:

  • 实体服务 API 是推荐的 API,用于在 后端服务器 内或通过 plugins 与应用的数据库进行交互。实体服务是处理 Strapi 复杂数据结构(如组件和动态区域)的层,而较低层不知道这些数据结构。

    ¥The Entity Service API is the recommended API to interact with your application's database within the backend server or through plugins. The Entity Service is the layer that handles Strapi's complex data structures like components and dynamic zones, which the lower-level layers are not aware of.

  • 查询引擎 API 与更底层的数据库层交互,并在幕后用于执行数据库查询。它提供对数据库层的不受限制的内部访问,但仅当实体服务 API 不涵盖你的用例时才应使用。

    ¥The Query Engine API interacts with the database layer at a lower level and is used under the hood to execute database queries. It gives unrestricted internal access to the database layer, but should be used only if the Entity Service API does not cover your use case.


本文档部分包括有关以下 Strapi API 的参考信息以及一些与第三方技术的集成指南:

¥This documentation section includes reference information about the following Strapi APIs and some integration guides with 3rd party technologies:

✏️ 插件 API

插件 也有他们专用的 API:服务器 API 和管理面板 API。这些与插件相关的 API 用于开发插件,并允许插件与 Strapi (服务器 API) 的后端服务器或 Strapi (管理面板 API) 的管理面板进行交互。

¥Plugins also have their dedicated APIs: the Server API and the Admin Panel API. These plugin-related APIs are offered to develop plugins and allow a plugin to interact either with the back-end server of Strapi (Server API) or with the admin panel of Strapi (Admin Panel API).