TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Request for Comments: New API Design Concept [pdf]

2 点作者 __experiment__大约 1 年前

2 条评论

pledess大约 1 年前
For example, GET &#x2F;tickets&#x2F;12&#x2F;messages&#x2F;5 has these advantages over api_get_message_from_ticket?ticket_id=12&amp;message_id=5<p>Avoids writing everything twice: you don&#x27;t need to name the data fields both in the base URL and in the query string<p>If there are several parameters, writing everything twice may make the URL longer than one physical line in a text editor<p>The ? and &amp; characters need to be quoted in most shells<p>The _ characters are sometimes hard to read if the entire URL is underlined<p>Names with api_json don&#x27;t make it clear whether the request body must be sent as JSON, the response will be JSON, or both
__experiment__大约 1 年前
I need input on this new API design, i call if &#x27;Functional APIs(fAPIs)&#x27;<p>Given that hacker news is mostly developer-oriented i would like your opinion as to why we don&#x27;t use &quot;HTTP APIs&quot; as mostly single functions instead of the REST and GraphQL horrors i see on a weekly basis.<p>why not:<p><a href="https:&#x2F;&#x2F;example.org&#x2F;api_json_create_new_user" rel="nofollow">https:&#x2F;&#x2F;example.org&#x2F;api_json_create_new_user</a><p>body -&gt; { &#x27;name&#x27;: &#x27;new user&#x27; &#x27;email&#x27;: &#x27;email@gmail.com&#x27; &#x27;password_hash&#x27;: &#x27;50e721e49c013f00c62cf59f2163542a9d8df02464efeb615d31051b0fddc326&#x27; ... }<p>200 OK<p>instead of<p><a href="https:&#x2F;&#x2F;example.org&#x2F;v1&#x2F;users&#x2F;create&#x2F;new" rel="nofollow">https:&#x2F;&#x2F;example.org&#x2F;v1&#x2F;users&#x2F;create&#x2F;new</a> &lt;body&gt;<p>200 OK<p>i attached a PDF link with more details.<p>criticism is welcomed.
评论 #40110762 未加载