Apply an action to the given Ticket ID. The action must be one of the currently available 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 an action tho this ticket. Actions will be applied in the name of the currently logged in user.
Apply the 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 | number | The id of the action to apply to the ticket. This field is mandatory |
userGUID | string | An optional GUID string of the user that is applying the action. The currently authenticated user will be used by default. |
fields | map<string,string> | An optional map of ticket fields that should be set on the ticket. |
extensionArguments | map<string,string> | An optional map of extension arguments that should be set on the ticket |
attachments | list<Attachments> | an optional list of Attachments |
Note: The optional JSON elements fields and extensionArguments 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.
Some actions may require a custom field, such as custom1
to be set. That can also be done using the fields
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.
# Request POST /api/ticket/1/apply HTTP/1.1 Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u { "text": "Hello World", "htmlContent": "false", "actionId": -12, "fields": { "reaStepField1": "reaStepFieldValue", "ticketField1": "ticketFieldValue", ... } "extensionArguments": { "ticketArgument1": "ticketArgumentValue", ... } } # Response HTTP/1.1 200 OK Content-Type: application/json "1234"
# 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}'
The request allows the upload of additional attachments. The following requirements have to be fulfilled for an attachment upload:
Content-Type: multipart/form-data
headerjson
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 |
# 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/1/apply" \ --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 -Ls "http://127.0.0.1:9000/api/ticket/1/apply" \ --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" }, ] }