# Danh sách phòng ban

* API này dùng để lấy [danh sách phòng ban](https://nhanh.vn/store/user/department).

## Request

* Xem [common request params](https://apidocs.nhanh.vn/v3/readme#request-params).
* Xem [Postman sample](https://www.postman.com/nhanh-vn/pos-open-nhanh-vn/request/hxpf03p/business-department).

```curl
curl --location 'https://pos.open.nhanh.vn/v3.0/business/department?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json'
--data '{
    "filters": {
        "status": 1
    },
    "paginator": {
        "size": 100,
        "next": ""
    }
}'
```

### Filters

| Key    | Type   | Description                                              |
| ------ | ------ | -------------------------------------------------------- |
| name   | string | Tên phòng ban                                            |
| code   | string | Mã phòng ban                                             |
| status | int    | <p>Trạng thái phòng ban (1 = Active<br>2 = Inactive)</p> |

## Response

* Xem cấu trúc chung [tại đây](https://apidocs.nhanh.vn/v3/readme#response).

### Failed response

* Xem các mã lỗi chung [tại đây](https://apidocs.nhanh.vn/v3/readme#failed-response).

### Successful response

```json
{
  "code": 1,
  "paginator": {
    "next": "Giá trị để lấy dữ liệu trang tiếp theo"
  },
  "data": [
    {
      "id": "(int) ID phòng ban 1",
      "parentId": "(int) ID phòng ban cha",
      "code": "(string) Mã phòng ban",
      "name": "(string) Tên phòng ban",
      "status": "(int) Trạng thái phòng ban",
      "createdAt": "(timestamp) Thời gian tạo phòng ban"
    },
    {
      "id": "(int) ID phòng ban 2",
      "parentId": "(int) ID phòng ban cha",
      "code": "(string) Mã phòng ban",
      "name": "(string) Tên phòng ban",
      "status": "(int) Trạng thái phòng ban",
      "createdAt": "(timestamp) Thời gian tạo phòng ban"
    }
  ]
}
```
