Articles on: Developer

How to use Order Logging API

Hyra Order Logging API: Developer's Guide



Overview



The Hyra Order Logging API is an advanced, real-time solution for monitoring and managing the lifecycle of an order. It offers comprehensive visibility from the moment an order is placed to when it's ready for pickup, tracking each participant involved.

Features at a Glance



Real-time Updates: Monitor the status of orders as they progress.
Advanced Search: Retrieve orders using various filters such as username, user ID, and more.
Dynamic Order Statuses: Reflect the current state of an order with statuses tailored to your system's workflow.

Hyra API Workflow Diagram

Ready-Made Scripts



To streamline integration, we offer the HandTo System by r_r, a pre-built script solution.


Order Statuses Explained


Different systems may require specific statuses. Below is a list of statuses you can use:

- handed_to: For handover events in Hand-To systems.
- submitted: Indicates a cashier has placed the order.
- waiting_for_preparation: The order is queued for preparation.
- finding_new_colleague: Assigning a new preparer if the original one is unavailable.
- preparing: The order is actively being prepared.
- completed: The order has been finished and is ready to be delivered.
- cancelled: The order has been aborted.

For pickup systems, waiting_for_pickup is also available.


API Integration in Roblox



Module Requirement



For single-script systems, import the API module as follows:

local orderLog = require(15254660066)


For multi-script systems, avoid multiple API logins by setting up an exporter module. Refer to our detailed Exporter Module tutorial


Utilizing the API



Authentication



To authenticate, input your unique apiKey and workspaceId at the beginning of your main script:

orderLog.setupAPI(apiKey: string, workspaceId: string)



Creating an Order



To log a new order, input the customer and actor as player objects, along with an argument table that can include an array of items and the initial status.

orderLog.createOrder(customer, actor, {
	items = {"item 1", "item 2"},
	status = "waiting_for_preparation",
})


You'll receive a response with details like error, order_number, and id. Store the id for updating the order status.


Order Status Updates


Utilize the order id to modify the status through methods such as setWaiting, setPreparing, or setComplete.

Set order to Waiting for Preparation


Description: Sets an order status to waiting for preparation. For example, when it's waiting for a chef to pick up the order and prepare it.
Syntax: orderLog.setWaiting("orderId")

#--Example: set order to waiting for preparation
orderLog.setWaiting("653db4bb1e3727cc1851ac07")


Set order to Preparing


Description: Sets an order status to preparing. For example, when it's being prepared by a chef.
Syntax: orderLog.setPreparing("orderId", preparedBy)

#--Example: set order to preparing
orderLog.setPreparing("653db4bb1e3727cc1851ac07", game.Players.Roblox)


Set order to finding a new colleague


Description: Sets an order status to finding a new colleague. For example, when the chef that was preparing it left the game.
Syntax: orderLog.setReprepare("orderId")

#--Example: set order to repreparing
orderLog.setPreparing("653db4bb1e3727cc1851ac07")


Set order to ready for pickup


Description: Sets an order status to be ready for pickup. For example, once the order is ready to be delivered
Syntax: orderLog.setReadyForPickup("orderId")

#--Example: set order to ready for pick up
orderLog.setReadyForPickup("653db4bb1e3727cc1851ac07")


Set order to complete


Description: Sets an order status to completed. For example, once the order has been completed
Syntax: orderLog.setComplete("orderId")

#--Example: set order to completed
orderLog.setComplete("653db4bb1e3727cc1851ac07")


Set order to cancelled


Description: Sets an order status to cancelled. For example, if the order could not be completed.
Syntax: orderLog.setCancelled("orderId")

#--Example: set order to cancelled
orderLog.setCancelled("653db4bb1e3727cc1851ac07")



Support and Assistance



Our specialist developer support team is ready to assist you with any queries. Reach out via our support chat for personalized help.

Updated on: 06/11/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!