Skip to content

Create Ticket

Overview

To create a new support ticket, you must first retrieve the list of available ticket subjects. This ensures that the correct subject_id is used when creating the ticket. Follow these steps:

  1. Get Available Ticket Subjects: Retrieve the list of subjects using the /api/v1/Tickets/getSubjects endpoint.
  2. Create a Ticket: Use the retrieved subject_id to create a new support ticket.

1. Get Available Ticket Subjects

Endpoint

GET /api/v1/Tickets/getSubjects

This endpoint retrieves a list of available subjects for support tickets.


Authorization

  • Type: Bearer Token
  • Header:
    Authorization: Bearer <your_token_here>
    

Example Request

curl -X GET "https://yourispcrmdomain/api/v1/Tickets/getSubjects" \
-H "Authorization: Bearer YOURAPITOKENHERE"

Success Response (200 OK)

{
  "success": true,
  "data": [
    {
      "subject_id": 1,
      "name": "Technical Support"
    },
    {
      "subject_id": 2,
      "name": "Billing Issue"
    }
  ]
}

Explanation: - success - Indicates if the request was successful. - data - An array of available ticket subjects: - subject_id - Unique ID of the subject. - name - Name of the subject.


Error Response

401 Unauthorized

{
  "success": false,
  "message": "Unauthorized"
}

Explanation: - This error occurs if the Bearer Token is invalid or missing.


Example Response

{
  "success": true,
  "data": [
    {
      "subject_id": 1,
      "name": "Technical Support"
    },
    {
      "subject_id": 2,
      "name": "Billing Issue"
    }
  ]
}


2. Create Ticket

Endpoint

POST /api/v1/subscriber/CreateTicket

This endpoint allows the authenticated subscriber to create a new support ticket using a valid subject_id retrieved from the previous step.


Authorization

  • Type: Bearer Token
  • Header:
    Authorization: Bearer <your_token_here>
    

Request Body

  • Content-Type: application/json

JSON Parameters

Parameter Type Required Description
subject_id integer Yes ID of the ticket subject (from the previous step).
type_id integer Yes ID of the ticket type.
status_id integer Yes ID of the initial status for the ticket.
priority_id integer Yes ID of the priority level for the ticket.
group_id integer Yes ID of the group to assign the ticket.
message string Yes Detailed message describing the issue.

Example Request

curl -X POST "https://yourispcrmdomain/api/v1/subscriber/CreateTicket" \
-H "Authorization: Bearer YOURAPITOKENHERE" \
-H "Content-Type: application/json" \
-d '{
  "subject_id": 1,
  "type_id": 1,
  "status_id": 1,
  "priority_id": 1,
  "group_id": 1,
  "message": "Internet is not working since yesterday. Please resolve it ASAP."
}'

Response

Success Response (200 OK)

{
  "success": true,
  "message": "Ticket created successfully",
  "data": {
    "ticket_id": 101,
    "status": "Open"
  }
}

Explanation: - success - Indicates if the request was successful. - message - Confirmation message for the ticket creation. - data - Contains ticket details: - ticket_id - Unique ID of the created ticket. - status - Initial status of the ticket (e.g., Open).


Error Responses

404 Not Found

{
  "success": false,
  "message": "Subscriber not found"
}

Explanation: - This error occurs if the subscriber cannot be found.


400 Bad Request

{
  "success": false,
  "message": "Invalid request data"
}

Explanation: - This error occurs if the request body contains invalid or missing parameters.


Example Response

{
  "success": true,
  "message": "Ticket created successfully",
  "data": {
    "ticket_id": 101,
    "status": "Open"
  }
}

For further assistance, contact our support team at support@netgroot.com.