gpt4 book ai didi

rest - 什么是 REST API 入口点,它与端点有何不同?

转载 作者:行者123 更新时间:2023-12-03 15:23:30 25 4
gpt4 key购买 nike

什么是 REST API 入口点,它与端点有何不同?

我已经在网上搜索了各种定义,但似乎仍然无法理解它们(我通常是 API 新手)。据我了解,它们提供了与服务器通信的方式,但它们到底是什么以及入口点和端点有何相似或不同之处?

最佳答案

在这里同意 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.


sample 在这里: 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 世界中,有一个 single endpoint对于 API,没有入口点 ( https://graphql.org/learn/best-practices/#http)。通常以形式
https://example.com/graphql

关于rest - 什么是 REST API 入口点,它与端点有何不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53199289/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com