Skip to content

Instantly share code, notes, and snippets.

@defrindr
Created May 24, 2026 06:21
Show Gist options
  • Select an option

  • Save defrindr/032de4be2dad13674f63e97a5d8a830c to your computer and use it in GitHub Desktop.

Select an option

Save defrindr/032de4be2dad13674f63e97a5d8a830c to your computer and use it in GitHub Desktop.

Parking API — Error & Success Response Examples

Error Responses (400 Bad Request)

CARD_UNKNOWN — Card/account not found

{
  "code": 400,
  "errorCode": "PARKING_CARD_UNKNOWN",
  "message": "Akun tidak ditemukan. Pastikan accountId valid dan sudah terdaftar di sistem."
}

Alternative — employee not found by number:

{
  "code": 400,
  "errorCode": "PARKING_CARD_UNKNOWN",
  "message": "Pegawai tidak ditemukan. Pastikan nomor pegawai benar."
}

EXPIRED — Expired/inactive account

{
  "code": 400,
  "errorCode": "PARKING_EXPIRED",
  "message": "Akun tidak aktif atau masa aktif sudah habis. Hubungi admin jika ini tidak sesuai."
}

Alternative — guest visit expired:

{
  "code": 400,
  "errorCode": "PARKING_EXPIRED",
  "message": "Masa berlaku kunjungan tamu sudah habis atau belum aktif. Periksa tanggal kunjungan (valid until)."
}

DOUBLE_TAP — Already inside

Parking IN when already inside:

{
  "code": 400,
  "errorCode": "PARKING_DOUBLE_TAP",
  "message": "Akses ditolak: akun masih tercatat berada di dalam area parkir. Silakan lakukan parkir keluar terlebih dahulu."
}

TAP_IN_REQUIRED — No active IN record for OUT

{
  "code": 400,
  "errorCode": "PARKING_TAP_IN_REQUIRED",
  "message": "Akses ditolak: akun tidak tercatat berada di dalam area parkir. Pastikan sudah melakukan parkir masuk."
}

FORBIDDEN_ACCESS — No permission for this gate

Guest no gate access:

{
  "code": 400,
  "errorCode": "PARKING_FORBIDDEN_ACCESS",
  "message": "Akses parkir untuk tamu tidak tersedia di gate ini. Pastikan gate sudah di-assign ke kunjungan."
}

Exit gate not allowed:

{
  "code": 400,
  "errorCode": "PARKING_FORBIDDEN_ACCESS",
  "message": "Akses ditolak: gate keluar ini tidak termasuk gate keluar yang diizinkan untuk transaksi parkir ini. Gunakan gate keluar yang sesuai."
}

UNKNOWN_ERROR — Validation / gate / internal errors

{
  "code": 400,
  "errorCode": "PARKING_UNKNOWN_ERROR",
  "message": "Gate tidak ditemukan atau tidak aktif. Pastikan gateIdentifier atau gateId benar."
}

Alternative — wrong gate direction:

{
  "code": 400,
  "errorCode": "PARKING_UNKNOWN_ERROR",
  "message": "Gate ini tidak dikonfigurasi untuk parkir masuk. Periksa konfigurasi gate (parkingAccessType)."
}

Alternative — DTO validation failure:

{
  "code": 400,
  "errorCode": "PARKING_UNKNOWN_ERROR",
  "message": "gateId must be a UUID",
  "errors": [
    { "field": "gateId", "message": "gateId must be a UUID" }
  ]
}

Alternative — history log failure:

{
  "code": 400,
  "errorCode": "PARKING_UNKNOWN_ERROR",
  "message": "Gagal menyimpan riwayat: gateIdentifier atau gateId tidak valid. Pastikan payload gate benar."
}

Success Responses (200 OK)

IN_SUCCESS (20001) — Parking IN

{
  "code": 200,
  "successCode": 20001,
  "message": "Berhasil masuk parkir.",
  "data": {
    "id": "uuid-history",
    "accountId": "uuid-account",
    "accountIdentifier": "EMP001",
    "accountName": "John Doe",
    "gateIdentifier": 1,
    "gateId": "uuid-gate",
    "gateName": "Gate A",
    "cardUid": "ABCD1234",
    "companyName": "PT Example",
    "department": "IT",
    "status": "success",
    "message": "BERHASIL MASUK",
    "orderId": "parking_1712345678_abc123",
    "moreDetails": {
      "module": "parking",
      "type": "IN",
      "direction": "IN",
      "orderId": "parking_1712345678_abc123",
      "image": [],
      "allowedExitGates": ["2", "3"],
      "allowedExitDeviceIds": ["DEV002", "DEV003"]
    },
    "timestamp": "2026-05-24T10:30:00.000Z",
    "syncAt": null,
    "state": "INSIDE"
  }
}

OUT_SUCCESS (20002) — Parking OUT

{
  "code": 200,
  "successCode": 20002,
  "message": "Berhasil keluar parkir.",
  "data": {
    "id": "uuid-history",
    "accountId": "uuid-account",
    "accountIdentifier": "EMP001",
    "accountName": "John Doe",
    "gateIdentifier": 1,
    "gateId": "uuid-gate",
    "gateName": "Gate A",
    "cardUid": "ABCD1234",
    "companyName": "PT Example",
    "department": "IT",
    "status": "success",
    "message": "BERHASIL KELUAR",
    "orderId": "parking_1712345678_abc123",
    "moreDetails": {
      "module": "parking",
      "type": "OUT",
      "direction": "OUT",
      "orderId": "parking_1712345678_abc123",
      "image": []
    },
    "timestamp": "2026-05-24T10:35:00.000Z",
    "syncAt": null,
    "state": "OUTSIDE"
  }
}

STATE_FETCHED (20003) — Parking state

{
  "code": 200,
  "successCode": 20003,
  "message": "Status parkir berhasil diambil.",
  "data": {
    "employeeNo": "EMP001",
    "accountId": "uuid-account",
    "state": "INSIDE",
    "orderId": "parking_1712345678_abc123",
    "lastIn": {
      "id": "uuid-history",
      "accountId": "uuid-account",
      "accountIdentifier": "EMP001",
      "accountName": "John Doe",
      "gateIdentifier": 1,
      "gateId": "uuid-gate",
      "gateName": "Gate A",
      "cardUid": "ABCD1234",
      "companyName": "PT Example",
      "department": "IT",
      "status": "success",
      "message": "BERHASIL MASUK",
      "orderId": "parking_1712345678_abc123",
      "moreDetails": {},
      "timestamp": "2026-05-24T10:30:00.000Z",
      "syncAt": null
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment