REST API 的组件叫什么?

What is a component of an REST API called?

API的一件有名字吗?

例如,假设我有一个 API 提供四种服务:

getCustomerInfo
setCustomerInfo
getProductInfo
setProductInfo

然后说,我想告诉同事:

The API is going to need a fifth webhook?

我知道这是对 webhook 一词的错误使用。

正确的术语是什么? 谢谢!

更新:这可能是重复的。 krishna kanth 在这里的回答:What is an Endpoint? 是:

The term Endpoint was initially used for WCF services. Later even though this word is being used synonymous to API resources, REST recommends to call these URI (URI[s] which understand HTTP verbs and follow REST architecture) as "Resource".

In a nutshell, a Resource or Endpoint is kind of an entry point to a remotely hosted application which lets the users to communicate to it via HTTP protocol.

我认为您要找的词是资源。我还认为获取和设置将在单个资源下组合,并且对该资源的 HTTP 调用将定义您是获取还是放置(使用 HTTP 在 REST 中设置)。

我认为一般来说 API 是各种软件组件之间的一组通信方法。

所以,我想说: API 需要第五种方法吗?

维基百科也在这里定义了 API 和方法: https://en.wikipedia.org/wiki/Application_programming_interface

Roy Thomas Fielding 在您的哲学博士论文(参见 Architectural Styles and the Design of Network-based Software Architectures)中将其定义为 资源标识符

根据罗伊·菲尔丁的说法:

REST uses a resource identifier to identify the particular resource involved in an interaction between components.

我相信您可以使用资源标识符 /product 来处理 product 资源,使用资源标识符 /customer 来处理 customer 资源。此外,使用适当的 HTTP 方法来执行所需的操作。例如:

  • PUT 到 /product/{id} 以编辑由 {id}(而不是 setProductInfo)识别的 product 资源
  • GET 到 /product/{id} 到 return 由 {id}(而不是 getProductInfo
  • 标识的 product 资源的表示