Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
71c7d891
Commit
71c7d891
authored
12 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
Add detail documentation for API ticket/create
parent
af91f268
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup/doc/api/tickets.md
+114
-0
114 additions, 0 deletions
setup/doc/api/tickets.md
with
114 additions
and
0 deletions
setup/doc/api/tickets.md
0 → 100644
+
114
−
0
View file @
71c7d891
Tickets
=======
The API supports ticket creation via the HTTP API (as well as via email,
etc.). Currently, the API support creation of tickets only -- so no
modifications and deletions of existing tickets is possible via the API for
now.
Create a Ticket
---------------
### Fields ######
*
__email__:
*required*
Email address of the submitter
*
__name__:
*required*
Name of the submitter
*
__subject__:
*required*
Subject of the ticket
*
__message__:
*required*
Initial message for the ticket thread
*
__alert__: If unset, disable alerts to staff. Default is
`true`
*
__autorespond__: If unset, disable autoresponses. Default is
`true`
*
__ip__: IP address of the submitter
*
__phone__: Phone number of the submitter. See examples below for
embedding the extension with the phone number
*
__phone_ext__: Phone number extension -- can also be embedded in
*phone*
*
__priorityId__: Priority
*id*
for the new ticket to assume
*
__source__: Source of the ticket, default is
`API`
*
__topicId__: Help topic
*id*
associated with the ticket
*
__attachments__: An array of files to attach to the initial message.
Each attachment must have some content and also the
following fields:
*
__name__:
*required*
name of the file to be attached. Multiple files
with the same name are allowable
*
__type__: Mime type of the file. Default is
`text/plain`
*
__encoding__: Set to
`base64`
if content is base64 encoded
### XMl Payload Example ######
The XML data format is extremely lax. Content can be either sent as an
attribute or a named element if it has no sub-content.
In the example below, the simple element could also be replaced as
attributes on the root
`<ticket>`
element; however, if a
`CDATA`
element is
necessary to hold special content, or difficult content such as double
quotes is to be embedded, simple sub-elements are also supported.
Notice that the phone extension can be sent as the
`@ext`
attribute of the
`phone`
sub-element.
<?xml version="1.0" encoding="UTF-8"?>
<ticket alert="true" autorespond="true" source="API">
<name>Peter Rotich</name>
<email>peter@osticket.com</email>
<subject>Testing API</subject>
<phone ext="123">504-305-8634</phone>
<message><![CDATA[Message content here]]></message>
<attachments>
<file name="file.txt" type="plain/text"
encoding="base64"><![CDATA[
File content is here and is automatically trimmed
]]></file>
</attachments>
<ip>123.211.233.122</ip>
</ticket>
### JSON Payload Example ###
Attachment data for the JSON payload uses the
[
RFC 2397
][]
data URL format.
As described above, the content-type and base64 encoding hints are optional.
Furthermore, a character set can be optionally declared for each attachment
and will be automatically converted to UTF-8 for database storage.
Notice that the phone number extension can be embedded in the
`phone`
value
denoted with a capital
`X`
Do also note that the JSON format forbids a comma after the last element in
an object or array definition, and newlines are not allowed inside strings.
{
"alert": true,
"autorespond": true,
"source": "API",
"name": "Peter Rotich",
"email": "peter@osticket.com",
"phone": "5043058634X123",
"subject": "Testing API",
"ip": "123.211.233.122",
"message": "MESSAGE HERE",
"attachments": [
{"file.txt": "data:text/plain;charset=utf-8,content"},
{"image.png": "data:image/png;base64,R0lGODdhMAA..."},
]
}
[
rfc 2397
]:
http://www.ietf.org/rfc/rfc2397.txt
"Data URLs"
### Response ######
If successful, the server will send
`HTTP/201 Created`
. Otherwise, it will
send an appropriate HTTP status with the content being the error
description. Most likely offenders are
*
Required field not included
*
Data type mismatch (text send for numeric field)
*
Incorrectly encoded base64 data
*
Unsupported field sent
*
Incorrectly formatted payload (bad JSON or XML)
Upon success, the content of the response will be the external ticket id of
the newly-created ticket.
Status: 201 Created
123456
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment