| 元件 | 說明 | 範例 |
|---|---|---|
| HTTP 方法 | 要執行的動作 | GET, POST, PUT, DELETE |
| 路徑 | 相對於基礎 URL 的 URL 路徑 | /users/{id} |
| 參數 | 路徑、查詢、標頭或主體參數 | id(路徑參數) |
| 請求主體 | 隨請求傳送的資料(用於 POST/PUT) | JSON schema |
| 回應 | 預期的回應格式與狀態碼 | 200 OK, 404 Not Found |
| 方式 | 使用時機 | 步驟 |
|---|---|---|
| 手動建立 | 從零開始 | 1. 右鍵點擊資料夾 →「New Endpoint」 2. 填入方法與路徑 3. 定義參數與回應 |
| Import from Code | 已有 API 程式碼 | 1. 使用「Import」功能 2. 上傳 OpenAPI/Swagger 檔案 3. 對應至模組 |
| From Request | 測試現有 API | 1. 先傳送請求 2. 點擊「Save」 3. 完善規格 |
| 複製現有項目 | 類似的端點 | 1. 右鍵點擊端點 →「Duplicate」 2. 修改路徑與參數 |
GET /users/{userId}/posts/{postId}| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
userId | integer | 是 | 唯一使用者識別碼 |
postId | integer | 是 | 貼文識別碼 |
| 參數 | 類型 | 必填 | 預設值 | 說明 |
|---|---|---|---|---|
limit | integer | 否 | 10 | 要回傳的結果數量 |
offset | integer | 否 | 0 | 要略過的結果數量 |
status | string | 否 | active | 依狀態篩選 |
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "User's full name"
},
"email": {
"type": "string",
"format": "email",
"description": "User's email address"
}
},
"required": ["name", "email"]
}{
"id": 123,
"name": "John Doe",
"email": "john@example.com",
"createdAt": "2023-01-15T10:30:00Z"
}| 狀態碼 | 說明 | Schema |
|---|---|---|
400 | Bad Request | 錯誤詳細資訊 |
401 | Unauthorized | 驗證錯誤 |
404 | Not Found | 找不到資源 |
500 | Internal Server Error | 伺服器錯誤詳細資訊 |