Create

This endpoint creates a new ticket. The request is supposed to be send using the POST verb, including a request body consisting of JSON to describe the new ticket. Depending on the roles of the user accessing the interface, additional information can be set to further define the new ticket.

POST /api/ticket/create

The following request fields can be set in the JSON posted to the server. The servers response is either an error or the ticket id of the newly created ticket.

REQUEST Fields Value Type Description
text string The request text of the new ticket
htmlContent boolean An optional value of: true, if the text contains HTML content; false otherwise. The value is false by default
ownerGUID string An optional GUID string of the owner of the ticket. The currently authenticated user will be used by default. Only users that can act as supporter are allowed to set a different owner for a ticket.
ticketFields map<string,string> An optional map of ticket fields that should be set on the ticket. Accepts the key or localized display name of a field. Using unrecognized ticket fields will result in an error.
actionArguments map<string,string> An optional map of action arguments that should be used when creating the ticket
attachments list<Attachments> an optional list of Attachments

Note: The optional JSON elements ticketFields and actionArguments are documented for completeness and should usually not be needed to be set. However, if they are, the keys have to match defined ticket field key names and the values must match the fields respective type, which can also be an object. If the a field does not match, it will be discarded silently and a message will be logged using the debug level.

Example Request

# Request
POST /api/ticket/create HTTP/1.1
Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u
 
{
    "text": "Hello World",
    "htmlContent": "false",
    "ownerGUID": "anOwnerGUID",
    "ticketFields": {
        "ticketField1": "ticketFieldValue",
        ...
    }
    "actionArguments": {
        "ticketArgument1": "ticketArgumentValue",
        ...
    }
}
 
# Response
HTTP/1.1 200 OK
Content-Type: application/json
 
"1234"

Application Example

# Browser access
http://127.0.0.1:9000/api/ticket/create
 
# Shell access using curl
curl -Ls "http://127.0.0.1:9000/api/ticket/create" \
     --header 'Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u' \
     --header "Content-Type: application/json" \
     --request POST \
     --data '{"text":"Hello World"}'
 
# Shell access using curl with username and password
curl -Lsu username:password "http://127.0.0.1:9000/api/ticket/create" \
     --header "Content-Type: application/json" \
     --request POST \
     --data '{"text":"Hello World"}'

Attachments

The request allows the upload of additional attachments. The following requirements have to be fulfilled for an attachment upload:

  • The request has to be performed using the Content-Type: multipart/form-data header
  • The JSON itself has to be sent as file attachment using the attribute name json
  • The JSON has to contain a list of attachment descriptions (see below) using the attribute attachment<X> with <X> being a number starting at 0; corresponding to the index of the attachment description list for the given attachment.
REQUEST Fields Value Type Description
name string The file name of the attachment
lastModified long The timestamp of the last modification of this attachment (can be 0)
attachmentType string The type of the attachment. Has to be one of the following values: Attachment, EmbeddedImage, Signature, Unknown

Application Example

# Browser access
http://127.0.0.1:9000/api/ticket/create
 
# Shell access using curl
curl -Ls "http://127.0.0.1:9000/api/ticket/create" \
     --header 'Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u' \
     --header "Content-Type: multipart/form-data" \
     --request POST \
     --form json=@json.txt
     --form attachment0="@first attachment.pdf"
     --form attachment1="@second attachment.pdf"
 
# Shell access using curl with username and password
curl -Lsu username:password "http://127.0.0.1:9000/api/ticket/create" \
     --header "Content-Type: multipart/form-data" \
     --request POST \
     --form json=@json.txt
     --form attachment0="@first attachment.pdf"
     --form attachment1="@second attachment.pdf"
 
# Note: The ''@'' sign is required for curl to recognize the input as a file.

The json.txt file content could like like:

{
  "text": "Request with attachment",
  "attachments": [
    {
      "name": "first attachment.pdf",
      "lastModified": 0,
      "attachmentType": "Attachment"
    },
    {
      "name": "second attachment.pdf",
      "lastModified": 0,
      "attachmentType": "Attachment"
    },
  ]
}