查詢問題分類目錄
查詢問題分類目錄
按第一層分類分頁,傳回各分類及其所有直接子分類,包含已停用的項目。
子分類的 enabled 決定它是否參與新問題的自動比對。停用後,分類目錄仍會傳回該子分類及 enabled: false,歷史問題已命中的分類也會保留。
請求方式
GET
調用地址
https://api-sg.gptbots.ai/v1/question-categories
調用鑑權
使用該 Agent 的 API 金鑰。專案方案須同時支援 API 整合與問題辨識。請選用組織所在資料中心的位址。 API 總覽
調用頻率
與專案其他分析 API 共用每分鐘額度,超額傳回 40008。
請求
請求示例
curl -X GET "https://api-sg.gptbots.ai/v1/question-categories?page=1&page_size=20" \
-H "Authorization: Bearer your_apikey"
curl -X GET "https://api-sg.gptbots.ai/v1/question-categories?page=1&page_size=20" \
-H "Authorization: Bearer your_apikey"
此代碼塊在浮窗中顯示
請求頭
| 欄位 | 類型 | 描述 |
|---|---|---|
| Authorization | string | Bearer your_apikey |
請求參數
| 欄位 | 類型 | 必填 | 描述 |
|---|---|---|---|
| page | int | 否 | 頁碼從 1 起,預設 1。 |
| page_size | int | 否 | 每頁 1~100 筆,預設 20。 |
回應
回應範例
{
"total": 1,
"page": 1,
"page_size": 20,
"items": [
{
"id": "66a1b2c3d4e5f60001000001",
"name": "售後服務",
"level": 1,
"parent_id": null,
"enabled": true,
"children": [
{
"id": "66a1b2c3d4e5f60001000002",
"name": "退款進度",
"level": 2,
"parent_id": "66a1b2c3d4e5f60001000001",
"enabled": true,
"description": "查詢退款何時入帳",
"children": []
}
]
}
]
}
{
"total": 1,
"page": 1,
"page_size": 20,
"items": [
{
"id": "66a1b2c3d4e5f60001000001",
"name": "售後服務",
"level": 1,
"parent_id": null,
"enabled": true,
"children": [
{
"id": "66a1b2c3d4e5f60001000002",
"name": "退款進度",
"level": 2,
"parent_id": "66a1b2c3d4e5f60001000001",
"enabled": true,
"description": "查詢退款何時入帳",
"children": []
}
]
}
]
}
此代碼塊在浮窗中顯示
成功響應
| 欄位 | 類型 | 描述 |
|---|---|---|
| total | long | 第一層分類總數 |
| page | int | 頁碼從 1 起,預設 1。 |
| page_size | int | 每頁 1~100 筆,預設 20。 |
| items | array | 本頁資料 |
| id | string | 分類 ID |
| name | string | 分類名稱 |
| level | int | 層級:第一層為 1,子分類為 2。 |
| parent_id | string / null | 父分類 ID,第一層為 null。 |
| enabled | boolean | 是否啟用 |
| description | string / null | 子分類說明,上限 100 個字元。第一層分類不可傳入。 |
| children | array | 直接子分類,末端節點為空陣列。 |
失敗響應
| 字段 | 類型 | 描述 |
|---|---|---|
| code | int | 錯誤碼。 |
| message | string | 錯誤描述信息。 |
錯誤碼
| Code | Message |
|---|---|
| 40000 | 參數無效 |
| 40008 | 超出分析 API 每分鐘額度 |
| 40100 | 目前的 Agent 無權操作該資源 |
| 40101 | 缺少 Authorization 標頭 |
| 40127 | Agent API 金鑰無效 |
| 20055 | Agent 未啟用 API |
| 40353 | 方案未開通所需功能 |
| 50000 | 服務內部錯誤 |
