什么是 REST API 入口点,它与端点有何不同?
What is a REST API entry point and how is it different from an endpoint?
什么是 REST API 入口点,它与端点有何不同?
我在网上搜索了各种定义,但似乎仍然无法理解它们(一般来说,我是 API 的新手)。据我了解,它们提供了与服务器通信的方式,但它们到底是什么以及入口点和端点有何相似或不同之处?
简单地说,入口点可能类似于 http://api.your-company.com
,客户将在没有任何先验知识的情况下进入。 API 将向客户传授它需要知道的一切,以便就下一步可以做什么做出明智的选择。
关于端点 Wikipedia 即声明以下内容:
Endpoint, the entry point to a service, a process, or a queue or topic destination in service-oriented architecture
从广义上讲,端点只是被调用的目标主机,它应该处理您的请求(或者在负载平衡等情况下委托给其他机器)。在更狭义的意义上,端点只是调用的服务器端内容,它正在处理您的请求,即像 http://api.your-company.com/users/12345
这样的 URI 将请求用户表示(假设是 GET 请求)。具体用户是处理的资源,而端点实际上可能是基于 Spring(或您选择的框架)的服务,处理针对所有 http://api.your-company.com/users/*
相关的所有请求。
同意 Roman Vottner 的观点并竖起大拇指。我只想在这里为任何试图获得清晰想法的人添加几个链接。
API端点
我喜欢这里的答案:https://smartbear.com/learn/performance-monitoring/api-endpoints/
Simply put, an endpoint is one end of a communication channel. When an API interacts with another system, the touchpoints of this communication are considered endpoints. For APIs, an endpoint can include a URL of a server or service. Each endpoint is the location from which APIs can access the resources they need to carry out their function.
样本在这里:What is an Endpoint?
https://example.com/api/login
https://example.com/api/accounts
https://example.com/api/cart/items
API入口点
看这里:https://restful-api-design.readthedocs.io/en/latest/urls.html
A RESTful API needs to have one and exactly one entry point. The URL of the entry point needs to be communicated to API clients so that they can find the API. Technically speaking, the entry point can be seen as a singleton resource that exists outside any collection.
所以,按照前面的例子,它将是:
https://example.com/api
额外说明:在 GraphQL 世界中,API 有一个 single endpoint
,没有入口点 (https://graphql.org/learn/best-practices/#http)。通常以
的形式
https://example.com/graphql
什么是 REST API 入口点,它与端点有何不同?
我在网上搜索了各种定义,但似乎仍然无法理解它们(一般来说,我是 API 的新手)。据我了解,它们提供了与服务器通信的方式,但它们到底是什么以及入口点和端点有何相似或不同之处?
简单地说,入口点可能类似于 http://api.your-company.com
,客户将在没有任何先验知识的情况下进入。 API 将向客户传授它需要知道的一切,以便就下一步可以做什么做出明智的选择。
关于端点 Wikipedia 即声明以下内容:
Endpoint, the entry point to a service, a process, or a queue or topic destination in service-oriented architecture
从广义上讲,端点只是被调用的目标主机,它应该处理您的请求(或者在负载平衡等情况下委托给其他机器)。在更狭义的意义上,端点只是调用的服务器端内容,它正在处理您的请求,即像 http://api.your-company.com/users/12345
这样的 URI 将请求用户表示(假设是 GET 请求)。具体用户是处理的资源,而端点实际上可能是基于 Spring(或您选择的框架)的服务,处理针对所有 http://api.your-company.com/users/*
相关的所有请求。
同意 Roman Vottner 的观点并竖起大拇指。我只想在这里为任何试图获得清晰想法的人添加几个链接。
API端点
我喜欢这里的答案:https://smartbear.com/learn/performance-monitoring/api-endpoints/
Simply put, an endpoint is one end of a communication channel. When an API interacts with another system, the touchpoints of this communication are considered endpoints. For APIs, an endpoint can include a URL of a server or service. Each endpoint is the location from which APIs can access the resources they need to carry out their function.
样本在这里:What is an Endpoint?
https://example.com/api/login
https://example.com/api/accounts
https://example.com/api/cart/items
API入口点
看这里:https://restful-api-design.readthedocs.io/en/latest/urls.html
A RESTful API needs to have one and exactly one entry point. The URL of the entry point needs to be communicated to API clients so that they can find the API. Technically speaking, the entry point can be seen as a singleton resource that exists outside any collection.
所以,按照前面的例子,它将是:
https://example.com/api
额外说明:在 GraphQL 世界中,API 有一个 single endpoint
,没有入口点 (https://graphql.org/learn/best-practices/#http)。通常以
https://example.com/graphql