System Design Engineering / ARCHITECTURE BOUNDARIES & API DESIGN / SYS-008

Transfer API Spec

Explore concept graph

Praktik dan verifikasi mandiri

Project — Transfer API Spec

Konsep 1 / 3

Describe three transfer/account resources with stable request and response shapes and correct POST/GET semantics.

Add a separate mock transfer example with a different ID and amount, then justify 201/Location plus GET 200/404 behavior without assuming money has settled.

Kasus yang berbeda dari contoh: A new transfer with a different decimal string and owner/account IDs instead of the worked tr-001 example.

Bukti yang bisa kamu periksa

  • Concrete POST/GET path table, JSON request/response examples and a 201 Location URI consistent with the transfer ID.

Jika ingin lanjut

Classify authorization, validation and conflict errors with precise status semantics.

Jika terputus: Anchor the work in POST creation and GET retrieval contracts, then review the sample request.

Konsep 2 / 3

Select and justify 201, 400, 401, 403, 404, 409 and 500 with a consistent RFC 9457 error envelope.

Write a negative-case table for invalid JSON, no bearer token, valid token without permission, duplicate clientReference and unexpected infrastructure failure; justify each status plus problem type.

Kasus yang berbeda dari contoh: A separate matrix using different account ownership and failure detail from the worked sample.

Bukti yang bisa kamu periksa

  • At least five distinct cases matching response status, WWW-Authenticate where required and RFC 9457 body properties; no leaked stack traces.

Jika ingin lanjut

Define a compatible response evolution and verify a client designed for the older representation.

Jika terputus: Inspect the HTTP status line and Problem Details status as one consistent pair.

Konsep 3 / 3

Distinguish additive response changes from breaking schema/required-field changes and review with concrete older-client expectations.

Propose a different optional transfer metadata field, preserve all required V1 types, and demonstrate an older-client reader accepts it while rejecting a changed currency or amount type.

Kasus yang berbeda dari contoh: A new optional audit-facing or display metadata field instead of the lesson's example description.

Bukti yang bisa kamu periksa

  • A before/after response diff showing only optional metadata, passing older-client fixture, and one deliberately breaking mutation rejected by the checker.
  • A review note stating which consumer and real Spring tests are still required.

Jika ingin lanjut

Use this API contract to design a real Spring MVC controller and external contract tests in SPR-006 and TST-019.

Jika terputus: Compare V1 vs proposed V1.1 from the perspective of an already-shipped client, not only the new server.

Bandingkan dua response berikut dari perspektif client versi lama:

{
  "transferId": "tr-001",
  "amount": "125000.00",
  "currency": "IDR"
}

Versi selanjutnya menambahkan "description": "Transfer antar akun" sebagai properti opsional dan tetap mempertahankan semua field wajib lainnya. Perubahan "amount": "125000.00" menjadi "amount": 125000 adalah breaking type change. Kedua cuplikan di atas disederhanakan untuk pembahasan; full request/response tetap harus mengikuti field wajib dalam file OpenAPI.

Transfer API Spec — status, payload, and backwards compatibility

Tuliskan kontrak tiga endpoint lengkap dengan DTO, status 201/400/401/403/409/500 serta 404 untuk GET, alasan status, error Problem Details yang aman, dan perubahan optional response field yang tetap diuji pada older client.

Latihan manual — jalankan sendiri di lingkunganmu. Kriteria di bawah adalah pemeriksaan mandiri, bukan penilaian otomatis.

Kriteria selesai

  • Definisikan POST /transfers, GET /transfers/{id}, GET /accounts/{id} dengan method, path, request/response DTO dan contoh representasi.
  • Pada success POST, tunjukkan HTTP 201 Created dan Location yang sama dengan URI resource transfer baru.
  • Jelaskan alasan 400/401/403/409/500, dan 404 pada GET; 401 wajib menyertakan WWW-Authenticate Bearer challenge.
  • Gunakan application/problem+json dengan type/title/status/detail, cocokkan status body dan HTTP, tanpa stack trace/SQL/token/account secret.
  • Tunjukkan bahwa 409 clientReference collision adalah kebijakan desain, bukan bukti deduplikasi atau idempotent payment.
  • Tulis evolusi V1→V1.1 dengan satu field response opsional, pertahankan semua field required beserta tipe, dan uji minimal satu consumer lama.
  • Jalankan Node checker untuk static OpenAPI contract dan lampirkan outputnya. Jelaskan bahwa runtime Spring MVC, auth nyata dan ledger settlement memerlukan verifikasi terpisah.

Kriteria verifikasi mandiri

  • Dapat menjelaskan resource boundaries dan perbedaan POST 201 dengan GET 200/404.
  • Mampu menulis JSON request/response dan Location dari transfer yang tercipta.
  • Memilih 400/401/403/409/500 dan 404 sesuai RFC 9110, dengan Problem Details RFC 9457 yang konsisten.
  • Dapat menunjukkan proposal backward-compatible evolution dan menguji breaking change.
  • Tidak menyamakan static contract review dengan framework integration maupun settlement finansial.