API Mesin Fingerprint

BKD Provinsi Kalimantan Timur

Contoh: [[ baseUrl ]] + /api/mesin/... atau /api/face/...

Dark

Header: Authorization: Bearer <token>

โ„น๏ธ Ringkasan Endpoint

๐Ÿ“ก Koneksi Mesin

  • GET /api/mesin/cek-koneksi/by-ip?ip=xxx โ€“ Cek koneksi & sinkron waktu
  • GET /api/mesin/cek-koneksi-gateway/by-ip?gateway=xxx โ€“ Ping gateway
  • POST /api/mesin/restart-mesin?ip=xxx โ€“ Restart mesin fingerprint

๐Ÿ•’ Attendance dari Mesin

  • GET /api/mesin/by-ip?ip=xxx[&port=4370] โ€“ Semua log
  • GET /api/mesin/by-ip-tanggal?ip=xxx&tanggal=YYYY-MM-DD[&port=4370] โ€“ Per tanggal
  • GET /api/mesin/by-ip-bulan?ip=xxx&bulan=YYYY-MM[&port=4370] โ€“ Per bulan
  • GET /api/mesin/tarik-ke-temp?ip=xxx โ€“ Tarik ke temp_absensi_pegawai
  • GET /api/mesin/hapus-data?ip=xxx โ€“ Simpan & hapus dari mesin
  • GET /api/mesin/export-dat?ip=xxx โ€“ Ekspor .dat
  • POST /api/mesin/push โ€“ Terima push (text/plain)

๐Ÿงฉ Mesin (CRUD)

  • POST /api/mesin/mesin/insert โ€“ Insert (BIGINT auto-inc)
  • POST /api/mesin/mesin/upsert โ€“ Upsert by ip_mesin
  • GET /api/mesin/mesin/list?search=...&page=1&per_page=20&sort_by=...&sort_dir=...&simple=1 โ€“ List mesin (filter & pagination)
  • GET /api/mesin/mesin/<id>[?include_deleted=1] โ€“ Detail
  • PUT /api/mesin/mesin/<id> โ€“ Update mesin (partial)
  • DELETE /api/mesin/mesin/<id>[?reason=...] โ€“ Soft delete
  • POST /api/mesin/mesin/<id>/restore โ€“ Restore

๐Ÿ‘ค Face Recognition Absensi

  • GET /api/face/health โ€“ Cek status modul face recognition
  • POST /api/face/register โ€“ Register foto referensi wajah pegawai (nip, image โ€“ multipart/form-data)
  • POST /api/face/absen โ€“ Absensi via wajah (nip, jenis masuk/pulang, image, optional lat/lng)
  • POST /api/face/verify โ€“ Verifikasi dua foto (img1, img2 โ€“ multipart/form-data) atau dua link gambar (url1, url2). (opsional: nip untuk logging)
Method Path Deskripsi Auth Action
[[ e.method ]] [[ e.desc ]] [[ e.auth ? 'Bearer' : '-' ]]
Tidak ada hasil
Menampilkan [[ filtered.length ]] dari [[ endpoints.length ]] endpoint.

๐Ÿงช Contoh JSON & cURL

๐Ÿ“Ž cURL Mesin

$ curl -i -H "Authorization: Bearer <TOKEN>" "[[ baseUrl ]]/api/mesin/mesin/list?page=1&per_page=10"
$ curl -i -X POST -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" \
  -d '[[ pretty(createJson) ]]' "[[ baseUrl ]]/api/mesin/mesin/insert"
$ curl -i -X PUT -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" \
  -d '[[ pretty(updateJson) ]]' "[[ baseUrl ]]/api/mesin/mesin/123"
$ curl -i -X DELETE -H "Authorization: Bearer <TOKEN>" "[[ baseUrl ]]/api/mesin/mesin/123?reason=Mesin%20dipindahkan"

๐Ÿ‘ค cURL Face Recognition

$ curl -i "[[ baseUrl ]]/api/face/health"
$ curl -i -X POST "[[ baseUrl ]]/api/face/register" \
  -H "Authorization: Bearer <TOKEN>" \
  -F "nip=197901012005011001" \
  -F "image=@/path/ke/foto_referensi.jpg"
$ curl -i -X POST "[[ baseUrl ]]/api/face/absen" \
  -H "Authorization: Bearer <TOKEN>" \
  -F "nip=197901012005011001" \
  -F "jenis=masuk" \
  -F "lat=-0.50" \
  -F "lng=117.13" \
  -F "image=@/path/ke/selfie.jpg"
$ curl -i -X POST "[[ baseUrl ]]/api/face/verify" \
  -H "Authorization: Bearer <TOKEN>" \
  -F "nip=197901012005011001" \
  -F "img1=@/path/ke/foto1.jpg" \
  -F "img2=@/path/ke/foto2.jpg"
$ curl -i -X POST "[[ baseUrl ]]/api/face/verify" \
  -H "Authorization: Bearer <TOKEN>" \
  -F "nip=197901012005011001" \
  -F "url1=https://example.com/foto_referensi.jpg" \
  -F "url2=https://example.com/selfie_uji.jpg"

๐Ÿงฐ Playground

Request URL
[[ finalPgUrl ]]
Status
[[ pgStatus ]]
Response (JSON)
[[ JSON.stringify(pgJson, null, 2) ]]
Response (Text)
[[ pgText ]]

๐Ÿ“ท Face Playground (Camera + GPS + Register + Verify)

1๏ธโƒฃ Absensi via Wajah (Kamera + GPS) โ†’ /api/face/absen

Koordinat akan dikirim sebagai lat dan lng ke /api/face/absen.

Pastikan sudah capture foto dari kamera sebelum mengirim.

Status
[[ face.status ]]

Kamera

Kamera belum aktif. Klik Start Camera.

Preview Foto Ter-capture

Preview foto
Belum ada foto. Aktifkan kamera dan klik Capture Frame.
Response (JSON)
[[ JSON.stringify(face.json, null, 2) ]]
Response (Text)
[[ face.text ]]

2๏ธโƒฃ Register & Verifikasi Wajah via API

๐Ÿ‘ค Register Wajah โ†’ /api/face/register

Gunakan untuk menyimpan foto referensi wajah pegawai (1 kali per pegawai).
Body: nip, image (multipart/form-data).

Jika "Gunakan foto hasil Capture Frame" dicentang, sistem akan mengirim foto dari kamera sebagai image. Jika tidak, gunakan upload file biasa.

Status
[[ register.status ]]
Response (JSON)
[[ JSON.stringify(register.json, null, 2) ]]
Response (Text)
[[ register.text ]]

๐Ÿ” Verifikasi 2 Foto โ†’ /api/face/verify

Bandingkan dua foto wajah (bukan absensi), misalnya testing threshold.
Body bisa berupa:
- img1, img2 (file, multipart/form-data), atau
- url1, url2 (link gambar).
Opsional: nip untuk keperluan logging.

Mode Input

Backend akan mendownload gambar dari URL tersebut lalu melakukan face verification.

Status
[[ verify.status ]]
Response (JSON)
[[ JSON.stringify(verify.json, null, 2) ]]
Response (Text)
[[ verify.text ]]
[[ toast ]]