3.0 KiB
3.0 KiB
Contacts Module (HEMS)
Endpoint listing
GET /api/v1/contacts?role=pilotGET /api/v1/contacts?role=pilot&pilot_category=freelanceGET /api/v1/contacts?role=pilot&pilot_category=dry_leaseGET /api/v1/contacts?role=doctorGET /api/v1/contacts?role=air_rescuerGET /api/v1/contacts?role=technicianGET /api/v1/contacts?role=flight_assistantGET /api/v1/contacts?role=staff
Sensitive action flow (PIN)
- Client memanggil endpoint sensitif.
- API balas
202dan memberi tahuactionPIN yang dibutuhkan. - Client verifikasi PIN ke
/api/v1/auth/pin/verify. - Backend mengembalikan token verifikasi singkat.
- Client kirim ulang request sensitif dengan header
X-PIN-Verification-Token.
Contoh payload
1) Create pilot
{
"data": {
"type": "contact_pilot_create",
"attributes": {
"role_id": "<ROLE_ID_PILOT>",
"email": "pilot1@hems.local",
"username": "pilot1",
"first_name": "Marco",
"last_name": "Pilot",
"mobile_phone": "+62811111111",
"timezone": "Asia/Jakarta",
"pilot": {
"pilot_category": "freelance",
"short_name": "M. Pilot",
"license_no": "LIC-P-1001",
"has_ifr_qualification": true,
"total_flight_minutes": 12500,
"location": "Jakarta"
}
}
}
}
2) Update doctor
{
"data": {
"type": "contact_doctor_update",
"attributes": {
"is_active": true,
"doctor": {
"short_name": "dr. Ana",
"medical_license_no": "DOC-7788",
"specialization": "Anesthesiology",
"is_chief_physician": false
}
}
}
}
Rule:
data.typewajib mengikuti role, mis.contact_pilot_create,contact_air_rescuer_create,contact_staff_update.- Hanya satu object profile role yang boleh dikirim, dan harus sesuai dengan
data.type.
3) PIN verify sebelum aksi sensitif
{
"data": {
"type": "auth_pin_verify",
"attributes": {
"pin": "123456",
"action": "31f8bb88-a95f-43be-8fd8-129e1355d6a5"
}
}
}
4) Response 202 saat PIN dibutuhkan
{
"data": {
"type": "pin_verification_required",
"attributes": {
"required": true,
"action": "31f8bb88-a95f-43be-8fd8-129e1355d6a5",
"method": "pin",
"status": 202
}
}
}
5) List response ringkas
{
"data": {
"type": "contacts",
"attributes": {
"items": [
{
"id": "0195f43e-5030-7d2a-8b8a-020063f5ab03",
"role_code": "pilot",
"role_name": "pilot",
"pilot_category": "dry_lease",
"username": "pilot_dl_1",
"email": "pilot.dl1@hems.local",
"first_name": "Rama",
"last_name": "Wijaya",
"short_name": "R. Wijaya",
"license_no": "LIC-P-9988",
"location": "Surabaya",
"mobile_phone": "+62822222222",
"is_active": true
}
],
"meta": {
"total": 1,
"limit": 20,
"offset": 0
}
}
}
}