List all tickets

This API helps you to list all tickets you are authorized to read.

HTTP Request
/wp-json/supportcandy/v2/tickets
Available parameters
Parameter Type Description
page integer Current page of the collection. Default is 1.
per_page integer Maximum number of items to be returned in result set. Default is 20.
filter string Filter slug of pre-defined filters. You can get list of all filters for current user by using the below API. Default is all.
/wp-json/supportcandy/v2/tickets/filters
orderby string Sort collection by ticket field slug. You can get list of all ticket fields available to sort for current user by using the below API. Default is date_updated.
/wp-json/supportcandy/v2/tickets/filters/orderby
order string Order sort attribute ascending or descending. Options: ASC and DESC. Default is DESC.
search string Limit results to those matching a string.
Example

curl --location --request GET 'http://localhost/wp-json/supportcandy/v2/tickets?page=1&per_page=20&filter=all&orderby=date_updated&order=DESC' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU='

Get single ticket

This API helps you to list a single ticket.

HTTP Request
/wp-json/supportcandy/v2/tickets/<id>
Example
curl --location --request GET 'http://localhost/wp-json/supportcandy/v2/tickets/1045' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU='

Create new ticket

This API helps you to create new ticket using REST API.

HTTP Request
/wp-json/supportcandy/v2/tickets
Body parameters

Using this API, you can use allowed ticket fields in key-value format to create a ticket. You can get a list of allowed ticket fields for the current user using the below API:

/wp-json/supportcandy/v2/tickets/form-fields

Create ticket on behalf of Customer

Using this API, you can create a ticket on Customer behalf. You need to use name and email of Customer in the API request along with your token.

Default ticket fields

Below is the list of all possible ticket fields available by default and not added by the user.

Field Type Description
name string Required. You must supply the name of the current user or if current user has capability of creating ticket for others, he can supply name of other customer.
email string Required. You must supply the email of the current user or if current user has capability of creating ticket for others, he can supply email of other customer.
subject string Required. You must supply the subject of the ticket.
description string Required. You must supply the description of the ticket. You can use the HTML tags in description text.
description_attachments string Comma-separated list of attachment ids you got from attachment API after uploading files through it one by one. e.g., "4,5,6". These attachments are considered as description thread attachments. Below is the API you can use to upload files.
/wp-json/supportcandy/v2/attachments
category integer ID of the Category you wish to set to the ticket. You can get the list of all categories using the below API.
/wp-json/supportcandy/v2/categories
priority integer ID of the Priority you wish to set to the ticket. You can get the list of all priorities using the below API.
/wp-json/supportcandy/v2/priorities
assigned_agent string Comma-separated list of agent ids you wish to assign agents to this ticket. Please note, you need to add "Assignee" custom field to the ticket form to set Assigned agents using API. Also, you must have permission to change the assignee of the ticket. You can get list of all agents using the below API.
/wp-json/supportcandy/v2/agents
Custom fields
You can supply a custom field slug with the value in the API body parameter. Below is the list of all possible custom field types to know the format of the values we accept through this API. You can get the details of a custom field using the below API and look for the “type” value to know the custom field type. /wp-json/supportcandy/v2/custom-fields/<id>
Field Type Description
cf_textfield string Textfield. You can set single line string. Look for custom field properties like char_limit to know the number of characters are allowed.
cf_multi_select string Dropdown (multi-select). You can send the comma-separated list of option ids. You can get options for the custom field using the below API:
/wp-json/supportcandy/v2/custom-fields/<id>/options
cf_single_select integer Dropdown (single-select). You can send the option id applicable to the custom field. You can get options for the custom field using the below API:
/wp-json/supportcandy/v2/custom-fields/<id>/options
cf_radio_button integer Radio Button. You can send the option id applicable to the custom field. You can get options for the custom field using the below API:
/wp-json/supportcandy/v2/custom-fields/<id>/options
cf_checkbox string Checkbox. You can send the comma-separated list of option ids. You can get options for the custom field using the below API:
/wp-json/supportcandy/v2/custom-fields/<id>/options
cf_textarea string Textarea. You can send multi-line string. HTML tags are not allowed.
cf_date string Date. You can send date string in format yyyy-mm-dd. Format is strictly checked. Look for custom field properties like date_range to know which dates are allowed among all, future, past, and range. In case of range, dates allowed are in between from-date-range and to-date-range
cf_datetime string Datetime. You can send date string in format yyyy-mm-dd hh:mm. Format is strictly checked. Look for custom field properties like date_range to know which dates are allowed among all, future, past, and range. In case of range, dates allowed are in between from-date-range and to-date-range
cf_time string Time. You can send time string in format hh:mm. Format is strictly checked and must be in 24-hour format. Look for custom field properties like time_range to know which time is allowed among all and range. In case of range, time allowed is in between from-time-range and to-time-range
cf_number integer Number. You can send numeric value. Look for custom field properties like char_limit to know the number of characters are allowed.
cf_email string Email Address. You can send valid email address string.
cf_url string URL. You can send valid URL string with protocol. e.g., https://supportcandy.net
cf_file_attachment_multiple string File Attachment (Multiple). Comma-separated list of attachment ids you got from attachment API after uploading files through it one by one. e.g., "4,5,6". Below is the API you can use to upload files. /wp-json/supportcandy/v2/attachments
cf_file_attachment_single integer File Attachment (Single). Attachment id you got from attachment API after uploading file through it. Below is the API you can use to upload files. /wp-json/supportcandy/v2/attachments
cf_woo_order integer WooCommerce order. You can send WooCommerce order id.
cf_woo_order integer WooCommerce order. You can send WooCommerce order id.
cf_woo_product integer WooCommerce product. You can send WooCommerce product id.
cf_edd_order integer Easy Digital Downloads order. You can send order id.
cf_edd_product integer Easy Digital Downloads product. You can send product id.
Example
curl --location --request POST 'http://localhost/wp-json/supportcandy/v2/tickets' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU=' \ --form 'name="John Doe"' \ --form 'email="johndoe@test.com"' \ --form 'subject="This is test subject"' \ --form 'description="This is test description."' \ --form 'description_attachments="4,5"' \ --form 'category="2"' \ --form 'priority="3"' \ --form 'assigned_agent="1,2"' \ --form 'cust_31="test"'

