# 文件

> Source: https://strapi.nodejs.cn/cms/api/document

<div className="document-concept-page custom-mermaid-layout">

# 文件 {#documents}

🌐 Documents

文档是一个仅限 API 的概念，表示单个内容类型条目的所有内容变体（本地化、草稿/已发布版本）。使用文档服务 API 在后端操作文档。

🌐 A document is an API-only concept representing all content variations (locales, draft/published versions) for a single content-type entry. Use the Document Service API to manipulate documents on the back-end.

在 Strapi 5 中，**文档**是一个仅限 API 的概念。文档代表了给定内容类型条目所有不同的内容变体。

🌐 A **document** in Strapi 5 is an API-only concept. A document represents all the different variations of content for a given entry of a content-type.

单一类型包含一个唯一文档，而集合类型可以包含多个文档。

🌐 A single type contains a unique document, and a collection type can contain several documents.

当你使用管理员面板时，从未提到文档的概念，并且对终端用户并不必要。用户在[内容管理器](/cms/features/content-manager)中创建和编辑**条目**。例如，作为用户，你要么列出给定语言环境下的条目，要么编辑给定语言环境中特定条目的草稿版本。

🌐 When you use the admin panel, the concept of a document is never mentioned and not necessary for the end user. Users create and edit **entries** in the [Content Manager](/cms/features/content-manager). For instance, as a user, you either list the entries for a given locale, or edit the draft version of a specific entry in a given locale.

但是，在 API 级别，条目字段的值实际上可以具有：

🌐 However, at the API level, the value of the fields of an entry can actually have:

- 英语和法语语言环境的内容不同，
- 甚至在每个语言环境中为草稿和已发布版本设置不同的内容。

包含所有语言环境的所有草稿和已发布版本内容的存储桶是一个文档。

🌐 The bucket that includes the content of all the draft and published versions for all the locales is a document.

使用 [文档服务 API](/cms/api/document-service) 操作文档将帮助你创建、检索、更新和删除文档或其中包含的特定数据子集。

🌐 Manipulating documents with the [Document Service API](/cms/api/document-service) will help you create, retrieve, update, and delete documents or a specific subset of the data they contain.

下列图表显示了内容的所有可能变体，这取决于内容类型启用了哪些功能，例如[国际化 (i18n)](/cms/features/internationalization)和[草稿与发布](/cms/features/draft-and-publish)：

🌐 The following diagrams represent all the possible variations of content depending on which features, such as [Internationalization (i18n)](/cms/features/internationalization) and [Draft & Publish](/cms/features/draft-and-publish), are enabled for a content-type:

- 如果内容类型启用了国际化 (i18n) 功能，则一个文档可以拥有多个**文档语言环境**。
- 如果在内容类型上启用了“草稿与发布”功能，文档可以同时拥有**已发布**版本和**草稿**版本。

:::strapi APIs to query documents data

要与文档或它们所代表的数据进行交互：

🌐 To interact with documents or the data they represent:

  - 从后端服务器（例如，从控制器、服务以及插件的后端部分）使用 [文档服务 API](/cms/api/document-service)。
  - 从应用的前端部分，使用 [REST API](/cms/api/rest) 或 [GraphQL API](/cms/api/graphql) 查询你的数据。

有关 API 的更多信息，请参阅 [内容 API 介绍](/cms/api/content-api)。

🌐 For additional information about the APIs, please refer to the [Content API introduction](/cms/api/content-api).

:::

:::info Default version in returned results

后端和前端 API 之间的一个重要区别是关于未传递参数时返回的默认版本：

🌐 An important difference between the back-end and front-end APIs is about the default version returned when no parameter is passed:

- 文档服务 API 默认返回草稿版本，
- 而 REST 和 GraphQL API 默认返回已发布的版本。

:::

</div>
