Skip to main content

Create New Ticket

Endpoint: POST /api/v6.1/ticket

Description: This API is used to create a new support ticket in the system. Data includes title, content, contact information, category, status, and custom fields.


Request

Method: POST

Headers:

Content-Type: application/json
X-API-KEY: <your-api-key>
Cookie: <session-cookie-của-bạn>

Body (JSON):

{
"ticket_title": "Ticket Title",
"ticket_content": "<p>Support content</p>",
"cate_name": "Support Category",
"account_email": "[email protected]",
"account_code": "customer-code",
"contact_name": "Contact Person Name",
"status_name": "Initial Status",
"expected_at": "2025-01-01",
"custom_fields": {
"custom_field": "value"
},
"emergency_phone": "0123456789"
}

Response

Status: 200 OK

Sample Content:

{
"message": "Successfully added",
"data": {
"identity": 10,
"ticket_code": "ABCXYZ1234"
}
}

Input Field Descriptions

| Field | Data Type | Description |
|--------|---------------|-------|
| ticket_title | string | Title of the support ticket |
| ticket_content | string (HTML) | Detailed content, can include HTML formatting |
| cate_name | string | Name of the support ticket category |
| account_email | string | Customer's email |
| account_code | string | Customer identifier in the system |
| contact_name | string | Contact person's name |
| status_name | string | Initial status of the ticket |
| expected_at | string (YYYY-MM-DD) | Expected processing date |
| custom_fields | object | Custom fields configured by the system |
| emergency_phone | string | Emergency contact phone number |\


Notes

  • Fields like cate_name and status_name must match system configuration data.\
  • custom_fields is an object containing keys corresponding to extended fields.

cURL Example

curl --location 'https://<your-domain>/api/v6.1/ticket' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'Cookie: <session-cookie>' \
--data-raw '{
"ticket_title": "Ticket Title",
"ticket_content": "<p>Support content</p>",
"cate_name": "Category",
"account_email": "[email protected]",
"account_code": "customer-code",
"contact_name": "Contact Person",
"status_name": "Status",
"expected_at": "2025-01-01",
"custom_fields": { "extended_field": "value" },
"emergency_phone": "0123456789"
}'

Error Handling

| Error Code | Description |
|--------|------|
| 400 | Missing or invalid required field format |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal system error |