> 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/gong-chan.md).

# Ticket

## General data

This section contains ticket-related corresponding data, such as codes for "status", "priority", etc.

### statuses

| Name           | value |
| -------------- | ----- |
| **Pending**    | 0     |
| **processing** | 1     |
| **Resolved**   | 2     |
| **Closed**     | 3     |

### priority

| Name       | value |
| ---------- | ----- |
| **low**    | 0     |
| **medium** | 1     |
| **high**   | 2     |
| **urgent** | 3     |

## Search tickets

Search tickets based on various conditions; see the table below for details

In addition to the ticket's own information, it also includes related customer, category, subcategory, contact records, handlers, sponsors, and other information.

```javascript
GET https://{API_DOMAIN}/api/v1/ticket
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/ticket?per_page=15&page=1"
```

### Query Parameters

| PARAMETER                  | REQUIRED | DEFAULT | TYPE     | DESCRIPTION                                                      |
| -------------------------- | -------- | ------- | -------- | ---------------------------------------------------------------- |
| **page**                   | false    | 1       | Number   | Which page is currently on                                       |
| **per\_page**              | false    | 15      | Number   | How many items to display per page                               |
| **search**                 | false    | NULL    | String   | Fuzzy search ticket title and content                            |
| **contact\_id**            | false    | NULL    | Number   | customer id                                                      |
| **statuses**               | false    | NULL    | Array    | ticket status < 0: pending 1: processing 2: resolved 3: closed > |
| **due\_at\_\_start**       | false    | NULL    | Datetime | due date/time (start)                                            |
| **due\_at\_\_end**         | false    | NULL    | Datetime | due date/time (end)                                              |
| **created\_at\_\_start**   | false    | NULL    | Datetime | created\_at\_\_start                                             |
| **created\_at\_\_end**     | false    | NULL    | Datetime | created date/time (end)                                          |
| **sponsor\_id**            | false    | NULL    | Number   | sponsor id                                                       |
| **termination\_code\_ids** | false    | NULL    | Array    | array of termination code ids                                    |
| **handler\_ids**           | false    | NULL    | Array    | array of ids of employees handling the ticket                    |
| **creater\_ids**           | false    | NULL    | Array    | array of ids of employees who created the ticket                 |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                        |
| -------- | ---------------- | ------------------------------------------------------------------ |
| **data** | Array of objects | [ticket array](/developer/api/response-object.md#gong-chan-ticket) |
| **meta** | Object           | Pagination meta                                                    |

```javascript
{
    "data": [
        {
            "id": 67,
            "subject": "Cannot make calls",
            "content": "Cannot make calls\n#Processing completed",
            "due_at": null,
            "status": 0,
            "status_memo": null,
            "priority": 0,
            "contact": null,
            "contact_id": null,
            "sub_category": {
                "id": 26,
                "name": "Suggestion",
                "description": null,
                "category": {
                    "id": 1,
                    "name": "Phone function",
                    "description": null
                },
                "category_id": 1
            },
            "sub_category_id": 26,
            "creater": {
                "id": 7,
                "name": "Tommy Hsu",
                "first_name": "Tommy",
                "last_name": "Hsu",
                "employee_no": "tommy",
                "photo_url": "/employee/7/photo",
                "identity_no": null,
                "job_title_id": -1,
                "department_id": -1,
                "extension_id": 8,
                "extension": {
                    "id": 8,
                    "type": 3,
                    "extension": "8005",
                    "description": null,
                    "media_cluster_id": null
                },
                "group_id": 2,
                "group": {
                    "id": 2,
                    "name": "Test Group B",
                    "description": null,
                    "supervisor_id": 1
                },
                "cti_agent_account": "ag8005",
                "cti_agent": {
                    "id": 5,
                    "account": "ag8005",
                    "group_id": null
                },
                "created_at": "2019-04-12 12:51:34",
                "updated_at": "2019-04-15 15:25:46"
            },
            "handler_id": 7,
            "handler": {
                "id": 7,
                "name": "Tommy Hsu",
                "first_name": "Tommy",
                "last_name": "Hsu",
                "employee_no": "tommy",
                "photo_url": "/employee/7/photo",
                "identity_no": null,
                "job_title_id": -1,
                "department_id": -1,
                "extension_id": 8,
                "extension": {
                    "id": 8,
                    "type": 3,
                    "extension": "8005",
                    "description": null,
                    "media_cluster_id": null
                },
                "group_id": 2,
                "group": {
                    "id": 2,
                    "name": "Test Group B",
                    "description": null,
                    "supervisor_id": 1
                },
                "cti_agent_account": "ag8005",
                "cti_agent": {
                    "id": 5,
                    "account": "ag8005",
                    "group_id": null
                },
                "created_at": "2019-04-12 12:51:34",
                "updated_at": "2019-04-15 15:25:46"
            },
            "interact_collections": [
                {
                    "id": 149,
                    "is_acw_completed": true,
                    "first_enter_queue_at": "2019-04-18 16:51:57",
                    "acw_at": "2019-04-18 16:54:57",
                    "last_finished_at": "2019-04-18 16:52:10",
                    "handler_id": 7,
                    "handler": {
                        "id": 7,
                        "name": "Tommy Hsu",
                        "first_name": "Tommy",
                        "last_name": "Hsu",
                        "employee_no": "tommy",
                        "photo_url": "/employee/7/photo",
                        "identity_no": null,
                        "job_title_id": -1,
                        "department_id": -1,
                        "extension_id": 8,
                        "extension": {
                            "id": 8,
                            "type": 3,
                            "extension": "8005",
                            "description": null,
                            "media_cluster_id": null
                        },
                        "group_id": 2,
                        "group": {
                            "id": 2,
                            "name": "Test Group B",
                            "description": null,
                            "supervisor_id": 1
                        },
                        "cti_agent_account": "ag8005",
                        "cti_agent": {
                            "id": 5,
                            "account": "ag8005",
                            "group_id": null
                        },
                        "created_at": "2019-04-12 12:51:34",
                        "updated_at": "2019-04-15 15:25:46"
                    },
                    "contact_id": null,
                    "memo": null,
                    "bound_type": 1,
                    "sponsor_id": 1,
                    "campaign_queue_id": null,
                    "result_id": 2
                }
            ],
            "sponsor_id": 1,
            "sponsor": {
                "id": 1,
                "name": "default",
                "description": null,
                "is_immortal": true,
                "mail_channels": []
            },
            "campaign_queue": null,
            "campaign_queue_id": null,
            "created_at": "2019-04-16 14:45:12",
            "updated_at": "2019-04-18 16:54:16",
            "termination_code_id": null,
            "termination_code": null,
            "category": {
                "id": 1,
                "name": "Phone function",
                "description": null
            },
            "category_id": 1
        },
        {
            "id": 66,
            "subject": "Ticket for TEST",
            "content": "Content content content content content content content content111111",
            "due_at": null,
            "status": 2,
            "status_memo": null,
            "priority": 0,
            "contact": {
                "id": 2,
                "name": "Xiao Hong",
                "first_name": "Xiao",
                "last_name": "Hong",
                "membership_no": null,
                "identity_no": "A123456789",
                "gender": 0,
                "birth_at": "1987-10-10",
                "profile_id": 3,
                "sponsor_id": 1,
                "disturb_setting": null
            },
            "contact_id": 2,
            "sub_category": {
                "id": 23,
                "name": "Timeliness",
                "description": null,
                "category": {
                    "id": 2,
                    "name": "Claim related",
                    "description": null
                },
                "category_id": 2
            },
            "sub_category_id": 23,
            "creater": {
                "id": 6,
                "name": "Karick Tung",
                "first_name": "Karick",
                "last_name": "Tung",
                "employee_no": "karick",
                "photo_url": null,
                "identity_no": null,
                "job_title_id": -1,
                "department_id": -1,
                "extension_id": 5,
                "extension": {
                    "id": 5,
                    "type": 3,
                    "extension": "8004",
                    "description": "Jingjing",
                    "media_cluster_id": null
                },
                "group_id": 2,
                "group": {
                    "id": 2,
                    "name": "Test Group B",
                    "description": null,
                    "supervisor_id": 1
                },
                "cti_agent_account": "ag8004",
                "cti_agent": {
                    "id": 4,
                    "account": "ag8004",
                    "group_id": null
                },
                "created_at": "2019-03-08 22:51:25",
                "updated_at": "2019-04-17 13:31:00"
            },
            "handler_id": null,
            "handler": null,
            "interact_collections": [
                {
                    "id": 108,
                    "is_acw_completed": true,
                    "first_enter_queue_at": "2019-04-16 14:18:24",
                    "acw_at": "2019-04-16 14:23:06",
                    "last_finished_at": "2019-04-16 14:18:49",
                    "handler_id": 6,
                    "handler": {
                        "id": 6,
                        "name": "Karick Tung",
                        "first_name": "Karick",
                        "last_name": "Tung",
                        "employee_no": "karick",
                        "photo_url": null,
                        "identity_no": null,
                        "job_title_id": -1,
                        "department_id": -1,
                        "extension_id": 5,
                        "extension": {
                            "id": 5,
                            "type": 3,
                            "extension": "8004",
                            "description": "Jingjing",
                            "media_cluster_id": null
                        },
                        "group_id": 2,
                        "group": {
                            "id": 2,
                            "name": "Test Group B",
                            "description": null,
                            "supervisor_id": 1
                        },
                        "cti_agent_account": "ag8004",
                        "cti_agent": {
                            "id": 4,
                            "account": "ag8004",
                            "group_id": null
                        },
                        "created_at": "2019-03-08 22:51:25",
                        "updated_at": "2019-04-17 13:31:00"
                    },
                    "contact_id": 2,
                    "memo": null,
                    "bound_type": 1,
                    "sponsor_id": 1,
                    "campaign_queue_id": null,
                    "result_id": 2
                },
                {
                    "id": 121,
                    "is_acw_completed": true,
                    "first_enter_queue_at": "2019-04-16 15:36:59",
                    "acw_at": "2019-04-16 15:54:48",
                    "last_finished_at": "2019-04-16 15:54:48",
                    "handler_id": 2,
                    "handler": {
                        "id": 2,
                        "name": "eason d",
                        "first_name": "eason",
                        "last_name": "d",
                        "employee_no": "eason",
                        "photo_url": "/employee/2/photo",
                        "identity_no": null,
                        "job_title_id": -1,
                        "department_id": -1,
                        "extension_id": 2,
                        "extension": {
                            "id": 2,
                            "type": 3,
                            "extension": "8002",
                            "description": null,
                            "media_cluster_id": null
                        },
                        "group_id": 2,
                        "group": {
                            "id": 2,
                            "name": "Test Group B",
                            "description": null,
                            "supervisor_id": 1
                        },
                        "cti_agent_account": "ag8002",
                        "cti_agent": {
                            "id": 2,
                            "account": "ag8002",
                            "group_id": null
                        },
                        "created_at": "2018-11-09 13:21:17",
                        "updated_at": "2019-04-15 15:10:10"
                    },
                    "contact_id": 2,
                    "memo": "This time I don't know what to do",
                    "bound_type": 1,
                    "sponsor_id": 1,
                    "campaign_queue_id": null,
                    "result_id": 2
                }
            ],
            "sponsor_id": 1,
            "sponsor": {
                "id": 1,
                "name": "default",
                "description": null,
                "is_immortal": true,
                "mail_channels": []
            },
            "campaign_queue": null,
            "campaign_queue_id": null,
            "created_at": "2019-04-16 14:22:13",
            "updated_at": "2019-04-17 12:39:53",
            "termination_code_id": 5,
            "termination_code": {
                "id": 5,
                "name": "Confirm whether it can be handled",
                "description": null,
                "status": 0,
                "creater_id": 1
            },
            "category": {
                "id": 2,
                "name": "Claim related",
                "description": null
            },
            "category_id": 2
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 8,
        "per_page": "2",
        "to": 2,
        "total": 16
    }
}
```

## Get ticket

## Create ticket

```javascript
POST https://{API_DOMAIN}/api/v1/ticket
```

```javascript
curl -X POST
    '{"subject":"Title","content":"Content","status":2,"contact_id":1,"sub_category_id":1,"termination_code":5}'
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/ticket"
```

### Form Data

| PARAMETER                 | REQUIRED | DEFAULT    | TYPE     | DESCRIPTION              |
| ------------------------- | -------- | ---------- | -------- | ------------------------ |
| **sponsor\_id**           | false    | NULL       | Number   | sponsor id               |
| **handler\_id**           | false    | NULL       | Number   | handler employee id      |
| **termination\_code\_id** | false    | NULL       | Number   | termination code id      |
| **subject**               | true     | NULL       | String   | ticket title             |
| **content**               | true     | NULL       | String   | ticket content           |
| **due\_at**               | false    | NULL       | Datetime | ticket due time          |
| **priority**              | false    | 0(lowest)  | Number   | ticket priority level    |
| **status**                | false    | 0(pending) | Number   | ticket processing status |
| **status\_memo**          | false    | NULL       | String   | ticket status note       |
| **sub\_category\_id**     | false    | NULL       | Number   | subcategory              |
| **contact\_id**           | false    | NULL       | Number   | customer id              |

### Response

Please refer to [Ticket](/developer/api/response-object.md#gong-chan-ticket) Response format

| PROPERTY | TYPE   | DESCRIPTION                                                  |
| -------- | ------ | ------------------------------------------------------------ |
| **data** | Object | [Ticket](/developer/api/response-object.md#gong-chan-ticket) |

```javascript
{
    "data" : {
        "id": 1,
        "subject": "Title",
        "content": "Content",
        "due_at": null,
        "status": 2,
        "status_memo": null,
        "priority": 0,
        "contact": {
            "id": 1,
            "name": "Aquil",
            "first_name": "A",
            "last_name": "quil",
            "membership_no": null,
            "identity_no": "A123456789",
            "gender": 0,
            "birth_at": "1987-10-10",
            "profile_id": 3,
            "sponsor_id": 1,
            "disturb_setting": null
        },
        "contact_id": 1,
        "sub_category": {
            "id": 1,
            "name": "Timeliness",
            "description": null,
            "category": {
                "id": 1,
                "name": "Claim related",
                "description": null
            },
            "category_id": 1
        },
        "sub_category_id": 1,
        "handler_id": null,
        "handler": null,
        "sponsor_id": null,
        "sponsor": null,
        "campaign_queue": null,
        "campaign_queue_id": null,
        "created_at": "2019-04-16 14:22:13",
        "updated_at": "2019-04-17 12:39:53",
        "termination_code_id": 5,
        "termination_code": {
            "id": 5,
            "name": "Confirm whether it can be handled",
            "description": null,
            "status": 0,
            "creater_id": null
        },
        "category": {
            "id": 1,
            "name": "Claim related",
            "description": null
        },
        "category_id": 1
    }
}
```

## View ticket

```javascript
GET https://{API_DOMAIN}/api/v1/ticket/{id}
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/ticket/1"
```

### URL Parameters

| PARAMETER | DESCRIPTION |
| --------- | ----------- |
| **id**    | ticket id   |

### Response

Please refer to [Ticket](/developer/api/response-object.md#gong-chan-ticket) Response format

```javascript

{
    "id": 1,
    "subject": "Title",
    "content": "Content",
    "due_at": null,
    "status": 2,
    "status_memo": null,
    "priority": 0,
    "contact": {
        "id": 1,
        "name": "Aquil",
        "first_name": "A",
        "last_name": "quil",
        "membership_no": null,
        "identity_no": "A123456789",
        "gender": 0,
        "birth_at": "1987-10-10",
        "profile_id": 3,
        "sponsor_id": 1,
        "disturb_setting": null
    },
    "contact_id": 1,
    "sub_category": {
        "id": 1,
        "name": "Timeliness",
        "description": null,
        "category": {
            "id": 1,
            "name": "Claim related",
            "description": null
        },
        "category_id": 1
    },
    "sub_category_id": 1,
    "handler_id": null,
    "handler": null,
    "sponsor_id": null,
    "sponsor": null,
    "campaign_queue": null,
    "campaign_queue_id": null,
    "created_at": "2019-04-16 14:22:13",
    "updated_at": "2019-04-17 12:39:53",
    "termination_code_id": 5,
    "termination_code": {
        "id": 5,
        "name": "Confirm whether it can be handled",
        "description": null,
        "status": 0,
        "creater_id": null
    },
    "category": {
        "id": 1,
        "name": "Claim related",
        "description": null
    },
    "category_id": 1
}
```

## Update ticket

```javascript
PUT https://{API_DOMAIN}/api/v1/ticket/{id}
```

```javascript
curl -X PUT
    -H "Content-Type: application/json"
    '{"subject":"Updated title"}'
    "https://{API_HOST}/api/v1/ticket/1"
```

### URL Parameters

| PARAMETER | DESCRIPTION |
| --------- | ----------- |
| **id**    | ticket id   |

### Form Data

| PARAMETER                 | REQUIRED | DEFAULT    | TYPE     | DESCRIPTION              |
| ------------------------- | -------- | ---------- | -------- | ------------------------ |
| **sponsor\_id**           | false    | NULL       | Number   | sponsor id               |
| **handler\_id**           | false    | NULL       | Number   | handler employee id      |
| **termination\_code\_id** | false    | NULL       | Number   | termination code id      |
| **subject**               | false    | NULL       | String   | ticket title             |
| **content**               | false    | NULL       | String   | ticket content           |
| **due\_at**               | false    | NULL       | Datetime | ticket due time          |
| **priority**              | false    | 0(lowest)  | Number   | ticket priority level    |
| **status**                | false    | 0(pending) | Number   | ticket processing status |
| **status\_memo**          | false    | NULL       | String   | ticket status note       |
| **sub\_category\_id**     | false    | NULL       | Number   | subcategory              |
| **contact\_id**           | false    | NULL       | Number   | customer id              |

### Response

Please refer to [Ticket](/developer/api/response-object.md#gong-chan-ticket) Response format

```javascript

{
    "id": 1,
    "subject": "Updated title",
    "content": "Content",
    "due_at": null,
    "status": 2,
    "status_memo": null,
    "priority": 0,
    "contact": {
        "id": 1,
        "name": "Aquil",
        "first_name": "A",
        "last_name": "quil",
        "membership_no": null,
        "identity_no": "A123456789",
        "gender": 0,
        "birth_at": "1987-10-10",
        "profile_id": 3,
        "sponsor_id": 1,
        "disturb_setting": null
    },
    "contact_id": 1,
    "sub_category": {
        "id": 1,
        "name": "Timeliness",
        "description": null,
        "category": {
            "id": 1,
            "name": "Claim related",
            "description": null
        },
        "category_id": 1
    },
    "sub_category_id": 1,
    "handler_id": null,
    "handler": null,
    "sponsor_id": null,
    "sponsor": null,
    "campaign_queue": null,
    "campaign_queue_id": null,
    "created_at": "2019-04-16 14:22:13",
    "updated_at": "2019-04-17 12:39:53",
    "termination_code_id": 5,
    "termination_code": {
        "id": 5,
        "name": "Confirm whether it can be handled",
        "description": null,
        "status": 0,
        "creater_id": null
    },
    "category": {
        "id": 1,
        "name": "Claim related",
        "description": null
    },
    "category_id": 1
}
```

## Delete ticket

Http status is 204

```javascript
DELETE https://{API_DOMAIN}/api/v1/ticket/{id}
```

### URL Parameters

| PARAMETER | DESCRIPTION |
| --------- | ----------- |
| **id**    | ticket id   |

## Search employees

```javascript
GET https://{API_DOMAIN}/api/v1/employee
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/employee"
```

### Query Parameters

| PARAMETER     | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                                          |
| ------------- | -------- | ------- | ------ | ---------------------------------------------------- |
| **page**      | false    | 1       | Number | Which page is currently on                           |
| **per\_page** | false    | 15      | Number | How many items to display per page                   |
| **search**    | false    | NULL    | String | Fuzzy search employee name, ID card, employee number |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                            |
| -------- | ---------------- | ---------------------------------------------------------------------- |
| **data** | Array of objects | [employee array](/developer/api/response-object.md#yuan-gong-employee) |
| **meta** | Object           | Pagination meta                                                        |

```javascript
{
    "data": [
        {
            "id": 17,
            "name": "AG 8018",
            "first_name": "AG",
            "last_name": "8018",
            "employee_no": "ag8018",
            "photo_url": null,
            "identity_no": null,
            "job_title_id": 21,
            "job_title": {
                "id": 21,
                "abbrev": null,
                "name": "Sales Specialist",
                "description": null
            },
            "department_id": -1,
            "department": null,
            "extension_id": -1,
            "extension": null,
            "profile": {
                "id": 29,
                "phones": []
            },
            "is_active": true,
            "role": "",
            "email": null,
            "group_id": 3,
            "group": {
                "id": 3,
                "name": "SUN1",
                "description": null,
                "supervisor_id": 9
            },
            "is_immortal": false,
            "cti_agent_account": null,
            "cti_agent": null,
            "created_at": "2019-04-18 06:13:43",
            "updated_at": "2019-04-18 06:16:51"
        },
        {
            "id": 16,
            "name": "AG 8017",
            "first_name": "AG",
            "last_name": "8017",
            "employee_no": "ag8017",
            "photo_url": null,
            "identity_no": null,
            "job_title_id": 21,
            "job_title": {
                "id": 21,
                "abbrev": null,
                "name": "Sales Specialist",
                "description": null
            },
            "department_id": -1,
            "department": null,
            "extension_id": -1,
            "extension": null,
            "profile": {
                "id": 30,
                "phones": []
            },
            "is_active": true,
            "role": "",
            "email": null,
            "group_id": 3,
            "group": {
                "id": 3,
                "name": "SUN1",
                "description": null,
                "supervisor_id": 9
            },
            "is_immortal": false,
            "cti_agent_account": null,
            "cti_agent": null,
            "created_at": "2019-04-18 06:13:24",
            "updated_at": "2019-04-18 06:17:02"
        },
        {
            "id": 15,
            "name": "AG 8016",
            "first_name": "AG",
            "last_name": "8016",
            "employee_no": "ag8016",
            "photo_url": null,
            "identity_no": null,
            "job_title_id": 21,
            "job_title": {
                "id": 21,
                "abbrev": null,
                "name": "Sales Specialist",
                "description": null
            },
            "department_id": -1,
            "department": null,
            "extension_id": -1,
            "extension": null,
            "profile": {
                "id": 31,
                "phones": []
            },
            "is_active": true,
            "role": "",
            "email": null,
            "group_id": 3,
            "group": {
                "id": 3,
                "name": "SUN1",
                "description": null,
                "supervisor_id": 9
            },
            "is_immortal": false,
            "cti_agent_account": null,
            "cti_agent": null,
            "created_at": "2019-04-18 06:13:02",
            "updated_at": "2019-04-18 06:17:13"
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 6,
        "per_page": "3",
        "to": 3,
        "total": 17
    }
}
```

## Search sponsors

```javascript
GET https://{API_DOMAIN}/api/v1/sponsor
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/sponsor"
```

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                       |
| -------- | ---------------- | ----------------------------------------------------------------- |
| **data** | Array of objects | [sponsor array](/developer/api/response-object.md#ye-zhu-sponsor) |
| **meta** | Object           | Pagination meta                                                   |

```javascript
{
    "data": [
        {
            "id": 1,
            "name": "default",
            "description": null,
            "is_immortal": true,
            "mail_channels": []
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": 15,
        "to": 1,
        "total": 1
    }
}
```

## Search ticket termination codes

```javascript
GET https://{API_DOMAIN}/api/v1/ticket-termination-code
```

```
curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/ticket-termination-code"
```

### Query Parameters

| PARAMETER     | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                                          |
| ------------- | -------- | ------- | ------ | ---------------------------------------------------- |
| **page**      | false    | 1       | Number | Which page is currently on                           |
| **per\_page** | false    | 15      | Number | How many items to display per page                   |
| **search**    | false    | NULL    | String | Fuzzy search employee name, ID card, employee number |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                                                                              |
| -------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ |
| **data** | Array of objects | [termination code array](/developer/api/response-object.md#gong-chan-zhuang-tai-xi-xiang-dai-ma-ticket-termination-code) |
| **meta** | Object           | Pagination meta                                                                                                          |

### Response

| PROPERTY        | TYPE   | DESCRIPTION                                                                   |
| --------------- | ------ | ----------------------------------------------------------------------------- |
| **id**          | Number | termination code id                                                           |
| **name**        | String | termination code name                                                         |
| **description** | String | termination code description                                                  |
| **status**      | Number | corresponding ticket status <0: pending 1: processing 2: completed 3: closed> |
| **creater\_id** | Number | id of the employee who created that termination code                          |

```javascript
{
    "data": [
        {
            "id": 1,
            "name": "Unknown yet",
            "description": null,
            "status": 0,
            "creater_id": 1
        },
        {
            "id": 2,
            "name": "Known",
            "description": null,
            "status": 0,
            "creater_id": 1
        },
        {
            "id": 3,
            "name": "Under discussion",
            "description": null,
            "status": 1,
            "creater_id": 1
        },
        {
            "id": 4,
            "name": "Writing",
            "description": null,
            "status": 1,
            "creater_id": 1
        },
        {
            "id": 5,
            "name": "Confirm whether it can be handled",
            "description": null,
            "status": 0,
            "creater_id": 1
        },
        {
            "id": 6,
            "name": "Abandoned",
            "description": null,
            "status": 3,
            "creater_id": 1
        },
        {
            "id": 7,
            "name": "There are still things to handle later",
            "description": null,
            "status": 2,
            "creater_id": 1
        },
        {
            "id": 8,
            "name": "Done",
            "description": null,
            "status": 2,
            "creater_id": 1
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": 15,
        "to": 8,
        "total": 8
    }
}
```

## Search categories

```javascript
GET https://{API_DOMAIN}/api/v1/category
```

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

### Query Parameters

| PARAMETER     | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                        |
| ------------- | -------- | ------- | ------ | ---------------------------------- |
| **page**      | false    | 1       | Number | Which page is currently on         |
| **per\_page** | false    | 15      | Number | How many items to display per page |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                              |
| -------- | ---------------- | ------------------------------------------------------------------------ |
| **data** | Array of objects | [category array](/developer/api/response-object.md#zhu-fen-lei-category) |
| **meta** | Object           | Pagination meta                                                          |

```javascript
{
    "data": [
        {
            "id": 1,
            "name": "Phone function",
            "description": null,
            "children": [
                {
                    "id": 26,
                    "name": "Suggestion",
                    "description": null
                }
            ]
        },
        {
            "id": 2,
            "name": "Claim related",
            "description": null,
            "children": [
                {
                    "id": 23,
                    "name": "Timeliness",
                    "description": null
                }
            ]
        },
        {
            "id": 3,
            "name": "PA related",
            "description": null,
            "children": [
                {
                    "id": 21,
                    "name": "Premium calculation method",
                    "description": null
                },
                {
                    "id": 22,
                    "name": "Latest offers",
                    "description": null
                }
            ]
        },
        {
            "id": 4,
            "name": "Shipping",
            "description": null,
            "children": [
                {
                    "id": 25,
                    "name": "Region",
                    "description": null
                }
            ]
        },
        {
            "id": 5,
            "name": "Email",
            "description": "Email-related features",
            "children": [
                {
                    "id": 27,
                    "name": "Backend program BUG",
                    "description": "BUGs to be fixed",
                }
            ]
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": 15,
        "to": 5,
        "total": 5
    }
}
```

## Search subcategories

```javascript
GET https://{API_DOMAIN}/api/v1/subcategory
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/subcategory"
```

### Query Parameters

| PARAMETER        | REQUIRED | DEFAULT | TYPE               | DESCRIPTION                        |
| ---------------- | -------- | ------- | ------------------ | ---------------------------------- |
| **page**         | false    | 1       | Number             | Which page is currently on         |
| **per\_page**    | false    | 15      | Number             | How many items to display per page |
| **category\_id** | false    | Number  | parent category id |                                    |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                                   |
| -------- | ---------------- | ----------------------------------------------------------------------------- |
| **data** | Array of objects | [subcategory array](/developer/api/response-object.md#zi-fen-lei-subcategory) |
| **meta** | Object           | Pagination meta                                                               |

```javascript

{
    "data": [
        {
            "id": 21,
            "name": "Premium calculation method",
            "description": null,
            "category": {
                "id": 3,
                "name": "PA related",
                "description": null
            },
            "category_id": 3
        },
        {
            "id": 22,
            "name": "Latest offers",
            "description": null,
            "category": {
                "id": 3,
                "name": "PA related",
                "description": null
            },
            "category_id": 3
        },
        {
            "id": 23,
            "name": "Timeliness",
            "description": null,
            "category": {
                "id": 2,
                "name": "Claim related",
                "description": null
            },
            "category_id": 2
        },
        {
            "id": 24,
            "name": "Test subcategory",
            "description": "Test subcategory",
            "category": null,
            "category_id": null
        },
        {
            "id": 25,
            "name": "Region",
            "description": null,
            "category": {
                "id": 4,
                "name": "Shipping",
                "description": null
            },
            "category_id": 4
        },
        {
            "id": 26,
            "name": "Suggestion",
            "description": null,
            "category": {
                "id": 1,
                "name": "Phone function",
                "description": null
            },
            "category_id": 1
        },
        {
            "id": 27,
            "name": "Backend program BUG",
            "description": "BUGs to be fixed",
            "category": {
                "id": 5,
                "name": "Email",
                "description": "Email-related features"
            },
            "category_id": 5
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": 15,
        "to": 7,
        "total": 7
    }
}
```
