Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/microservices-patterns/ftgo-application/llms.txt

Use this file to discover all available pages before exploring further.

The Order Service REST API is available at http://localhost:8082. It manages the full lifecycle of a customer order — from initial placement through cancellation or revision — and coordinates with downstream services via domain events.

POST /orders

Creates a new order for a consumer at a specific restaurant. The service validates the consumer, the restaurant, and each line item before persisting the order and returning its assigned ID.

Request body

consumerId
number
required
The ID of the consumer placing the order.
restaurantId
number
required
The ID of the restaurant fulfilling the order.
deliveryTime
string
required
The requested delivery time in ISO-8601 local date-time format, e.g. 2024-11-15T18:30:00.
deliveryAddress
object
required
The address to deliver the order to.
lineItems
array
required
One or more items to include in the order.

Response

orderId
number
The unique identifier assigned to the newly created order.

Status codes

CodeMeaning
200 OKOrder created successfully.

Example

curl -s -X POST http://localhost:8082/orders \
  -H "Content-Type: application/json" \
  -d '{
    "consumerId": 1,
    "restaurantId": 2,
    "deliveryTime": "2024-11-15T18:30:00",
    "deliveryAddress": {
      "street1": "1 Main Street",
      "street2": "",
      "city": "Oakland",
      "state": "CA",
      "zip": "94612"
    },
    "lineItems": [
      { "menuItemId": "beef-burger", "quantity": 2 }
    ]
  }'

GET /orders/

Retrieves the current state and total of an existing order.

Path parameters

orderId
number
required
The unique ID of the order to retrieve.

Response

orderId
number
The unique identifier of the order.
state
string
Current state of the order. One of APPROVAL_PENDING, APPROVED, REJECTED, CANCEL_PENDING, CANCELLED, REVISION_PENDING.
orderTotal
object
The monetary total of the order.

Status codes

CodeMeaning
200 OKOrder found and returned.
404 Not FoundNo order exists with the given orderId.

Example

curl -s http://localhost:8082/orders/1

POST /orders//cancel

Cancels an existing order. The service transitions the order through CANCEL_PENDING and eventually to CANCELLED via the saga pattern.

Path parameters

orderId
number
required
The unique ID of the order to cancel.

Response

orderId
number
The unique identifier of the order.
state
string
Updated state of the order after the cancel request. Typically CANCEL_PENDING immediately after the call.
orderTotal
object
The monetary total of the order.

Status codes

CodeMeaning
200 OKCancel request accepted.
404 Not FoundNo order exists with the given orderId.

Example

curl -s -X POST http://localhost:8082/orders/1/cancel

POST /orders//revise

Revises the line items of an existing order. Replaces the current quantities for the specified menu items. The order must be in a revisable state.

Path parameters

orderId
number
required
The unique ID of the order to revise.

Request body

revisedOrderLineItems
array
required
The updated list of order line items. Each entry replaces the quantity for the given menu item.

Response

orderId
number
The unique identifier of the order.
state
string
Updated state of the order. Typically REVISION_PENDING immediately after the call.
orderTotal
object
The revised monetary total of the order.

Status codes

CodeMeaning
200 OKRevision request accepted.
404 Not FoundNo order exists with the given orderId.

Example

curl -s -X POST http://localhost:8082/orders/1/revise \
  -H "Content-Type: application/json" \
  -d '{
    "revisedOrderLineItems": [
      { "menuItemId": "beef-burger", "quantity": 3 }
    ]
  }'

Build docs developers (and LLMs) love