Skip to content

Example Requests

morad1998 edited this page Oct 17, 2026 · 1 revision

Example Requests

Introduction

This page contains representative API request and response examples used throughout the Quality Inspection System.

The examples are simplified for documentation purposes and focus on illustrating how business documents flow through the application.


Retrieve Inspection Card

Request

GET /api/cards/1001

Example Response

{
  "cardId": 1001,
  "workOrder": "WO-10001",
  "status": "OPEN",
  "inspector": "INSPECTOR",
  "measurements": [
    {
      "measurementId": 1,
      "name": "Pressure",
      "value": 120
    }
  ],
  "checklist": [
    {
      "checkId": 1,
      "description": "Visual Inspection",
      "result": "PASS"
    }
  ]
}

List Inspection Cards

Request

GET /api/cards

Example Response

[
  {
    "cardId": 1001,
    "status": "OPEN"
  },
  {
    "cardId": 1002,
    "status": "CLOSED"
  }
]

Update Inspection Card

Request

PUT /api/cards/1001
{
  "status": "IN_PROGRESS"
}

Example Response

{
  "message": "Inspection card updated successfully"
}

Close Inspection Card

Request

POST /api/cards/1001/close

Example Response

{
  "cardId": 1001,
  "status": "CLOSED"
}

Retrieve Measurements

Request

GET /api/cards/1001/measurements

Example Response

[
  {
    "measurementId": 1,
    "name": "Pressure",
    "value": 120
  }
]

Retrieve Findings

Request

GET /api/cards/1001/findings

Example Response

[
  {
    "findingId": 1,
    "severity": "MEDIUM",
    "description": "Cosmetic defect"
  }
]

Explain Inspection Card (AI)

Request

POST /api/ai/explain-card
{
  "cardId": 1001
}

Example Response

{
  "summary": "The inspection card represents a completed quality inspection with all mandatory checks successfully passed."
}

Generate Work Order Report (AI)

Request

POST /api/ai/work-order-report
{
  "workOrder": "WO-10001"
}

Example Response

{
  "report": "Work order inspection summary generated successfully."
}

Manufacturing Statistics (AI)

Request

POST /api/ai/statistics
{
  "period": "monthly"
}

Example Response

{
  "totalInspections": 150,
  "passed": 140,
  "failed": 10,
  "passRate": 93.3
}

Error Example

Request

GET /api/cards/99999

Example Response

{
  "error": "Inspection card not found"
}

Concurrency Conflict Example

Request

PUT /api/cards/1001

Example Response

{
  "error": "Resource has been modified by another user"
}

HTTP Status:

412 Precondition Failed

API Design Philosophy

The API follows several principles:

  • Business-oriented endpoints
  • JSON document exchange
  • Optimistic locking
  • Consistent error handling
  • AI integration
  • Minimal transformation logic

The API works naturally with JSON Duality Views and document-centric business entities.


Related Pages

Clone this wiki locally