Orders

5 endpointówTylko po angielsku

Read an order

get/orders/{orderId}experimentalWymagana sesja

Responds 403 when the caller is not a member of the order's workshop and 404 when no such order exists.

Parametry ścieżki

NazwaTypWymaganeOgraniczeniaOpis
orderIdstringTak-Order id

Odpowiedzi

  • 200Success
    PoleTypWymaganeOgraniczeniaOpis
    orderOrderTak-An order as returned to a member: title, customer name and notes are edited in place through this same shape, status changes are recorded in statusHistory.
    Przykład
    {
      "order": {
        "id": "order-1",
        "workshopId": "workshop-1",
        "title": "Oak dining table",
        "customerName": "Anna Kowalska",
        "notes": "Six chairs to match, deliver by the 20th.",
        "status": "in_progress",
        "createdAt": "2026-08-01T09:00:00.000Z",
        "lastActivityAt": "2026-08-10T14:30:00.000Z",
        "statusHistory": [
          {
            "status": "todo",
            "at": "2026-08-01T09:00:00.000Z"
          },
          {
            "status": "in_progress",
            "at": "2026-08-10T14:30:00.000Z"
          }
        ]
      }
    }
  • 401Not authenticated

    Brak treści.

  • 403Forbidden

    Brak treści.

  • 404Not found

    Brak treści.

Przykładowe żądanie

curl -X GET 'https://mercastra.cloud/api/orders/<orderId>' \
  -H 'Cookie: session=<session cookie>'

Update an order's title, customer name or notes

patch/orders/{orderId}experimentalWymagana sesja

Updates any subset of title, customerName and notes; at least one is required, the body is strict and an unknown field is a 400. None of these three fields counts as order activity: lastActivityAt and statusHistory are untouched by this endpoint. Responds 403 when the caller is not a member of the order's workshop and 404 when no such order exists.

Parametry ścieżki

NazwaTypWymaganeOgraniczeniaOpis
orderIdstringTak-Order id

Treść żądania

PoleTypWymaganeOgraniczeniaOpis
titlestringNieminLength: 1maxLength: 250pattern: "^[^\\p{Cc}]*
quot;
-
customerNamestringNiemaxLength: 250pattern: "^[^\\p{Cc}]*
quot;
-
notesstringNiemaxLength: 5000-
Przykład
{
  "notes": "Six chairs to match, deliver by the 20th."
}

Odpowiedzi

  • 200Success
    PoleTypWymaganeOgraniczeniaOpis
    idstringTak--
    workshopIdstringTak--
    titlestringTak--
    customerNamestringTak-Blank when the order has no named customer
    notesstringTak--
    statusOrderStatusTak-An order's stage, always one of these three values in this order: todo, in_progress, done.
    createdAtstringTakformat: "date-time"-
    lastActivityAtstringTakformat: "date-time"-
    statusHistoryarray of OrderStatusHistoryEntryTak--
    Przykład
    {
      "id": "order-1",
      "workshopId": "workshop-1",
      "title": "Oak dining table",
      "customerName": "Anna Kowalska",
      "notes": "Six chairs to match, deliver by the 20th.",
      "status": "in_progress",
      "createdAt": "2026-08-01T09:00:00.000Z",
      "lastActivityAt": "2026-08-10T14:30:00.000Z",
      "statusHistory": [
        {
          "status": "todo",
          "at": "2026-08-01T09:00:00.000Z"
        },
        {
          "status": "in_progress",
          "at": "2026-08-10T14:30:00.000Z"
        }
      ]
    }
  • 400The request body does not match the schema

    Wspólna treść błędu walidacji, zobacz Błędy walidacji.

  • 401Not authenticated

    Brak treści.

  • 403Forbidden

    Brak treści.

  • 404Not found

    Brak treści.

Przykładowe żądanie

curl -X PATCH 'https://mercastra.cloud/api/orders/<orderId>' \
  -H 'Cookie: session=<session cookie>' \
  -H 'X-CSRF-Token: <csrf-token cookie value>' \
  -H 'Content-Type: application/json' \
  -d '{"notes":"Six chairs to match, deliver by the 20th."}'

Change an order's status

patch/orders/{orderId}/statusexperimentalWymagana sesja

Appends a statusHistory entry timestamped now and sets lastActivityAt to the same moment. Responds 403 when the caller is not a member of the order's workshop and 404 when no such order exists.

Parametry ścieżki

NazwaTypWymaganeOgraniczeniaOpis
orderIdstringTak-Order id

Treść żądania

PoleTypWymaganeOgraniczeniaOpis
statusOrderStatusTak-An order's stage, always one of these three values in this order: todo, in_progress, done.
Przykład
{
  "status": "done"
}

