{{sidenavigation.sidenavigationExpandLabel}}
{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}} {{helpModel.downloadHelpPdfDataStatus}}

Apply

Apply a ticket action to the given Ticket ID. The ticket action must be one of the currently available ticket actions that can be applied to the ticket, or an exception will be raised. Only users with the write permission to a ticket are allowed to apply a ticket action to this ticket. Ticket actions will be applied in the name of the currently logged-in user.

POST /api/ticket/<ticket-id>/apply

Apply the ticket actions using the given JSON data. The response is the ID of the newly create editing step.

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
actionId string The id of the ticket action to apply to the ticket. This field is mandatory
userGUID string An optional GUID string of the user that is applying the ticket action. The currently authenticated user will be used by default.
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.
stepFields map<string,string> An optional map of step fields that should be set on the step that is applied due to the ticket action. Accepts the key or localized display name of a field. Using unrecognized step fields will result in an error.
actionArguments map<string,string> An optional map of ticket action arguments that should be set on the ticket
attachments list<Attachments> an optional list of Attachments

Note: The optional JSON elements ticketFields, stepFields 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.

Note: The optional JSON element userGUID has effect only when the request is run using the privileged user account. This is not possible by pure web API access and therefore documented only for completeness. A custom implemented Web API Access Provider is required to use this field.

Required Ticket Fields

Some ticket actions may require a custom field, such as custom1 to be set. That can also be done using the ticketFields section of a request. To figure out the exact field name - which varies from the display title in the UI - you should set the field accordingly using the Tickets application and check the fields set using the Web API handler for a ticket.

The localized display name of the field may be used alternatively.

Example Request

# Request
POST /api/ticket/1/apply HTTP/1.1
Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u
 
{
    "text": "Hello World",
    "htmlContent": "false",
    "actionId": "-12",
    "ticketFields": {
        "ticketField1": "ticketFieldValue",
        ...
    }
    "stepFields": {
        "reaStepField1": "reaStepFieldValue",
        ...
    }
    "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/1/apply
 
# Shell access using curl
curl -Ls "http://127.0.0.1:9000/api/ticket/1/apply" \
     --header 'Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u' \
     --header "Content-Type: application/json" \
     --request POST \
     --data '{"text":"Hello World","actionId":"-12"}'
 
 
# Shell access using curl with username and password
curl -Lsu username:password "http://127.0.0.1:9000/api/ticket/1/apply" \
     --header "Content-Type: application/json" \
     --request POST \
     --data '{"text":"Hello World","actionId":"-12"}'

Action Arguments

The list of action arguments with the JSON key actionArguments can be used to give further hints to the ticket. If the arguments are wrong, a message with the available action arguments will be printed in the debug log. Here are some of the available arguments:

Action Argument Value Description
ticketextension.dispatchNow "NOT" - do not dispatch Dispatch newly created tickets. Depending on the general setup of the ticket system, an additional hint is required for ticket dispatching
"ALWAYS" - always dispatch ticket
"IF_RESOURCE_AVAILABLE" - only dispatch, if a resource is set
ticketextension.automail "NEVER" - never sand any auto mails Set up how auto-mails will be handled during the ticket creation.
"NO_MAILS_TO_ENDUSER" - do not send emails to end users
"SERVERSETTING" - only send auto-mail if set in configuration
"ALWAYS" - always send the auto mail
ticketextension.newuserticketjstrigger "true" - run the NEW_USER_TICKET JavaScript Indicate, that an end user creates the ticket manually and that the NEW_USER_TICKET JavaScript should be run.
"false" - do not run the JavaScript
ticketextension.applyanswer "SEND_ONLY" - only send the answer email Allows closing the ticket after sending an email
"SEND_AND_CLOSE" - send the email and close the ticket
"SEND_AND_CLOSE_AFTER_X_DAYS" - send the email and close the ticket after X days, which is set up in the configuration
processingtimeextension.appointment Timestamp value as String, e.g. "1733875200000" A timestamp for the actions Resubmission (Wiedervorlage) and Make an appointment (Termin vereinbaren).
ticketactionextension.escalate "{'targetResID' : '<GUID of target resource>', 'slaveTicketIDs' : ['optional', 'list', 'of', 'connected', 'secondary', 'tickets', 'to', 'escalate'], 'changeTicketStatus' : true|false}" Using the actions Escalate (Eskalieren), you have to provide this actionArgument to provide additional escalation information.
inventory_affectedassets "['<Asset GUID>', '<Asset GUID>']" A stringified list of Asset GUIDs that should be linked to the ticket. Requires the Inventory plugin.

Note: Keys and values are Strings. If values require a JSON input, it must be stringified.

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
  • Attachment files have to have the attribute name attachment<X> with <X> being a number starting at 0; corresponding to the index of the attachment description list for the given attachment.
  • The JSON has to contain a list of attachment descriptions (see below). The entry index has to match your attachment<X> - file. The list of attachment descriptions can be added to your JSON map using the attachments key.
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:

{
  "text": "Request with attachment",
  "attachments": [
    {
      "name": "first attachment.pdf",
      "lastModified": 0,
      "attachmentType": "Attachment"
    },
    {
      "name": "second attachment.pdf",
      "lastModified": 0,
      "attachmentType": "Attachment"
    },
  ]
}
i-net HelpDesk
This application uses cookies to allow login. By continuing to use this application, you agree to the use of cookies.


Help - /apply