Files
opsxapi/server/internal/docs/content/07-graphql.md
T
logan 2bb4ef7a95 桌面 GUI 外链修复 + 主题顺序调整(含结构扁平化进行中的工作区基线)
- 集成 tauri-plugin-opener:Cargo/lib.rs/capabilities/npm 四处接线,新增 src/openExternal.ts(桌面走 opener,浏览器回退 window.open,相对路径绝对化)
- 关于页 4 个链接、活动栏官网菜单、代理错误横幅 2 处健康检查链接全部改走 openExternal,桌面端可正常跳转
- 设置→外观 主题顺序调整为 深色/浅色/跟随系统
- release 二进制重编并验证(浏览器实测关于页链接可开文档页)
- 附带工作区中未提交的扁平化重构现状(另一会话进行中)
- homepage 落地页与文档终检通过(8787 / 与 /docs 双 200)
2026-10-16 03:03:36 +08:00

33 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 编辑查询
GraphQL 请求由三部分组成:
| 部分 | 说明 |
| --- | --- |
| Query | GraphQL 查询语句,支持变量定义 `$code: ID!` |
| Variables | JSON 对象,随查询一起发送;非法 JSON 会红框提示 |
| Headers / Auth | 与 HTTP 请求一致 |
## 发送
点击 **执行**(或 URL 栏按 Enter)。实际发送的是标准 GraphQL over HTTP:
```json
{
"query": "query ($code: ID!) { country(code: $code) { name capital currency } }",
"variables": { "code": "CN" }
}
```
响应面板会自动格式化 `data` / `errors`,字段名高亮。
## 内置示例
示例集合中的「国家查询 · countries」连接公共 GraphQL 服务 <https://countries.trevorblades.com/graphql>,无需鉴权,可直接体验。
## 最佳实践
- 把 endpoint 存为 `{{baseUrl}}/graphql`,环境切换即切换网关。
- 需要鉴权时在 Auth 标签配置 Bearer,不必手写 Header。
- 想看实际报文?点 `</>` 代码 生成 cURL,即为此查询的完整 HTTP 请求。