Odpowiedzi

  • 200Success
    PoleTypWymaganeOgraniczeniaOpis
    idstringTak--
    workshopIdstringTak--
    titlestringTak--
    customerNamestringTak-Blank when the order has no named customer
    notesstringTak--
    statusOrderStatusTak-An order's stage, always one of these three values in this order: todo, in_progress, done.
    createdAtstringTakformat: "date-time"-
    lastActivityAtstringTakformat: "date-time"-
    statusHistoryarray of OrderStatusHistoryEntryTak--
    Przykład
    {
      "id": "order-1",
      "workshopId": "workshop-1",
      "title": "Oak dining table",
      "customerName": "Anna Kowalska",
      "notes": "Six chairs to match, deliver by the 20th.",
      "status": "done",
      "createdAt": "2026-08-01T09:00:00.000Z",
      "lastActivityAt": "2026-08-10T14:30:00.000Z",
      "statusHistory": [
        {
          "status": "todo",
          "at": "2026-08-01T09:00:00.000Z"
        },
        {
          "status": "in_progress",
          "at": "2026-08-10T14:30:00.000Z"
        }
      ]
    }
  • 400The request body does not match the schema

    Wspólna treść błędu walidacji, zobacz Błędy walidacji.

  • 401Not authenticated

    Brak treści.

  • 403Forbidden

    Brak treści.

  • 404Not found

    Brak treści.

Przykładowe żądanie

curl -X PATCH 'https://mercastra.cloud/api/orders/<orderId>/status' \
  -H 'Cookie: session=<session cookie>' \
  -H 'X-CSRF-Token: <csrf-token cookie value>' \
  -H 'Content-Type: application/json' \
  -d '{"status":"done"}'

List a workshop's orders

get/workshops/{workshopId}/ordersexperimentalWymagana sesja

Returns every order belonging to the workshop. Responds 403 when the caller is not a member of the workshop; there is no 404 for an unknown workshop id, a non-member sees 403 either way.

Parametry ścieżki

NazwaTypWymaganeOgraniczeniaOpis
workshopIdstringTak-Workshop id

Odpowiedzi

  • 200Success
    PoleTypWymaganeOgraniczeniaOpis
    ordersarray of OrderTak--
    Przykład
    {
      "orders": [
        {
          "id": "order-1",
          "workshopId": "workshop-1",
          "title": "Oak dining table",
          "customerName": "Anna Kowalska",
          "notes": "Six chairs to match, deliver by the 20th.",
          "status": "in_progress",
          "createdAt": "2026-08-01T09:00:00.000Z",
          "lastActivityAt": "2026-08-10T14:30:00.000Z",
          "statusHistory": [
            {
              "status": "todo",
              "at": "2026-08-01T09:00:00.000Z"
            },
            {
              "status": "in_progress",
              "at": "2026-08-10T14:30:00.000Z"
            }
          ]
        }
      ]
    }
  • 401Not authenticated

    Brak treści.

  • 403Forbidden

    Brak treści.

Przykładowe żądanie

curl -X GET 'https://mercastra.cloud/api/workshops/<workshopId>/orders' \
  -H 'Cookie: session=<session cookie>'

Create an order in a workshop

post/workshops/{workshopId}/ordersexperimentalWymagana sesja

Creates a new order with status todo and an empty notes field. `customerName` defaults to an empty string when omitted, an order can have no named customer. Responds 403 when the caller is not a member of the workshop; there is no 404 for an unknown workshop id, a non-member sees 403 either way. The body is not strict, an unknown field is silently dropped rather than rejected.

Parametry ścieżki

NazwaTypWymaganeOgraniczeniaOpis
workshopIdstringTak-Workshop id

Treść żądania

PoleTypWymaganeOgraniczeniaOpis
titlestringTakminLength: 1maxLength: 250pattern: "^[^\\p{Cc}]*
quot;
-
customerNamestringNiemaxLength: 250pattern: "^[^\\p{Cc}]*
quot;
-
Przykład
{
  "title": "Oak dining table",
  "customerName": "Anna Kowalska"
}

Odpowiedzi

  • 201Created
    PoleTypWymaganeOgraniczeniaOpis
    idstringTak--
    workshopIdstringTak--
    titlestringTak--
    customerNamestringTak-Blank when the order has no named customer
    notesstringTak--
    statusOrderStatusTak-An order's stage, always one of these three values in this order: todo, in_progress, done.
    createdAtstringTakformat: "date-time"-
    lastActivityAtstringTakformat: "date-time"-
    statusHistoryarray of OrderStatusHistoryEntryTak--
    Przykład
    {
      "id": "order-1",
      "workshopId": "workshop-1",
      "title": "Oak dining table",
      "customerName": "Anna Kowalska",
      "notes": "Six chairs to match, deliver by the 20th.",
      "status": "in_progress",
      "createdAt": "2026-08-01T09:00:00.000Z",
      "lastActivityAt": "2026-08-10T14:30:00.000Z",
      "statusHistory": [
        {
          "status": "todo",
          "at": "2026-08-01T09:00:00.000Z"
        },
        {
          "status": "in_progress",
          "at": "2026-08-10T14:30:00.000Z"
        }
      ]
    }
  • 400The request body does not match the schema

    Wspólna treść błędu walidacji, zobacz Błędy walidacji.

  • 401Not authenticated

    Brak treści.

  • 403Forbidden

    Brak treści.

Przykładowe żądanie

curl -X POST 'https://mercastra.cloud/api/workshops/<workshopId>/orders' \
  -H 'Cookie: session=<session cookie>' \
  -H 'X-CSRF-Token: <csrf-token cookie value>' \
  -H 'Content-Type: application/json' \
  -d '{"title":"Oak dining table","customerName":"Anna Kowalska"}'