Example: Interact with the Order Lifecycle
Overview
Changing the status of an order is an important part of tillit as it controls the execution of activities. To correctly trigger these activity, the correct endpoint need to be utilised. It is not advised that you change the status of an order via the PUT:/core/order-instance
endpoint Instead the POST:/core/order-manager
endpoint needs to be used. Each order lifecycle state has an endpoint that you need to query to be able to succesfully move orders between.
Ready an Order
This will move an order from the NEW state to the READY state. It will only work while the order has a status of NEW.
POST:/core/order-manager/ready body: { id: 1 //ID of the order to be changed }
Start Order Changeover
This will move an order from the READY state to CHANGEOVER. It will only work while the order has a status of READY and scheduledChangeOverDuration is more than 0.
POST:/core/order-manager/changeover body: { id: 1 //ID of the order to be changed }
Start an Order
This will move an order from the READY or CHANGEOVER state to RUNNING. It will only work while the order has a status of READY or CHANGEOVER
POST:/core/order-manager/start body: { id: 1 //ID of the order to be changed }
Complete an Order
This will move an order from the RUNNING or SUSPENDED state to COMPLETE. It will only work while the order has a status of RUNNING or SUSPENDED.
POST:/core/order-manager/complete body: { id: 1 //ID of the order to be changed }
Suspend an Order
This will move an order from the RUNNING state to SUSPENDED. It will only work while the order has a status of RUNNING.
POST:/core/order-manager/suspend body: { id: 1 //ID of the order to be changed }
Resume an Order
This will move an order from the CANCELLED, SUSPENDED or COMPLETED state to RUNNING. It will only work while the order has a status of CANCELLED, SUSPENDED or COMPLETED.
POST:/core/order-manager/resume body: { id: 1 //ID of the order to be changed }
Cancel an Order
This will move an order from the READY or NEW state to CANCELLED. It will only work while the order has a status of READY or NEW.
POST:/core/order-manager/cancel body: { id: 1 //ID of the order to be changed }