=== API RESPONSE EXAMPLES === === 1. NOTIFICATIONS ENDPOINTS === GET /api/notifications Response (200): { "status": "success", "code": 200, "data": { "data": [ { "sui_id": 1, "title": "Welcome", "text": "Welcome to our app", "package": "com.example.app", "post_time": 1623000000000, "notification_key": "abc123xyz" }, { "sui_id": 1, "title": "New Order", "text": "You have a new order", "package": "com.example.app", "post_time": 1623001000000, "notification_key": "def456xyz" } ] } } GET /api/notifications?sui_id=1 Response (200): { "status": "success", "code": 200, "data": { "data": [ { "sui_id": 1, "title": "New Message", "text": "You have a new message", "package": "com.example.app", "post_time": 1623002000000, "notification_key": "ghi789xyz" } ] } } GET /api/notifications/1 Response (200): { "status": "success", "code": 200, "data": { "sui_id": 1, "title": "Welcome", "text": "Welcome to our app", "package": "com.example.app", "post_time": 1623000000000, "notification_key": "abc123xyz" } } GET /api/notifications/999 Response (404): { "status": "error", "code": 404, "message": "Notification not found" } POST /api/notifications Request Body: { "sui_id": 1, "title": "Test Notification", "text": "This is a test", "package": "com.example.app", "post_time": 1623003000000, "notification_key": "test123" } Response (201): { "status": "success", "code": 201, "data": { "id": 9, "message": "Notification created" } } POST /api/notifications (Missing required field) Request Body: { "title": "Test" } Response (400): { "status": "error", "code": 400, "message": "sui_id required" } PUT /api/notifications/1 Request Body: { "title": "Updated Title", "text": "Updated text content" } Response (200): { "status": "success", "code": 200, "data": { "message": "Notification updated" } } DELETE /api/notifications/1 Response (200): { "status": "success", "code": 200, "data": { "message": "Notification deleted" } } === 2. LOGS ENDPOINTS === GET /api/logs Response (200): { "status": "success", "code": 200, "data": { "data": [ { "sui_id": 1, "message": "User logged in", "timestamp": 1623000000000 }, { "sui_id": 1, "message": "Product viewed", "timestamp": 1623001000000 }, { "sui_id": 2, "message": "User logged in", "timestamp": 1623002000000 } ] } } GET /api/logs?sui_id=1 Response (200): { "status": "success", "code": 200, "data": { "data": [ { "sui_id": 1, "message": "User logged in", "timestamp": 1623000000000 }, { "sui_id": 1, "message": "Product viewed", "timestamp": 1623001000000 }, { "sui_id": 1, "message": "Purchase completed", "timestamp": 1623003000000 } ] } } POST /api/logs Request Body: { "sui_id": 1, "message": "User clicked button", "timestamp": 1623004000000 } Response (201): { "status": "success", "code": 201, "data": { "id": 44, "message": "Log created" } } POST /api/logs (Missing required field) Request Body: { "sui_id": 1 } Response (400): { "status": "error", "code": 400, "message": "message required" } === 3. ERROR RESPONSES === Method Not Allowed Response (405): { "status": "error", "code": 405, "message": "Method not allowed" } Resource Not Found Response (404): { "status": "error", "code": 404, "message": "Resource not found" } Server Error Response (500): { "status": "error", "code": 500, "message": "Failed to create notification" } Connection Error (From client): { "status": "error", "message": "Connection error: Failed host lookup" } === NOTES === - Semua timestamps dalam milliseconds (bukan seconds) - sui_id adalah required field untuk notifications dan logs - ID di response adalah auto-increment dari database - Timezone: UTC/GMT - CORS enabled untuk semua origins - Content-Type harus application/json === TESTING DENGAN CURL === 1. Get all notifications: curl -X GET "https://sui.akfo.cc/api/notifications" \ -H "Content-Type: application/json" 2. Create notification: curl -X POST "https://sui.akfo.cc/api/notifications" \ -H "Content-Type: application/json" \ -d '{ "sui_id": 1, "title": "Hello", "text": "Test message", "package": "com.example.app" }' 3. Get logs by user: curl -X GET "https://sui.akfo.cc/api/logs?sui_id=1" \ -H "Content-Type: application/json" 4. Create log: curl -X POST "https://sui.akfo.cc/api/logs" \ -H "Content-Type: application/json" \ -d '{ "sui_id": 1, "message": "User action performed" }' 5. Update notification: curl -X PUT "https://sui.akfo.cc/api/notifications/1" \ -H "Content-Type: application/json" \ -d '{ "title": "Updated title" }' 6. Delete log: curl -X DELETE "https://sui.akfo.cc/api/logs/44" \ -H "Content-Type: application/json"