Ticket Actor Messages
A Ticket message is a method that modifies instances of a Ticket type. To message a Ticket, send a POST request with a valid JSON body to the path /resources/actors/ticket/<TICKET ID>. <TICKET ID> is new when creating a new instance.
Valid messages for Ticket actors include:
| applyCommands | Applies a list of commands to a Ticket. You can send in several commands in one request for batch processing. However, if one command fails, the entire message fails. |
| complete | Completes a ticket |
| create | Creates a new Ticket. |
| delete | Deletes the ticket |
| query | Queries the ticket from the graph. |
| reject | Closes a Ticket and marks it as |
Every message response contains a Ticket’s access URIs, which include:
- Default GUID
- Ticket Number
- External Reference, if available
Therefore, you can also message a Ticket with its ticketNumber and externalReference using /resources/actors/ticket/<TICKET TYPE>/<TICKET NUMBER OR EXTERNAL REFERENCE>
In addition, Ticket actors support previewing messages and sending multiple messages at once.
A general template for sending a Ticket message is:
POST https://<hantera-hostname>/resources/actors/ticket/<TICKET ID>Authorization: Bearer <YOUR TOKEN>Content-Type: application/json
[{ "type": <MESSAGE TYPE>, "body": {
}}]curl -i -X POST \ https://<hantera-hostname>/resources/actors/ticket/<TICKET ID> \ -H 'Authorization: Bearer <YOUR TOKEN>' \ -H 'Content-Type: application/json' \ -d '[{ "type": <MESSAGE TYPE>, "body": {
}}]'Invoke-WebRequest `-Uri "https://<hantera-hostname>/resources/actors/ticket/<TICKET ID>" `-Method POST `-Headers @{Authorization="Bearer <YOUR TOKEN>"; 'Content-Type'="application/json"} `-Body '[{ "type": <MESSAGE TYPE>, "body": {
}}]'Ensure you send a valid JSON body and use the correct access URI to avoid common errors.
Example: Create an Item and Tag on a new Ticket
Create an Item and Tag on a new Ticket
In this example, we will apply multiple messages at once to an Exchange Ticket. The goal is to:
- Create a new Ticket
- Create an Exchange Item for it
- Add a
newTickettag to the ticket
Request
POST https://<hantera-hostname>/resources/actors/ticket/newAuthorization: Bearer <YOUR TOKEN>Content-Type: application/json
[ { "type": "create", "body": { "typeKey": "return", "externalReference": "return8" } }, { "type": "applyCommands", "body": { "commands": [ { "type": "createItem", "itemTypeKey": "exchange", "dynamic": { "message": "exchange this product" } }, { "type": "addTag", "key": "newTicket" } ] } }]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": "return8" } }, { "type": "applyCommands", "body": { "commands": [ { "type": "createItem", "itemTypeKey": "exchange", "dynamic": { "message": "exchange this product" } }, { "type": "addTag", "key": "newTicket" } ] } }]'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": "return8" } }, { "type": "applyCommands", "body": { "commands": [ { "type": "createItem", "itemTypeKey": "exchange", "dynamic": { "message": "exchange this product" } }, { "type": "addTag", "key": "newTicket" } ] } }]'Response
HTTP/1.1 200 OK---
{ "paths": [ "resources/actors/ticket/0199aa3f-31d0-7dd8-bf32-3a5fd3fd2627", "resources/actors/ticket/return/RE100015", "resources/actors/ticket/return/return8" ], "data": { "create": "OK", "applyCommands": "OK" }}