Files
opsxapi/homepage/content/07-graphql.md
T
Logan.Li 3cb9545121 refactor(homepage): 官网/文档/定价源码迁出程序 + 新增独立授权与激活页 /license
- 官网源码归拢到 homepage/(index/pricing/terms/license + content/ + assets/ + docs-assets/),
  删除程序内 go:embed 的 server/internal/{site,docs},后端仅静态托管 homepage/dist 做本地预览
- 新增独立静态页 /license(授权与激活):交付与激活四步(邮件交付授权码)、
  在线授权码 LIC- 与离线许可证 LICOFF- 对比、授权服务器 licence.rlwj.cn 通信范围说明、
  授权类型与价格、10 条授权 FAQ
- tools/homepage-build 支持可选单页,产出 <name>.html 与 <name>/index.html
- 导航/页脚接入 /license,跨页锚点补 / 前缀,页脚底栏文案同步为静态站口径
2026-10-16 04:16:16 +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 请求。