HTTP: API Design

 17th February 2022 at 3:07pm

微软 Azure 的微服务相关文档中,有几份关于 API 设计及实现的文档,看起来质量非常高(未读):

业内有三份比较流行的、可能质量也较高的 HTTP API Design Guidelines:

  1. Google API Design Guideline
  2. Microsoft REST API Guidelines
  3. Paypal API Design Guidelines:未读,陈晧认为 Microsoft 和 Paypal 的这两份是最好的
  4. Heroku HTTP API Design Guide

HTTP 动词以外的语义,它的 URL Pattern 参考 Google 规范中提到的 Custom Method

API Handyman 总结了一些实用的 API 设计技巧,同时作者写了一本书 The Design of Everyday APIs,可能值得一看。

关于 RESTful API 的核心,这篇 帖子 有几句话讲得非常好:

The key idea in any web api: you are adapting your domain to look like a document store. GET/PUT/POST/DELETE and so on are all ways of interacting with the document store.

"you are adapting your domain to look like a document store" – I'd love to see people read this, and fully understand all the conseqences and implications before they decide for (or against) REST. Really.

其他内容:

我总结的:My HTTP API Guidelines

TOC