เริ่มต้นอย่างรวดเร็ว
1. ลงทะเบียนเพื่อขอสิทธิ์ใช้งาน
ก่อนเริ่มใช้งาน Consent Management API คุณต้องลงทะเบียนขอสิทธิ์ใช้งานก่อน:
- กรอกแบบฟอร์มลงทะเบียน: https://forms.office.com/r/0nFLVmS5U4
- รอรับ credentials: ทีมงานจะสร้างและส่งข้อมูลต่อไปนี้ให้คุณ:
- Alias
- Password สำหรับ login
2. รับ API Key
หลังลงทะเบียนแล้ว คุณสามารถสร้าง x-api-key ได้ด้วยตนเองผ่าน Consentrix Backoffice
3. ตรวจสอบการเชื่อมต่อ
curl -sS "https://consent-service-uat.odd.works/api/v1/health"
หากเรียกสำเร็จ ระบบจะตอบกลับเป็น JSON ที่มีฟิลด์ status และ success
4. ดึง published template version
แทนที่ YOUR_KEY ด้วย API key จริงของคุณ:
curl -sS \
-H "x-system-api-key: YOUR_KEY" \
"https://consent-service-uat.odd.works/api/v1/consent-templates/YOUR_TEMPLATE_CODE/latest"
ตัวอย่าง response เมื่อเรียก สำเร็จ:
{
"data": {
"consent_version_id": "123e4567-e89b-12d3-a456-426614174010",
"version": 1,
"tag": "1.0.0",
"content_html": "<html>...</html>",
"file_url": "https://example.com/content.html",
"allow_reconsent": true
}
}
ลองเรียก Get latest consent template version API ↩
5. ส่งการตัดสินใจเรื่องความยินยอม
curl -sS -X POST \
-H "Content-Type: application/json" \
-H "x-system-api-key: YOUR_KEY" \
"https://consent-service-uat.odd.works/api/v1/customers/CUSTOMER_ID/consents/decisions" \
-d '{
"consent_version_id": "123e4567-e89b-12d3-a456-426614174010",
"decision": "given"
}'
ลองเรียก Submit consent decision API ↩
6. Errors
รูปแบบ error response:
{
"code": "1002",
"message": "Unauthorized."
}
ดูรายละเอียด error codes ทั้งหมดได้ที่ API conventions
Base URL
UAT: https://consent-service-uat.odd.works/
API Endpoints
| Method | Path | Purpose |
|---|---|---|
GET | /health | ตรวจสอบสถานะระบบ |
GET | /v1/consent-templates/{template_code}/latest | ดึง published template ล่าสุด |
POST | /v1/customers/{customer_id}/consents/decisions | ส่งการตัดสินใจ |