# 自訂欄位主分類

## 所有動態欄位分類

{% tabs %}
{% tab title="API" %}

```javascript
GET https://{API_HOST}/api/v1/cz-col-category
```

{% endtab %}

{% tab title="範例" %}

```javascript
curl -X GET
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/cz-col-category?xxxx
```

{% endtab %}
{% endtabs %}

| type | 類型     |
| ---- | ------ |
| 0    | 客戶自訂欄位 |
| 1    | 客戶自訂表格 |
| 2    | 工單自訂欄位 |
| 3    | 工單自訂表格 |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                                                                        |
| -------- | ---------------- | ------------------------------------------------------------------------------------------------------------------ |
| data     | Array of objects | [自訂欄位分類陣列](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#dong-tai-lan-wei-fen-lei-czcolcategory) |
| meta     | Object           | 頁籤資料                                                                                                               |

```javascript
{
    "data": [
        {
            "id": 1,
            "name": "SF",
            "type": 0,
            "description": null,
            "cols": [
                {
                    "id": 1,
                    "name": "唯一碼",
                    "description": null,
                    "is_allowed_null": true,
                    "default": null,
                    "type": 1,
                    "options": null,
                    "category_id": 1,
                    "creater_id": null
                },
                {
                    "id": 2,
                    "name": "TESTCLICK__C",
                    "description": null,
                    "is_allowed_null": true,
                    "default": null,
                    "type": 2,
                    "options": null,
                    "category_id": 1,
                    "creater_id": null
                }
            ],
            "creater_id": null,
            "creater": null
        },
        {
            "id": 2,
            "name": "其他",
            "type": 0,
            "description": null,
            "cols": [
                {
                    "id": 3,
                    "name": "勿擾",
                    "description": null,
                    "is_allowed_null": true,
                    "default": null,
                    "type": 2,
                    "options": null,
                    "category_id": 2,
                    "creater_id": null
                },
                {
                    "id": 4,
                    "name": "最後活動日期",
                    "description": null,
                    "is_allowed_null": true,
                    "default": null,
                    "type": 1,
                    "options": null,
                    "category_id": 2,
                    "creater_id": null
                }
            ],
            "creater_id": null,
            "creater": null
        }
    ],
    "links": {
        "first": "https://firstline.localhost/api/cz-col-category?page=1",
        "last": "https://firstline.localhost/api/cz-col-category?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://firstline.localhost/api/cz-col-category",
        "per_page": 15,
        "to": 2,
        "total": 2
    }
}
```

## 此客戶/工單所擁有自訂欄位

```javascript
POST https://{API_DOMAIN}/api/v1/contact/{contact}/cz-col
```

根據下方的 **Query Parameters** 表單的參數進行過濾篩選。

```javascript
curl -X GET
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/contact/1/cz-col
```

### Query Parameters

| PARAMETER | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                                                                              |
| --------- | -------- | ------- | ------ | ---------------------------------------------------------------------------------------- |
| contact   | true     | NULL    | Number | [客戶](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-contact) 的 id |

### Response

請參考[動態欄位](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#dong-tai-lan-wei-czcol)回應格式。

```javascript
{
    "data": [
        {
            "id": 1,
            "name": "Cyril223",
            "default": null,
            "description": "Assumenda est corrupti voluptas aut. Beatae quisquam ex asperiores sit ullam.",
            "is_allowed_null": true,
            "type": 4,
            "created_at": "2019-04-10 04:09:27",
            "updated_at": "2019-04-10 04:09:27",
            "category_id": null,
            "creater_id": null,
            "pivot": {
                "contact_id": 1,
                "cz_col_id": 1,
                "value": null
            }
        },
        {
            "id": 2,
            "name": "Geovany63",
            "default": null,
            "description": "Dolorum rerum ut est quam unde recusandae consequatur. Nobis laudantium eum et voluptatem sunt sint. Et occaecati voluptas ut aliquid cum sed.",
            "is_allowed_null": true,
            "type": 1,
            "created_at": "2019-04-10 04:09:27",
            "updated_at": "2019-04-10 04:09:27",
            "category_id": null,
            "creater_id": null,
            "pivot": {
                "contact_id": 1,
                "cz_col_id": 2,
                "value": "5"
            }
        }
    ]
}
```


---

# 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://help.firstline.cc/developer/api/custom-field-category.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.
