---
# System prepended metadata

title: API Details - FAQ
tags: [API Details]

---

# API Details - FAQ
###### tags: `API Details`

## 取得所有常見問題

### query 參數：
- `_page` 頁數，預設為 1
- `_limit` 查詢筆數，預設為 10
- `_sort` 依...排序，預設為 'id'，另可輸入 'categoryId'
- `_order` 正序/反序，預設為 'DESC'，另可輸入 'ASC'
- `categoryId` 取得該分類的問題

### Response Example
```json
{
    "ok": 1,
    "data": [
      {
        "id": 1,
        "question": "question title",
        "categoryId": 2",
        "answer": "answer content",
        "FaqCategory": {
            "name": "category2"
        }
      },
      {
        "id": 2,
        "question": "question title",
        "categoryId": 1",
        "answer": "answer content",
        "FaqCategory": {
            "name": "category1"
        }
      }
    ]
}
```

## 取得單一常見問題

### Response Example
```json
{
    "ok": 1,
    "data": {
        "id": 1,
        "question": "question title",
        "categoryId": 2,
        "answer": "answer content",
        "FaqCategory": {
            "name": "category2"
        }
    }
}
```

## 新增常見問題

### Request Example

```json
{
    "question": "question title",
    "categoryId": 3,
    "answer": "answer content",
}
```

### Response Example
```json
{
    "ok": 1,
    "message": "Success"
}
```

## 編輯常見問題

### Request Example

```json
{
    "question": "question title",
    "categoryId": 3,
    "answer": "answer content",
}
```

### Response Example

```json
{
    "ok": 1,
    "message": "Success"
}
```

## 刪除常見問題

### Response Example
```json
{
    "ok": 1,
    "message": "Success"
}
```

