> For the complete documentation index, see [llms.txt](https://en.help.firstline.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.help.firstline.cc/developer/api/custom-table.md).

# Custom forms

## List custom forms for the specified contact

```javascript
GET https://{API_HOST}/api/v1/contact/{contact}/contact-cz-relation
```

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

### Parameters

<table data-header-hidden><thead><tr><th>PARAMETER</th><th width="111.51953125">REQUIRED</th><th width="110.4296875">DEFAULT</th><th width="120.15625">TYPE</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td>Parameter</td><td>Required</td><td>Default</td><td>Type</td><td>DESCRIPTION</td></tr><tr><td><strong>contact</strong></td><td>true</td><td></td><td>Number</td><td><a href="https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-contact">Customer</a> ID of</td></tr><tr><td><strong>cz_col_category_id</strong></td><td>false</td><td></td><td>Number</td><td>ID of the custom field category</td></tr><tr><td><strong>relation_search_cz_col_id</strong></td><td>false</td><td></td><td>Number</td><td>Used to specify the single custom form field ID to search for.</td></tr><tr><td><strong>relation_search_cz_col_op</strong></td><td>false</td><td></td><td>String</td><td>Input <code>like</code> Indicates performing a fuzzy match search.</td></tr><tr><td><strong>relation_search_cz_col_value</strong></td><td>false</td><td></td><td>String</td><td>Specify the field content value to search for, matched according to <strong><code>relation_search_cz_col_id</code></strong> the corresponding field.</td></tr></tbody></table>

&#x20;***Please refer to*** [***Customer custom related forms***](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-dong-tai-guan-lian-biao-ge-contactczrelation) ***Response format***

```javascript

{
    "data": [
        {
            "id": 1,
            "relation_id": 1, // CzColCategory (custom field category) id
            "relation_name": "Health Check",
            "information": [
                {
                    "id": 1,
                    "value": 70,
                    "col_id": 1,
                    "col_name": "Weight"
                },
                {
                    "id": 2,
                    "value": "A",
                    "col_id": 2,
                    "col_name": "Blood Type"
                },
                {
                    "id": 3,
                    "value": [0,1],
                    "col_id": 3,
                    "col_name": "Check Items"
                }
            ],
            "created_at": "2019-11-24 22:58:21",
            "updated_at": "2019-11-24 22:58:21"
        }
    ],
    "links": {
        "first": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "last": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://firstline.localhost/api/contact/2197607/contact-cz-relation",
        "per_page": 15,
        "to": 1,
        "total": 1
    }
}
```

## Add a custom form record for the specified contact&#x20;

```javascript
POST https://{API_HOST}/api/v1/contact/{contact}/cz-col-category/{cz_col_category}/contact-cz-relation
```

### URL Parameters

| PARAMETER             | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                                                                                                                            |
| --------------------- | -------- | ------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| **contact**           | true     | NULL    | Number | [Customer](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-contact) id of                                        |
| **cz\_col\_category** | true     | NULL    | Number | [Dynamic field category](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#dong-tai-lan-wei-fen-lei-czcolcategory) id of |

### Form Data

| PARAMETER    | REQUIRED | DEFAULT | TYPE             | DESCRIPTION                                                         |
| ------------ | -------- | ------- | ---------------- | ------------------------------------------------------------------- |
| **cz\_cols** | false    | NULL    | Array or Objects | Dynamic fields, parameter type reference **CzCol** Form description |

**Cz\_Col**

This field is an array containing the following format

| PARAMETER | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                |
| --------- | -------- | ------- | ------ | -------------------------- |
| **id**    | true     | NULL    | Number | ID of the dynamic field    |
| **value** | true     | NULL    | String | Value of the dynamic field |

### Response

Please refer to [Customer custom form](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-dong-tai-guan-lian-biao-ge-contactczrelation) and [Customer custom form content](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-dong-tai-guan-lian-biao-ge-nei-rong-contactczrelationinformation) Response format

```javascript

{
    "data": [
        {
            "id": 2,
            "relation_id": 1, // CzColCategory (dynamic relation category) id
            "relation_name": "Health Check",
            "information": [
                {
                    "id": 4,
                    "value": 65,
                    "col_id": 1,
                    "col_name": "Weight"
                },
                {
                    "id": 5,
                    "value": "A",
                    "col_id": 2,
                    "col_name": "Blood Type"
                },
                {
                    "id": 6,
                    "value": [1,2],
                    "col_id": 3,
                    "col_name": "Check Items"
                }
            ],
            "created_at": "2019-11-25 22:58:21",
            "updated_at": "2019-11-25 22:58:21"
        }
    ],
    "links": {
        "first": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "last": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://firstline.localhost/api/contact/2197607/contact-cz-relation",
        "per_page": 15,
        "to": 2,
        "total": 2
    }
}
```

### **Example**

* id=1, type=1 (string), name='Weight'
* id=2, type=6 (single choice), name='Blood Type', options=\[{"text": "Type A", "value":"A"},{"text": "Type B", "value":"B"},{"text": "Type O", "value":"O"},{"text": "Type AB", "value":"AB"}]
* id=3, type=7 (multiple choice), name='Check Items', options=\[{"text": "X-ray", "value": 0}, {"text": "Blood Test", "value": 1}, {"text": "Measure Height", "value": 2}]

Example parameters are as follows: (Note that whether it is**single choice**or**multiple choice**, you always send the value; sending text incorrectly will cause frontend display issues)

```javascript
{
    "cz_cols": [
        {
            "id":1,
            "value":65
        },
        {
            "id":2,
            "value":"A"
        },
        {
            "id":3,
            "value":[1,2]
        }
    ]
}
```

> Form Data cz\_cols

```javascript
[
    {"id":1, "value":"65"}, // 1: Weight
    {"id":2, "value":"A"}, // 2: Blood Type
    {"id":3, "value": [1, 2]} // 3. Check Items: Blood Test + Measure Height
]
```

## Update a custom form record for the specified contact

```javascript
PUT https://{API_HOST}/api/v1/contact/{contact}/contact-cz-relation/{contact_cz_relation}
```

### URL Parameters

| PARAMETER                 | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                                                                                                                                               |
| ------------------------- | -------- | ------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **contact**               | true     | NULL    | Number | [Customer](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-contact) id of                                                           |
| **contact\_cz\_relation** | true     | NULL    | Number | [Customer dynamic related form](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-dong-tai-guan-lian-biao-ge-contactczrelation) id of |

### Form Data

| PARAMETER    | REQUIRED | DEFAULT | TYPE  | DESCRIPTION                                                         |
| ------------ | -------- | ------- | ----- | ------------------------------------------------------------------- |
| **cz\_cols** | false    | NULL    | Array | Dynamic fields, parameter type reference **CzCol** Form description |

#### **Cz\_Col**

This field is an array containing the following format

| PARAMETER | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                |
| --------- | -------- | ------- | ------ | -------------------------- |
| **id**    | true     | NULL    | Number | ID of the dynamic field    |
| **value** | true     | NULL    | String | Value of the dynamic field |

### Response

Please refer to [Customer dynamic related form](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-dong-tai-guan-lian-biao-ge-contactczrelation) Response format

```javascript

{
    "data": {
        "id": 1,
        "relation_id": 1, // CzColCategory id
        "relation_name": "Baby Information",
        "information": [
            {
                "id": 4,
                "value": 55,
                "col_id": 1,
                "col_name": "Weight"
            },
            {
                "id": 5,
                "value": "A",
                "col_id": 2,
                "col_name": "Blood Type"
            },
            {
                "id": 6,
                "value": [1,2],
                "col_id": 3,
                "col_name": "Check Items"
            }
        ]
    }
}
```

### **Example**

* id=1, type=1 (string), name='Weight'
* id=2, type=6 (single choice), name='Blood Type', options=\[{"text": "Type A", "value":"A"},{"text": "Type B", "value":"B"},{"text": "Type O", "value":"O"},{"text": "Type AB", "value":"AB"}]
* id=3, type=7 (multiple choice), name='Exercise', options=\[{"text": "Basketball", "value": 0}, {"text": "Running", "value": 1}, {"text": "Swimming", "value": 2}]

Example parameters are as follows: (Note that whether it is**single choice**or**multiple choice**, you always send the value; sending text incorrectly will cause frontend display issues)

```javascript

{
    "cz_cols": [
        {
            "id": 1, // ID of the weight field
            "value": 55
        }
    ]
}
```

> Form Data cz\_cols

```javascript
[
    {"id":1, "value":"70"}, // 1: Weight
    {"id":2, "value":"AB"}, // 2: Blood Type
    {"id":3, "value": [1, 2]} // 3. Exercise: Running + Swimming
]
```

## Delete a custom form record for the specified contact

```javascript
DELETE https://{API_HOST}/api/v1/contact/{contact}/contact-cz-relation/{contact_cz_relation}
```

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

### URL Parameters

| PARAMETER                 | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                                                                                                                                               |
| ------------------------- | -------- | ------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **contact**               | true     | NULL    | Number | [Customer](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-contact) id of                                                           |
| **contact\_cz\_relation** | true     | NULL    | Number | [Customer dynamic related form](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-dong-tai-guan-lian-biao-ge-contactczrelation) id of |

> Responds with 204 http status

## Delete custom form records of a specified category for the specified contact

```javascript
DELETE https://{API_HOST}/api/v1/contact/{contact}/cz-col-category/{cz_col_category}
```

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

### URL Parameters

| PARAMETER             | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                                                                                              |
| --------------------- | -------- | ------- | ------ | -------------------------------------------------------------------------------------------------------- |
| **contact**           | true     | NULL    | Number | [Customer](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#ke-hu-contact) id of          |
| **cz\_col\_category** | true     | NULL    | Number | [Dynamic field category](/developer/api/response-object.md#dong-tai-lan-wei-fen-lei-czcolcategory) id of |

> Responds with 204 http status
