Skip to content

Message: ticket.create

Back to Index

Creates a new Ticket.

Schema

Body
typeKeystring

Type of ticket to create.

commandsarray of command (optional)

An array of ticket commands to be applied upon creation. If any command fail, the ticket will not be created.

externalReferencestring (optional)

Optional reference to add to the ticket. All must be globally unique across all tickets. Can be used to locate the actor with other means than ID and Number.

createdAtany value (optional)

Overrides createdAt value of the ticket. If not set (or set to the future), the time will be set to the current system time of creation.

Response Type string

Rule Hooks

During the create message, the following rule hooks are run in the given order:

  1. OnTicketBeforeCreated
  2. OnTicketCreated
  3. OnTicketCommands

Example: Create a New Return with Item Exchange

Create a New Return with Item Exchange

Send the following request to /resources/actors/ticket/new

Request

POST https://<hantera-hostname>/resources/actors/ticket/new
Authorization: Bearer <YOUR TOKEN>
Content-Type: application/json
[{
"type": "create",
"body": {
"typeKey": "return",
"externalReference": "return0",
"commands": [
{
"type": "createItem",
"itemTypeKey": "exchange",
"dynamic": {
"message": "pls exchange this item"
}
}
]
}
}]

Response

HTTP/1.1 200 OK
---
{
"paths": [
"resources/actors/ticket/0199a9b6-8608-7360-b98b-d2f9adeb2848",
"resources/actors/ticket/return/RE100011",
"resources/actors/ticket/return/return0"
],
"data": {
"create": "OK"
}
}

Use new to automatically generate a Ticket id or manually apply a GUID of your choice. Applying an existing GUID returns an ALREADY_EXISTS error, and using a non-GUID returns a NOT_FOUND error.

Back to Index