# 使用API

学习了如何构建API后，接下来我们学习如何测试和使用API。

## API预览

点击右上角"API预览ICON"，打开swagger文档页。

<figure><img src="/files/ADtgWdhV5XGby39ohuJi" alt=""><figcaption><p>预览页</p></figcaption></figure>

左侧为API列表，以文件夹作为分组名，未分组API位于Others分组，此外，还包含FileUpload分组，用于展示OSS对应的路由。

选择对应API，可以查看其Operation，输入入参后，点击“TRY”按钮，可进行测试。响应栏会展示响应状态码和响应结果。

若API需要授权才能访问，需要在右上角选择对应OIDC，进行登录。登录后可查看当前登录用户的基本信息。

此外，若想在POSTMAN等工具测试，点击“下载”按钮，可获取swagger文档。

## REST 对接

上述文档展示了所有的API列表，可手工编写任意客户端的代码，对接接口。

值得注意的是，对于GET请求的对象入参，要用JSON字面量的方式传入，详情参考 [可视化构建](/ji-chu-ke-shi-hua-kai-fa/api-gou-jian/ke-shi-hua-gou-jian.md#lu-you-gui-ze)

## SDK生成

除了上述方式外，也可以使用Fireboom生成对应客户端的SDK，提升API对接速度！

若想在客户端使用API，可点击状态栏“客户端模板”，浏览”模板市场“，选择对应”客户端模板“下载，例如TS SDK、Flutter SDK，并配置生成路径。

前往对应路径查看生成的SDK，然后在项目中引用对应语言的客户端SDK，即可使用。

更多详情，前往[客户端SDK](/shi-yong-bu-shu-shang-xian/sdk-sheng-cheng.md)。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fireboom.io/ji-chu-ke-shi-hua-kai-fa/api-gou-jian/shi-yong-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