Modify a ticket

This API helps you to modify ticket fields.

HTTP Request
/wp-json/supportcandy/v2/tickets/<id>/update-fields
Body parameters
Using this API, you can modify allowed ticket fields in the key-value format of a ticket. You can refer to create new ticket documentation above for fields. Fields not applicable from create a ticket are description and description_attachments. Fields not included in create ticket documentation is customer in which you can send the customer id to change the customer (raised by) of the ticket.
Example
curl --location --request POST 'http://localhost/wp-json/supportcandy/v2/tickets/1045/update-fields' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU=' \ --form 'subject="Another edit 1"' \ --form 'cust_41="00:31"'

Delete a ticket

This API helps you to delete the ticket.

HTTP Request
/wp-json/supportcandy/v2/tickets/<id>
Example
curl --location --request DELETE 'http://localhost/wp-json/supportcandy/v2/tickets/1031' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU='

List all ticket threads

This API helps you to list all ticket threads.

HTTP Request
/wp-json/supportcandy/v2/tickets/<id>/threads
Available parameters
Parameter Type Description
page integer Current page of the collection. Default is 1.
per_page integer Maximum number of items to be returned in result set. Default is 20.
order string Order sort attribute ascending or descending. Options: ASC and DESC. Default is DESC.
Example
curl --location --request GET 'http://localhost/wp-json/supportcandy/v2/tickets/1045/threads?page=1&per_page=20&order=DESC' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU='

Add new thread

This API helps you to add new thread (reply/note) to the ticket.

HTTP Request
/wp-json/supportcandy/v2/tickets/<id>/threads
Available body parameters
Parameter Type Description
type string Required. Set either reply or note.
body string Required. Set the body of the thread. You can use HTML tags.
attachments string Comma-separated list of attachment ids you got from attachment API after uploading files through it one by one. e.g., "4,5,6". Below is the API you can use to upload files.
/wp-json/supportcandy/v2/attachments
Example
curl --location --request POST 'http://localhost/wp-json/supportcandy/v2/tickets/1045/threads' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU=' \ --form 'type="reply"' \ --form 'body="<p>I am paragraph example.</p>"' \ --form 'attachments="2,3"'

List ticket filters

This API helps you to list all ticket list filters for the current user, which you can send with the ticket list API.

HTTP Request
/wp-json/supportcandy/v2/tickets/filters
Example

curl --location --request GET 'http://localhost/wp-json/supportcandy/v2/tickets/filters' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU='

List orderby fields

This API helps you to list all orderby fields for the current user, which you can send with the ticket list API.

HTTP Request
/wp-json/supportcandy/v2/tickets/filters/orderby
Example

curl --location --request GET 'http://localhost/wp-json/supportcandy/v2/tickets/filters/orderby' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU='

Get ticket list items

This API helps you list all ticket fields allowed in the ticket list for the current user.

HTTP Request
/wp-json/supportcandy/v2/tickets/list-items
Example

curl --location --request GET 'http://localhost/wp-json/supportcandy/v2/tickets/list-items' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU='

Get ticket form fields

This API helps you list all ticket fields allowed in the ticket form for the current user.

HTTP Request
/wp-json/supportcandy/v2/tickets/form-fields
Example

curl --location --request GET 'http://localhost/wp-json/supportcandy/v2/tickets/form-fields' \ --header 'Authorization: Basic YWRtaW46MGk2dCBzMW51IG1uZEUgd1c4SSBST0x5IGRxdEU='

What are your feelings