Sample JSON untuk Create OKR Key Result
Sample JSON untuk Create OKR Key Result#
Dokumen ini berisi contoh-contoh JSON yang valid untuk request POST /api/v1/okr/key-results.Field Reference#
Required Fields#
objective_id (integer) - ID dari OKR objective
job_position_id (integer) - ID dari job position
job_level_id (integer) - ID dari job level
title (string, max 255) - Judul key result
frequency (integer) - Frekuensi tracking: 0 (Weekly), 1 (Monthly), 2 (Quarterly), 3 (Yearly)
format (integer) - Format nilai: 0 (Number), 1 (Number Decimal), 2 (Percent), 3 (Percent Decimal), 4 (Currency IDR), 5-10 (Time formats)
target_value (numeric) - Nilai target yang ingin dicapai
direction (integer) - Arah: 0 (Higher is Better), 1 (Lower is Better)
aggregation (integer) - Metode agregasi: 0 (Latest), 1 (Sum), 2 (Average)
Optional Fields#
description (string) - Deskripsi detail key result
start_value (numeric) - Nilai awal (default: 0)
current_value (numeric) - Nilai saat ini (default: 0)
status (integer) - Status: 0 (Draft), 1 (Active), 2 (Done), 3 (Archived)
{
"objective_id": 1,
"job_position_id": 5,
"job_level_id": 3,
"title": "Achieve NPS score of 70",
"description": "Net Promoter Score target for Q1 2025",
"frequency": 1,
"format": 2,
"start_value": 50,
"current_value": 55,
"target_value": 70,
"status": 1,
"direction": 0,
"aggregation": 0
}
Frequency: 1 = Monthly tracking
Format: 2 = Percent (12%)
Direction: 0 = Higher is Better (semakin tinggi semakin baik)
Aggregation: 0 = Latest (gunakan nilai terbaru)
{
"objective_id": 2,
"job_position_id": 8,
"job_level_id": 5,
"title": "Achieve monthly revenue of 500 million IDR",
"description": "Monthly recurring revenue target",
"frequency": 1,
"format": 4,
"start_value": 300000000,
"current_value": 350000000,
"target_value": 500000000,
"status": 1,
"direction": 0,
"aggregation": 1
}
Format: 4 = Currency IDR (Rp 1,234)
Aggregation: 1 = Sum (jumlahkan semua nilai)
Nilai dalam Rupiah (tanpa koma)
{
"objective_id": 3,
"job_position_id": 10,
"job_level_id": 4,
"title": "Reduce average response time to 2 hours",
"description": "Customer support response time improvement",
"frequency": 0,
"format": 7,
"start_value": 4,
"current_value": 3,
"target_value": 2,
"status": 1,
"direction": 1,
"aggregation": 2
}
Frequency: 0 = Weekly tracking
Format: 7 = Time Hours (12 hrs)
Direction: 1 = Lower is Better (semakin rendah semakin baik)
Aggregation: 2 = Average (rata-rata semua nilai)
{
"objective_id": 4,
"job_position_id": 6,
"job_level_id": 2,
"title": "Increase customer base to 10,000",
"description": "Total number of active customers",
"frequency": 2,
"format": 1,
"start_value": 5000,
"current_value": 6500,
"target_value": 10000,
"status": 1,
"direction": 0,
"aggregation": 0
}
Frequency: 2 = Quarterly tracking
Format: 1 = Number Decimal (1,234.56)
{
"objective_id": 5,
"job_position_id": 7,
"job_level_id": 3,
"title": "Achieve customer satisfaction rate of 95.5%",
"description": "Customer satisfaction survey results",
"frequency": 1,
"format": 3,
"start_value": 85.5,
"current_value": 90.2,
"target_value": 95.5,
"status": 1,
"direction": 0,
"aggregation": 2
}
Format: 3 = Percent Decimal (12.34%)
Example 6: Minimal Required Fields Only#
{
"objective_id": 1,
"job_position_id": 5,
"job_level_id": 3,
"title": "Complete 100 tasks",
"frequency": 0,
"format": 0,
"target_value": 100,
"direction": 0,
"aggregation": 0
}
Hanya field required saja
start_value dan current_value akan default ke 0
status akan default ke 0 (Draft)
{
"objective_id": 6,
"job_position_id": 9,
"job_level_id": 6,
"title": "Achieve annual sales target of 1 billion",
"description": "Yearly sales revenue target",
"frequency": 3,
"format": 0,
"start_value": 800000000,
"current_value": 850000000,
"target_value": 1000000000,
"status": 1,
"direction": 0,
"aggregation": 1
}
Frequency: 3 = Yearly tracking
Format: 0 = Number (1,234)
{
"objective_id": 7,
"job_position_id": 11,
"job_level_id": 4,
"title": "Reduce processing time to 30 minutes",
"description": "Order processing time improvement",
"frequency": 1,
"format": 6,
"start_value": 60,
"current_value": 45,
"target_value": 30,
"status": 1,
"direction": 1,
"aggregation": 2
}
Format: 6 = Time Minutes (12 mins)
Direction: 1 = Lower is Better
Example 9: Draft Status (Not Yet Active)#
{
"objective_id": 8,
"job_position_id": 12,
"job_level_id": 5,
"title": "Increase website traffic by 50%",
"description": "Website monthly visitors target",
"frequency": 1,
"format": 2,
"start_value": 10000,
"current_value": 10000,
"target_value": 15000,
"status": 0,
"direction": 0,
"aggregation": 0
}
Status: 0 = Draft (belum aktif)
Bisa digunakan untuk menyimpan draft sebelum diaktifkan
Example 10: Completed Key Result#
{
"objective_id": 9,
"job_position_id": 13,
"job_level_id": 3,
"title": "Achieve 100% completion rate",
"description": "Task completion rate target",
"frequency": 0,
"format": 2,
"start_value": 80,
"current_value": 100,
"target_value": 100,
"status": 2,
"direction": 0,
"aggregation": 0
}
Status: 2 = Done (sudah selesai)
current_value sudah mencapai target_value
Frequency#
1 = Number Decimal (1,234.56)
3 = Percent Decimal (12.34%)
4 = Currency IDR (Rp 1,234)
5 = Time Seconds (12 secs)
6 = Time Minutes (12 mins)
Status#
Direction#
Aggregation#
0 = Latest (gunakan nilai terbaru)
1 = Sum (jumlahkan semua nilai)
2 = Average (rata-rata semua nilai)
cURL Examples#
Example 1: Create Key Result#
Example 2: Minimal Request#
Validation Notes#
1.
objective_id: Harus exist di database dan berada di tenant yang sama dengan user yang login
2.
job_position_id: Harus exist di tabel job_positions
3.
job_level_id: Harus exist di tabel job_levels
4.
title: Maksimal 255 karakter
5.
target_value: Harus numeric (bisa integer atau decimal)
6.
start_value dan current_value: Jika tidak disertakan, akan default ke 0
7.
status: Jika tidak disertakan, akan default ke 0 (Draft)
Common Mistakes to Avoid#
❌ Salah: Menggunakan string untuk numeric values{
"target_value": "100"
}
✅ Benar: Menggunakan number
❌ Salah: Menggunakan nilai yang tidak valid untuk constants{
"frequency": 5,
"direction": 2
}
✅ Benar: Menggunakan nilai yang valid{
"frequency": 1,
"direction": 0
}
❌ Salah: Tidak menyertakan required fields{
"title": "My Key Result",
"target_value": 100
}
✅ Benar: Menyertakan semua required fields{
"objective_id": 1,
"job_position_id": 5,
"job_level_id": 3,
"title": "My Key Result",
"frequency": 1,
"format": 0,
"target_value": 100,
"direction": 0,
"aggregation": 0
}
Modified at 2025-12-12 16:51:20