TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Request for Comments: New API Design Concept [pdf]

2 pointsby __experiment__about 1 year ago

2 comments

pledessabout 1 year ago
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__about 1 year ago
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 未加载