Show Table of Contents
3.2. 资源和集合
所有使用 REST 的 API 都包括两个关键的概念,您需要对它们有所了解:
- 集合
- 集合就是相同类型的一组资源。API 提供了顶级集合和子集合。
hosts集合是一个顶级集合的例子,它包括了虚拟环境中的所有虚拟主机。host.nics集合是子集合的一个例子,它包括了附加到一个主机资源上的所有网络接口卡。集合提供了多个方法来添加资源(add)、获得资源(get)和列出资源(list)。 - 资源
- REST API 中的资源就是一个带有固定接口的对象,它包括了一组和它所代表的特定资源类型相关的属性。所有资源的接口提供了更新资源(
update)和删除资源(delete)的方法。另外,一些资源还额外支持只适用于它们的某些操作,如Host资源有一个approve方法。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.