Files
mintlify__docs/zh/api-playground/multiple-responses.mdx
mintlify[bot] fbdd913d8e Add translation audit tracker (#5055)
* Add translation tracker for stale translations audit

Generated-By: mintlify-agent

* translations: add missing pages and update content for es, fr, zh

Phase 1: Add translations for 4 new API analytics pages (feedback-by-page,
searches, views, visitors) in es, fr, and zh.

Phase 2: Update 3 pages with content changes:
- agent/workflows: add "Disable a workflow" subsection
- ai/skillmd: add 24-hour generation note
- editor/publish: add AI PR title tip, reformat publishing workflows,
  promote "Publish your changes" heading from h3 to h2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* update descriptions

* translations

* translations

* translations

* Delete TRANSLATION_TRACKER.md

* translations

* a

* a

* translations

* translations

* translations

* translations

* translations

* translations

* translations

* translations

* Update use-cases.mdx

* translations

* translations

* Update ai-native.mdx

* Update accordions.mdx

* Update accordions.mdx

* Update accordions.mdx

* translations

* translations

* Update fonts.mdx

* translations

* translations: update SEO descriptions for es, fr, zh (150 pages)

Update the description: frontmatter field across 150 pages × 3 languages
to match the current English descriptions updated on 2026-03-31.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 10:52:59 -07:00

57 lines
1.6 KiB
Plaintext

---
title: "多种响应"
description: "为 API 端点记录多种响应变体,包括成功和错误情况,并附带状态码和示例 payload。"
keywords: ["response examples", "conditional responses", "response variations", "examples property"]
---
如果你的 API 会根据输入参数、用户上下文或请求的其他条件返回不同的响应,你可以使用 `examples` 属性来记录多个响应示例。
将此属性添加到任意响应中。它具有以下架构。
```yaml
responses:
"200":
description: 成功响应
content:
application/json:
schema:
$ref: "#/components/schemas/YourResponseSchema"
examples:
us:
summary: 美国的响应
value:
countryCode: "US"
currencyCode: "USD"
taxRate: 0.0825
gb:
summary: 英国的响应
value:
countryCode: "GB"
currencyCode: "GBP"
taxRate: 0.20
```
Playground 还会根据内容类型,以不同方式处理非 JSON 响应。
<div id="audio-response-examples">
## 音频响应示例
</div>
对于返回音频文件的端点,请将响应内容类型设置为 `audio/*`,并提供音频文件的 URL 作为示例值。playground 显示的是交互式音频播放器,而不是代码片段。
```yaml
responses:
"200":
description: Audio file generated successfully
content:
audio/mpeg:
schema:
type: string
format: binary
examples:
sample:
summary: Sample audio output
value: "https://example.com/sample-audio.mp3"
```