# 4. API get ticket

1\. List of tickets or details of a ticket via id on Ant CRM

URL: <https://apiring.antbuddy.com/tickets>

Method: GET

Content-Type: application/json

| **Parameters**  | **Type** | **Required** | **Explain**                                                                                                                         |
| --------------- | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| TicketId        | string   |              | Id of ticket                                                                                                                        |
| page            | number   |              | Page number, maximum 20 Orders per page                                                                                             |
| limit           | number   |              | Number of records per page                                                                                                          |
| typeTime        | string   |              | If the parameter `typeTime` is passed as `updatedAt`, then the updated date will be used; otherwise, the created date will be used. |
| startDate       | string   |              | For example:2024-03-13T06:24:20.673Z                                                                                                |
| endDate         | string   |              | For example:2024-03-19T06:24:20.673Z                                                                                                |
| isTicketDeleted | Boolean  |              | If `isTicketDeleted` is true, retrieve all tickets, including deleted tickets.                                                      |

Results returned: HTTP Response Code: 200

Response:

\[{

SLA: "",

TicketId: 17464,

assignedTo: "<thong.nguyen@antbuddy.com>",

group: “”,

category: “”,

resolutionTypeOb: “”,

contact: {},

cusFields: \[]

deal: {},

files: \[]

priority: "Medium"

status: "Assigned"

summary: "\<p>test\</p>"

title: "\[Phone] Thông test",

createdAt: “”, // Thời gian tạo ticket

updatedAt: “” // Thời gian cập nhật ticket

}]

2. Add tickets

URL: <https://apiring.antbuddy.com/tickets>

Method: POST

Content-Type: application/json

| **Parameters**   | **Type** | **Required** | **Explain**                                                                                                                                                                                                                                                        |
| ---------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| title            | string   | AND          | Ticket name                                                                                                                                                                                                                                                        |
| ticketIdApiRing  | string   |              | Ticket code                                                                                                                                                                                                                                                        |
| summary          | string   |              | Summary/Summary                                                                                                                                                                                                                                                    |
| priority         | string   |              | Priority. Default: Medium                                                                                                                                                                                                                                          |
| SLA              | string   | AND          | Sla                                                                                                                                                                                                                                                                |
| contact          | object Y | Y            | <p>{</p><p>“id”: “661ca720f70843211b05712a” //</p><p>Customer id code If yes, it is not required.</p><p>“emails”: \[{type: “Work”, value:</p><p>“<xyz@example.com>”}], “name”: “thong”, // required</p><p>“phones”: \[{type: “Work”, value: “023232”}]</p><p>}</p> |
| deal             | object   |              |                                                                                                                                                                                                                                                                    |
| group            | string   |              |                                                                                                                                                                                                                                                                    |
| category         | string   |              |                                                                                                                                                                                                                                                                    |
| status           | string   |              |                                                                                                                                                                                                                                                                    |
| resolutionTypeOb | string   |              |                                                                                                                                                                                                                                                                    |
| files            | array    |              |                                                                                                                                                                                                                                                                    |
| cusFields        | array    |              | <p>AntCRM custom fields.</p><p>\[</p><p>{ name: "Shipping</p><p>unit",</p><p>value: “Fast delivery”</p><p>}</p><p>]</p>                                                                                                                                            |

Results returned:

HTTP Response Code: 200

Response:

{

"success": 1,

"TicketId”: 9457 (ticket id on antcrm) }

3. Edit tickets

URL: <https://apiring.antbuddy.com/tickets>

Method: PUT

Content-Type: application/json

| **Parameters**   | **Type** | **Required** | **Explain**                                                                                                             |
| ---------------- | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------- |
| TicketId         | string   | AND          |                                                                                                                         |
| title            | string   |              | Ticket name                                                                                                             |
| summary          | string   |              | Summary/Summary                                                                                                         |
| priority         | string   |              | Priority                                                                                                                |
| SLA              | string   |              |                                                                                                                         |
| deal             | object   |              |                                                                                                                         |
| category         | string   |              |                                                                                                                         |
| status           | string   |              |                                                                                                                         |
| resolutionTypeOb | string   |              |                                                                                                                         |
| filed            | array    |              |                                                                                                                         |
| cusFields        | array    |              | <p>AntCRM custom fields.</p><p>\[</p><p>{ name: "Shipping</p><p>unit",</p><p>value: “Fast delivery”</p><p>}</p><p>]</p> |

Results returned:

HTTP Response Code: 200

Response:

{

"success": 1,

"number”: 9457 (id of order on antcrm) }

4. Delete tickets

URL: <https://apiring.antbuddy.com/tickets>

Method: DELETE

Content-Type: application/json

| **Parameters** | **Type** | **Required** | **Explain**         |
| -------------- | -------- | ------------ | ------------------- |
| TicketId       | string   | AND          | ticket id on antcrm |

Results returned: HTTP Response Code: 200

Response:

{

"success": 1

}
