一盏灯
首页文章视频生词本复习
首页文章视频生词本我的

Announcing an API Deprecation

废弃接口的公告怎么写才不炸锅

科技互联网模板范文高级约 4 分钟场景 · deprecation notice# 邮件与写作# 创业与出海

读完你能写出一份不炸锅的接口废弃公告:日期放最前并刻意重复一次、理由讲技术不讲商业、把迁移工作量量化成『大多数人一天搞定』、按 90/30/7 天分级提醒并附上对方自己的调用量,以及主动给出有范围限定的延期。文末还有一份语气清单:别用被动语态推诿,别在别人的活前面加『只需』。

当前浏览器暂不支持语音朗读

Retiring a public API is less an engineering task than a diplomatic one. Somewhere out there, a team you have never met has built their revenue on the endpoint you are about to switch off. The announcement you write decides whether they migrate quietly or escalate to your CEO. The rule is blunt: give them dates, give them a path, and never let them discover the change from a failing build on a Monday morning.

下线一个对外 API,与其说是工程活,不如说是外交活。世界的某个角落里,有一个你从未谋面的团队,把他们的营收建在了你即将关掉的那个接口上。你写的这份公告,决定了他们是安静地迁移,还是把事情捅到你们 CEO 那里。规则很直白:给日期、给路径,并且绝不能让他们在某个周一早上从一次构建失败里才发现这件事。

"Subject: Deprecating the v1 Search API — sunset on 1 March 2027. We are deprecating the v1 Search API. It will keep working, unchanged and fully supported, until 1 March 2027, twelve months from today. After that date, requests to /v1/search will return a 410 and will no longer be served. The replacement, v2, is available now and is documented at the link below."

『主题:v1 搜索 API 将废弃——2027 年 3 月 1 日停止服务 我们将废弃 v1 搜索 API。在 2027 年 3 月 1 日之前,也就是从今天起的十二个月内,它会照常运行、维持完整支持、不做任何变更。该日期之后,对 /v1/search 的请求将返回 410,不再提供服务。替代方案 v2 现已可用,文档见下方链接。』

Lead with the date, not the reasoning. A developer skimming this needs one fact before anything else: when does my code break? Notice the deliberate redundancy — the sunset date appears in the subject line and again in the first sentence, because half your readers will only ever see one of the two. Twelve months is generous; anything shorter than a quarter reads as a decision made without you in the room.

先说日期,再说理由。一个匆匆扫过公告的开发者,在关心别的之前只想知道一个事实:我的代码什么时候会挂?注意那处刻意的重复——停服日期在主题行里出现了一次,在正文第一句又出现了一次,因为你有一半读者从头到尾只会看到其中之一。十二个月算是宽裕;任何短于一个季度的期限,读起来都像是一个没让你在场就做出的决定。

"Why we are doing this: v1 cannot express filters across multiple indexes, and every workaround we ship makes the next one harder. v2 replaces it with a single query grammar. Most integrations migrate in under a day. The mapping between old and new parameters is documented endpoint by endpoint, and our migration guide covers the three cases that are not a straight swap."

『我们为什么要这么做:v1 无法表达跨多个索引的筛选条件,而我们每加一个绕行方案,下一个就更难做。v2 用一套统一的查询语法取代了它。大多数集成方在一天之内就能迁完。新旧参数的对应关系已逐个接口整理成文档,迁移指南也覆盖了那三种不能直接平移的情况。』

The rationale belongs here, after the facts, and it should be honest without being self-flagellating. Notice that the reason given is technical rather than commercial: nobody resents a limit they can verify, but everyone resents being moved so that you can upsell them. Then quantify the effort. "Most integrations migrate in under a day" converts a vague dread into a task someone can schedule, and it is the single sentence most likely to defuse an angry reply.

理由该放在这儿,放在事实之后,而且要诚实,但不必自我鞭挞。注意这里给的理由是技术性的,而非商业性的:没有人会怨恨一个自己能验证的技术限制,但所有人都会怨恨『被迫搬家只是为了让你好卖高价套餐』。然后把工作量量化。『大多数集成方一天之内就能迁完』把一团模糊的恐惧变成了一件可以排期的任务,它也是最有可能把一封怒气冲冲的回信化解掉的那一句。

"What we will do for you: we will email every account still calling v1 at ninety, thirty, and seven days before the sunset, with the exact call volumes we see from your keys. We are running two open office hours in September for anyone who wants help. If the deadline is genuinely unworkable for you, reply to this thread — we would rather grant a scoped extension than break you silently."

『我们会为你做什么:在停服前 90 天、30 天、7 天,我们会给每一个仍在调用 v1 的账号发邮件,并附上我们从你的密钥上看到的实际调用量。九月我们会开两场开放答疑,谁需要帮忙都可以来。如果这个期限对你确实行不通,直接回复这封邮件——比起悄无声息地让你挂掉,我们更愿意给一个有范围限定的延期。』

This paragraph is the one that keeps the announcement out of an angry forum thread. Reminders tied to a customer's own traffic tell them you know exactly who is affected, which is far more reassuring than a broadcast. The offer of an extension costs you little — few teams take it — and it converts the loudest objection into a private conversation. Just never promise an extension you will not honour; a deadline you roll back is worse than a firm one.

这一段,正是让公告不至于变成论坛上一个怒帖的那一段。基于客户自身流量的提醒,等于告诉他们你清楚地知道谁会受影响,这比一封群发通知让人安心得多。而提供延期的成本其实很低——真正来要的团队没几个——它却能把最大的那声反对,转化成一次私下的沟通。只是千万别承诺你不打算兑现的延期;一个被你往回改的期限,比一个硬邦邦的期限更糟。

A final note on tone. Avoid the passive voice that developers read as evasion: "the endpoint will be retired" hides the fact that a team chose to do it. Say we. Avoid softening words like minor or simply in front of work you are not doing yourself. And publish the notice in every channel your users actually read — changelog, dashboard banner, email — because a deprecation nobody saw is an outage with a nicer name.

最后说语气。避开开发者一眼就读成推诿的被动语态:『该接口将被下线』掩盖了一个事实——是某个团队决定这么做的。要说『我们』。别在你自己不用干的活前面加『小小的』『只需』这类轻描淡写的词。还有,把公告发到用户真正会看的每一个渠道——更新日志、控制台横幅、邮件——因为一次没人看见的废弃,不过是换了个好听名字的故障。