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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

HTTP API Design Guide

50 点作者 D_Guidi超过 10 年前

3 条评论

justboxing超过 10 年前
Please pardon my ignorance, but I am building a REST API using ASP.Net MVC 5 and Web API 2.0. I am not very clear on the following, can someone please help me with these recommendations in the Guide.<p>1) &quot;Require TLS&quot;: How do I implement this for my Web API Project? Also what exactly does the author mean by saying &quot;Require TLS&quot;. Is it achieved by using some kind of API Key+Token, or by using SSL for all communication, or is it something else?<p>2) &quot;Responses - Provide resource (UU)IDs.&quot;. I have AutoIDs in all my tables for all the resources that are exposed as endpoints over HTTP. Is it ok to use this internal AutoID PK (PrimaryKey) value as id for the endpoints (ex: Updating a Resource by ID etc) or should I use a different ID field? Reason for asking is, I&#x27;ve been told by many people that &quot;It&#x27;s not good practice to expose your internal PK IDs anywhere to the outside world.&quot;.<p>3) &quot;Keep JSON minified in all responses&quot; - How can I do this in .Net &#x2F; Web API? Are there libraries that already do this, or do I need to roll one from scratch.<p>Thank you!!!
评论 #8664923 未加载
评论 #8664903 未加载
glenscott1超过 10 年前
Most of these points seem well-thought out, but the pagination system using Content-Range headers seems a little bit quirky.<p>GitHub are using Link headers which seems more in keeping with the typical web approach of pagination:<p><a href="https://developer.github.com/v3/#pagination" rel="nofollow">https:&#x2F;&#x2F;developer.github.com&#x2F;v3&#x2F;#pagination</a><p>Does anyone have any real world experience with either of these approaches?
kimh超过 10 年前
I am not sure about &quot;Provide full resources where available&quot;. Why do we need to return everything with DELETE request? Client is supposed to know what to be deleted, so the response seems redundant.
评论 #8666285 未加载
评论 #8665818 未加载