# API - Add Ticket (JSON)

Overview

Enables ticket to be opened from remote website or application. Please read the information below carefully.

JSON Wrapper Structure

Your json wrapper structure should look like the following:
{
"api" : "YOUR KEY",
"op" : "ticket",
"tickets" : { ticket data as shown below }
}
Op type is "ticket" and must NOT be changed. API key must be same as key in settings.

Ticket Data (Required)

Multiple tickets are possible with each transmission. All tickets are a part of the "ticket" object. Custom field data and attachments are supported, but are optional. Structure as follows for single ticket:
"ticket" : {
"attachments" : { Attachment data as shown below },
"comments" : "Comments",
"language" : "english",
"customfields" : { Custom field data as shown below },
"dept" : "Dept ID number",
"email" : "Persons Email",
"name" : "Persons Name",
"priority" : "ID as shown on priority level page and in screenshot below",
"status" : "ID as shown on ticket statuses page and in screenshot below",
"subject" : "Subject of ticket"
}
Multiple entries are specified using the [] operator within the same "ticket" object. Example:
"ticket" : [{
"attachments" : { Attachment data as shown below },
"comments" : "Comments",
"language" : "english",
"customfields" : { Custom field data as shown below },
"dept" : "Dept ID number",
"email" : "Persons Email",
"name" : "Persons Name",
"priority" : "ID as shown on priority level page and in screenshot below",
"status" : "ID as shown on ticket statuses page and in screenshot below",
"subject" : "Subject of ticket 1"
},{
"attachments" : { Attachment data as shown below },
"comments" : "Comments",
"language" : "english",
"customfields" : { Custom field data as shown below },
"dept" : "Dept ID number",
"email" : "Persons Email",
"name" : "Persons Name",
"priority" : "ID as shown on priority level page and in screenshot below",
"status" : "ID as shown on ticket statuses page and in screenshot below",
"subject" : "Subject of ticket 2"
}]
Priority level must be ID as shown on priority levels page in your settings. If invalid or blank, defaults to 'low'. This may be a text value OR a numeric ID as shown in the following screenshot:
Ticket status must be ID as shown on ticket statuses page in your settings. If invalid or blank, defaults to 'open'. This may be a text value OR a numeric ID as shown in the following screenshot:
Language is an optional tag and is only required if you are using the multi language option. If an account exists already, the language will be taken from the account and the xml value will have no meaning. It's for new accounts only and sets their default language. No language specified will default to the main language in the settings.
For comments, if you are using the WYSIWYG editor option, you should send comments with line breaks / links etc.

Custom Field Data (Optional)

Custom field data is also supported and is optional. Structure as follows:
"customfields" : {
"f1" : "Custom field ID 1 data",
"f2" : "Custom field ID 2 data"
}
Each field tag contains the ID number of the field as shown in the main screenshot here prefixed with an 'f'. 'f1' for example would be custom field ID 1. If the ID doesn't exist in the system, the field tag will be ignored.
If the custom field value can be one of a number of specific options, the options you present to visitors in your application should mirror these.

Attachments (Optional)

Multiple attachments are possible with each transmission. All attachments are a part of the "file" object. Attachment data must be base64 encoded. Structure for single attachment is:
"file" : {
"data" : "Base64 encoded data for file",
"ext" : "File extension: (jpg,pdf etc)"
"name" : "Optional file name: (myfile.pdf, apicture,jpg etc)"
}
Multiple entries are specified using the [] operator within the same "file" object. Example:
"file" : [{
"data" : "Base64 encoded data for file",
"ext" : "File extension: (jpg,pdf etc)"
"name" : "Optional file name: (myfile.pdf, apicture,jpg etc)"
},{
"data" : "Base64 encoded data for file",
"ext" : "File extension: (jpg,pdf etc)"
"name" : "Optional file name: (myfile.pdf, apicture,jpg etc)"
}]
The extension is not case sensitive. Same restrictions apply with attachments as with standard tickets. If restrictions are met, attachments are ignored. The "name" parameter is optional. If a file already exists, the system will auto rename the file to prevent accidental erasure of existing files.

JSON Response

On successful transmission a json response is returned:
{
"status" : "OK",
"ticketID" : "Database ID of ticket created. For additional custom ops if required. If multiple, array of ID values.",
"message" : ""
}
If an error occurs, the following is returned:
{
"status" : "ERROR",
"message" : "Reason for error.."
}
Your own application should deal with the response accordingly.

Example File

Click here to view an example json file.

Return to API Overview