Integration workflows
The paths on this page are relative to
/api/v1/workspaces/{workspaceId}. All the shell examples use cm_api,
workspace_api and cocktail_id from the
quickstart. Use a test workspace: the
queue example creates a real order and a real statistic.
Send an order to the bar and record it as made
Use a dedicated key with COCKTAILS_READ, QUEUE_CREATE, QUEUE_READ,
QUEUE_UPDATE, QUEUE_DELETE and STATISTICS_CREATE for the complete flow
below. Omit QUEUE_DELETE if the client never cancels a queued item. For a
multi-client setup, grant each client only the steps it performs. Add
STATISTICS_READ only if the client also needs to read the statistic logs.
| Step | Request | Permission |
|---|---|---|
| Find a recipe and read its details | GET /cocktails, GET /cocktails/{cocktailId} | COCKTAILS_READ |
| Add items | POST /queue/add | QUEUE_CREATE |
| Read the bar queue | GET /queue | QUEUE_READ |
| Mark one item in progress | PUT /queue/{queueItemId} | QUEUE_UPDATE |
| Record one preparation and reconcile the queue | POST /statistics/cocktails/add | STATISTICS_CREATE |
| Cancel a queued item without logging it as made | POST /queue/remove | QUEUE_DELETE |
Use the recipe id from the list or detail read. For this example, choose a
note unique to the test order. Add returns an array of items in data
even when amount is one. Each item has its own id, a cocktail reference
with id and name, nullable notes, inProgress, and createdAt.
note='Integration test order 01' # Change for each test order
order_body=$(jq -nc --arg id "$cocktail_id" --arg note "$note" \
'{cocktailId: $id, notes: $note, amount: 1}')
order=$(cm_api "$workspace_api/queue/add" \
--header 'Content-Type: application/json' --data-binary "$order_body")
queue_item_id=$(jq -er '.data[0].id | select(type == "string")' <<<"$order")
Run the steps in order and stop if any command fails. amount defaults to
one and accepts an integer from 1 to 50; notes are limited to 500 characters.
Add and remove trim notes and treat blank or "-" as no note.
Read the queue to confirm the order, then update the queue item ID, not the recipe ID:
cm_api "$workspace_api/queue" |
jq -e --arg id "$queue_item_id" '.data[] | select(.id == $id)'
cm_api --request PUT "$workspace_api/queue/$queue_item_id" \
--header 'Content-Type: application/json' \
--data-binary '{"inProgress":true}' | jq -e '.data'
When the drink is actually made, log it using the exact stored note:
made_body=$(jq -nc --arg id "$cocktail_id" --arg note "$note" \
'{cocktailId: $id, notes: $note, actionSource: "integration-test"}')
cm_api "$workspace_api/statistics/cocktails/add" \
--header 'Content-Type: application/json' --data-binary "$made_body" |
jq -e '.data | {id, date, cocktail, actionSource}'
The statistic write and queue reconciliation are in one transaction.
Completion matches the oldest queue item with that cocktail and note;
it does not accept a queue item ID and does not prioritize inProgress.
With notes: "-", it targets an item with no note. Without a note selector,
if noted items for that cocktail exist, the server reports
400 STATISTIC_QUEUE_AMBIGUOUS rather than choosing one for you. A statistic
can still be recorded if there is no matching item, so a successful
statistic response is not proof that a specific order was removed.
ignoreQueue: true deliberately records a statistic without changing the
queue. Check GET /queue after completion if you need to confirm removal.
For a cancellation, use POST /queue/remove with {"cocktailId":"…","notes":"…"}
instead. It removes the oldest matching item, returns it in data, and
returns 404 if none matches. It does not log a preparation.
Do not call both remove and log for the same preparation as a routine
completion flow: that can consume two items.
Add, remove and log are not idempotent. If a request times out, reconcile against the queue and any accessible statistic logs instead of replaying it blindly. Keep your own order correlation and deduplication state; queue notes are not an API idempotency key.
Move selected recipes to another workspace
Use recipe export when you need specific recipes and their dependencies, not a snapshot of the whole workspace. Use separate keys for source and destination; don't send a source key to the destination.
- With
COCKTAILS_READin the source, sendPOST /cocktails/export/jsonwith{"cocktailIds":["…"]}. Save the raw JSON response as-is; it includes referenced inventory and embedded images. A list/detaildataresponse is not an import file. - On the destination, use the app's Manage → Cocktails → Import/Export
tools to import the file and review proposed matches, or call
POST /cocktails/import/jsonwithCOCKTAILS_CREATE. Send the saved dump asexportDataand setphasetovalidate, thenprepare-mapping.validatechecks the file;prepare-mappingcompares it with the destination workspace. Neither phase writes. Forvalidate, check the raw response'svalidflag as well as the HTTP status. - Review the destination's proposed
autoMappingsandcocktailConflicts. Sendphase: "execute"with the sameexportDataand the reviewedmappingDecisions. Each dependency decision identifies the originalexportIdand either a destinationexistingId(use-existing) orcreate-new. Cocktail decisions areimport,skip,rename(withnewName), oroverwrite(with a destinationoverwriteId). Include decisions for the referenced dependencies and, to import every exported cocktail, a decision for each exported cocktail. The destination workspace key also needsCOCKTAILS_UPDATEforoverwrite. Inspect the raw result and any warnings, then reread the destination recipes to check the result.
Review mappings in the app if in doubt. An overwrite changes the target
recipe, not the source, and an import can create new IDs; refresh local ID
mappings afterward. For printable output, POST /cocktails/export/pdf
accepts selected cocktailIds and returns a PDF rather than an importable
file. PDF export requires the configured Chromium service.
For broader content moves and recovery, see Backups, imports and restore and Workspace backup automation.