Endpoint QR
Referensi lengkap untuk endpoint manajemen QR code.
URL Dasar
https://api.govalid.org/api/v1/qr/
Daftar QR Code
GET /api/v1/qr/
Parameter Query
| Parameter | Tipe | Deskripsi |
|---|---|---|
page | integer | Nomor halaman (default: 1) |
page_size | integer | Hasil per halaman (default: 20, maks: 100) |
qr_type | string | Filter berdasarkan tipe (url, document, certificate, dll.) |
security_level | string | Filter berdasarkan level (smart, verified, secure, enterprise) |
status | string | Filter berdasarkan status (active, expired, removed) |
Respons
{
"count": 150,
"next": "https://api.govalid.org/api/v1/qr/?page=2",
"previous": null,
"results": [
{
"id": "abc123",
"title": "Sertifikat Produk",
"qr_type": "certificate",
"security_level": "verified",
"status": "active",
"scan_count": 45,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-20T14:22:00Z"
}
]
}
Buat QR Code
POST /api/v1/qr/
Body Request
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
title | string | Ya | Judul QR code |
qr_type | string | Ya | Tipe: url, text, email, phone, vcard, document, certificate, goods |
content | string | Kondisional | Konten (wajib untuk tipe url, text, email, phone) |
security_level | string | Tidak | smart, verified, secure, enterprise (default: smart) |
metadata | object | Tidak | Field metadata kustom |
password | string | Tidak | Proteksi password |
expires_at | datetime | Tidak | Tanggal kedaluwarsa (ISO 8601) |
Contoh Request
{
"title": "Sertifikat Produk #001",
"qr_type": "certificate",
"security_level": "verified",
"metadata": {
"product_name": "Kopi Organik",
"batch": "BATCH-2025-001",
"origin": "Aceh, Indonesia"
}
}
Respons
{
"id": "abc123",
"title": "Sertifikat Produk #001",
"qr_type": "certificate",
"security_level": "verified",
"qr_image": "https://api.govalid.org/media/qr/abc123.png",
"short_url": "https://govalid.org/q/abc123",
"verification_url": "https://govalid.org/v/abc123",
"metadata": {
"product_name": "Kopi Organik",
"batch": "BATCH-2025-001",
"origin": "Aceh, Indonesia"
},
"created_at": "2025-01-29T12:00:00Z"
}
Dapatkan Detail QR Code
GET /api/v1/qr/{id}/
Respons
{
"id": "abc123",
"title": "Sertifikat Produk #001",
"qr_type": "certificate",
"security_level": "verified",
"status": "active",
"scan_count": 45,
"unique_scans": 30,
"qr_image": "https://api.govalid.org/media/qr/abc123.png",
"short_url": "https://govalid.org/q/abc123",
"metadata": { ... },
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-20T14:22:00Z"
}
Update QR Code
PATCH /api/v1/qr/{id}/
Body Request
Field apapun dari request create dapat diupdate.
Hapus QR Code
DELETE /api/v1/qr/{id}/
Dapatkan Riwayat Scan
GET /api/v1/qr/{id}/scans/
Respons
{
"count": 45,
"results": [
{
"scanned_at": "2025-01-29T15:30:00Z",
"location": {
"country": "ID",
"city": "Jakarta"
},
"device": "mobile",
"platform": "iOS",
"is_first_scan": false
}
]
}
Dapatkan Analitik
GET /api/v1/qr/{id}/analytics/
Respons
{
"total_scans": 150,
"unique_scans": 89,
"scans_today": 12,
"scans_this_week": 45,
"top_locations": [
{"country": "US", "count": 50},
{"country": "ID", "count": 35}
],
"scan_timeline": [
{"date": "2025-01-28", "count": 15},
{"date": "2025-01-29", "count": 12}
],
"device_breakdown": {
"mobile": 120,
"desktop": 30
}
}
Buat QR Code Massal
POST /api/v1/qr/bulk/
Body Request
{
"qr_codes": [
{"title": "Produk 1", "qr_type": "product", "sku": "SKU001"},
{"title": "Produk 2", "qr_type": "product", "sku": "SKU002"},
{"title": "Produk 3", "qr_type": "product", "sku": "SKU003"}
]
}
Transfer QR
Mulai Transfer
POST /api/v1/qr/{id}/transfer/
Setujui Transfer
POST /api/v1/qr/{id}/transfer/approve/
Tolak Transfer
POST /api/v1/qr/{id}/transfer/reject/
Batalkan Transfer
POST /api/v1/qr/{id}/transfer/cancel/
Terkait
- Panduan QR Codes - Panduan pengguna untuk fitur QR
- Level Keamanan - Memahami tier keamanan
- Contoh Kode - Kasus penggunaan umum