To get detailed information about the dishes available for sale at a given time, you need to make two requests to the r_keeper API.
- The first request is to get the Menu reference. It helps to get names, display parameters and other parameters of dishes created in r_keeper.
- The second request is to get dishes available for sale. It updates the list of dishes available for sale at a particular cash station, taking into account balances, availability period, trade groups and other restrictions that can be imposed on dishes in the r_keeper settings. This query does not return detailed information about menu items.
In order to display the list of dishes, it is necessary to select from the response to the first request only those dishes whose identifiers are contained in the response to the second one.
Request for Entire Menu
For a complete list of dishes, send an XML request:
<RK7Query> <RK7CMD CMD="GetRefData" RefName="MENUITEMS" onlyActive="1"/> </RK7Query>
In response to the request, an XML document of the following form will be returned:
The response will contain a complete list of dishes, with detailed information on each of them.
In case of an error, the XML document will not contain the RK7Reference nodes, the RK7QueryResult.ErrorText attribute will contain the error text.
To optimize the reference caching, use the RK7QueryResult.XMLVersion attribute.
If there have been any changes in the menu reference since the previous request, the value of this attribute will be different from the previous one.
Getting Dishes Available for Sale
To select only those elements from the dish reference that can currently be sold at the cash station, you should send the following request:
<RK7Query> <RK7CMD CMD="GetOrderMenu"> <Station code="1"/> </RK7CMD> </RK7Query>
In the Station.code attribute value, you should specify the code of the station for which the list of dishes will be updated.
Additionally, you can refine the list by the following parameters:
- Order
- Waiter
- Table
- OrderCategory
These properties can be added to the request in the RK7CMD node, similar to Station, however, for Order, you must use the guid attribute instead of code.
In response to the request, an XML document of the following form will be returned:
Error handling should work similar to the previous request.
The Dishes and Modifiers nodes will contain the list of dishes and modifiers, respectively, available for sale at the moment.
For each of the positions, the cost per item in kopecks will be returned in the Price attribute. Price="100" — one ruble.
For the positions that have quantity restrictions, the quantity attribute will also be returned, indicating the remainder of the dish in thousandths. That is: quantity = "1000" — One serving.
To display a list of dishes available for order, you must select from the dish reference (the first request) only those dishes that are in the order menu (the second request).
Elements can be linked using the ident attribute.