Skip to content
检测中

API Design Discussion

日期:2026-06-17 · 场景:API Design Discussion

📖 Vocabulary

WordMeaningExample
endpoint 端点(API 可访问的 URL 地址)Call the user endpoint to fetch the profile.
调用 user 端点获取个人资料。
payload 载荷(请求或响应中携带的数据)Keep the response payload as small as possible.
让响应载荷尽可能小。
authorization 授权(验证是否有权限访问资源)The gateway checks authorization on every call.
网关在每次调用时检查授权。
cookie Cookie(浏览器存储的小段身份数据)Set a signed cookie after the user logs in.
用户登录后写入一个签名 Cookie。
deserialize 反序列化(将文本数据还原为程序对象)The client can deserialize the JSON in under a millisecond.
客户端能在 1 毫秒内反序列化这份 JSON。

🎧 Audio

💬 Dialogue

A: Let's finalize the API design for the new user service. A:把新用户服务的 API 设计定下来吧。

B: Sure. I think we should expose one endpoint for fetching the user profile. B:好,我觉得应该暴露一个端点用来获取用户资料。

A: Agreed. What fields should we include in the response payload? A:同意。响应载荷里该包含哪些字段?

B: Keep it minimal. Just the id, email, and display name to avoid leaking sensitive data. B:保持精简。只放 id、邮箱和显示名,避免泄露敏感数据。

A: Good call. How are we handling authorization on these requests? A:说得好。这些请求的授权怎么处理?

B: We attach a signed cookie after login, and the gateway validates it on every call. B:登录后写入一个签名 Cookie,网关在每次调用时校验它。

A: Nice. And when the client receives the JSON, how fast can it deserialize the body? A:不错。客户端收到 JSON 后,多快能反序列化请求体?

B: It parses in under a millisecond at that size, so performance is fine. B:这个体量不到 1 毫秒就能解析完,性能没问题。

Released under the ISC License.