Message: ticket.create
Back to IndexCreates a new Ticket.
Schema
Body
typeKey | string Type of ticket to create. |
commands | array of command (optional) An array of ticket commands to be applied upon creation. If any command fail, the ticket will not be created. |
externalReference | string (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. |
createdAt | any 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:
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/newAuthorization: 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" } } ] }}]curl -i -X POST \ https://<hantera-hostname>/resources/actors/ticket/new \ -H 'Authorization: Bearer <YOUR TOKEN>' \ -H 'Content-Type: application/json' \ -d '[{ "type": "create", "body": { "typeKey": "return", "externalReference": "return0", "commands": [ { "type": "createItem", "itemTypeKey": "exchange", "dynamic": { "message": "pls exchange this item" } } ] }}]'Invoke-WebRequest `-Uri "https://<hantera-hostname>/resources/actors/ticket/new" `-Method POST `-Headers @{Authorization="Bearer <YOUR TOKEN>"; 'Content-Type'="application/json"} `-Body '[{ "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.