Tickets REST API Route
Authentication #
Authentication is required for this route. The authenticated user will be able to retrieve and update tickets to which they have access. They will also be able to create new tickets. It is recommended that a user with the role of Support Manager or higher is used.
Schema #
When working with the Tickets REST API route the following fields can be expected in any responses.
idinteger |
Unique identifier for the ticket Read Only |
datestring |
The date the ticket was published, in the site’s timezone |
date_gmtstring |
The date the ticket was published, as GMT |
modifiedstring |
The date the ticket was last modified, in the site’s timezone |
modified_gmtstring |
The date the ticket was last modified, as GMT |
statusstring |
The named status of the ticket One of: new, open, hold, closed – additional values may be available if the KBS Custom Ticket Status extension is installed |
titleobject |
The title of the ticket |
contentobject |
The content for the ticket |
ticket_dataobject |
Ticket fields See Ticket Data Object |
repliesinteger |
The count of replies associated with the ticket |
linksobject |
Links associated with the ticket |
| Ticket Data Object # The following fields are included within the ticket_data object |
|
resolved_datestring |
The date the ticket was resolved, in local timezone |
numberstring |
Unique identifier for the ticket |
keystring |
Unique key for the ticket |
filesobject |
Data of files associated with ticket |
agentinteger |
WP user ID of agent assigned to the ticket |
additional_agentsobject |
WP user ID’s of additional agent workers of the ticket |
customerinteger |
KBS user ID of the ticket customer |
emailstring |
Email address of the ticket customer |
user_idinteger |
WP user ID of the ticket customer |
user_infoobject |
Ticket customer information |
companyinteger |
ID of company associated with the ticket |
participantsobject |
Email addresses of ticket participants |
form_dataobject |
The data that was submitted via a submission form |
List Tickets #
Query this endpoint to retrieve a collection of tickets that the authenticated user has access to. The response you receive can be controlled and filtered using the URL query parameters below.
Definition #
GET /kbs/v1/tickets
Example Request #
$ curl https://example.com/wp-json/kbs/v1/tickets
Arguments #
page |
Current page of the collection Default: 1 |
per_page |
Maximum number of items to be returned in result set Default: 10 |
exclude |
Ensure result set excludes specific post IDs |
include |
Limit result set to specific post IDs |
offset |
Offset the result set by a specific number of items |
order |
Order sort attribute ascending or descending Default: descOne of: asc, desc |
orderby |
Sort collection by object attribute Default: idOne of: id, date, title, agent, customer, modified, include |
statusstring | array |
Limit result set to tickets assigned one or more statuses Default: All registered ticket statuses One of: new, open, hold, closed – or any custom status registered via the KBS Custom Ticket Status extension if installed |
user |
Limit result set to tickets logged by customers with a specific WP user ID |
customer |
Limit result set to tickets logged by customers with a specific KBS user ID |
company |
Limit result set to tickets associated with a specific company ID |
agent |
Limit result set to tickets assigned to an agent with a specific WP user ID |
Retrieve a Single Ticket #
Definitions #
GET /kbs/v1/tickets/<id>
GET /kbs/v1/tickets/<number>
Example Requests #
Retrieve Ticket by WP Post ID
$ curl https://example.com/wp-json/kbs/v1/tickets/<id>
Retrieve Ticket by KBS Ticket Number
$ curl https://example.com/wp-json/kbs/v1/tickets/<number>
Arguments #
id |
WP Post ID of the ticket |
number |
KBS ticket number |
Create a Ticket #
Arguments #
ticket_titlestring required |
The subject of the ticket |
ticket_contenttext required |
The content of the ticket |
customer_emailstring required |
Customers email address |
customer_firststring required |
Customers first name |
customer_laststring required |
Customers Last Name |
customer_phone1string |
Customers primary phone number |
customer_phone2string |
Customers additional phone number |
customer_websitestring |
Customers website address |
agent_idinteger | string |
WP user ID or email address of agent to be assigned to ticket |
post_categoryinteger |
ID of category to which to add the ticket |
departmentinteger |
ID of department to which to assign the ticket |
Definition #
POST /kbs/v1/tickets
Update a Ticket #
Arguments #
idinteger |
WP Post ID of the ticket |
agentinteger | string |
WP user ID or email address of agent to be assigned to ticket |
agentsstring |
Comma separated list of agents to be added as workers of the ticket |
companyinteger |
ID of company to associate with ticket |
customerinteger | string |
KBS ID or email address of customer to associate with ticket |
statusstring |
The updated status of the ticket One of: open, hold, closed – or any custom status registered via the KBS Custom Ticket Status extension if installed |
post_categoryinteger |
ID of a category to add to the ticket |
departmentinteger |
ID of department to which to assign the ticket |
Definition #
POST /kbs/v1/tickets/<id>
Example Request #
$ curl -X POST https://example.com/wp-json/kbs/v1/tickets/<id> -d '{"status":"closed"}'
