Skip to main content

Get Activity Logs

curl -X GET "http://localhost:8080/api/v1/activity-logs?page=1&limit=10&entity_type=ORDER&action_type=CREATE" \
  -H "Authorization: Bearer YOUR_TOKEN"
Get a list of activity logs with filtering and pagination. This endpoint is restricted to administrators only.

Query Parameters

page
integer
default:"1"
Page number for pagination
limit
integer
default:"10"
Number of items per page (max 100)
Search term to filter logs
start_date
string
Start date filter in YYYY-MM-DD format
end_date
string
End date filter in YYYY-MM-DD format
user_id
string
Filter by user UUID
entity_type
string
Filter by entity type:
  • PRODUCT
  • CATEGORY
  • PROMOTION
  • ORDER
  • USER
  • SETTINGS
  • SHIFT
  • PAYMENT_METHOD
  • CANCELLATION_REASON
action_type
string
Filter by action type:
  • CREATE
  • UPDATE
  • DELETE
  • CANCEL
  • APPLY_PROMOTION
  • PROCESS_PAYMENT
  • REGISTER
  • UPDATE_PASSWORD
  • UPDATE_AVATAR
  • LOGIN_SUCCESS
  • LOGIN_FAILED
  • RESTORE

Response

data
object

Response Example

{
  "message": "Success",
  "data": {
    "logs": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "user_id": "660e8400-e29b-41d4-a716-446655440001",
        "user_name": "admin",
        "action_type": "CREATE",
        "entity_type": "ORDER",
        "entity_id": "770e8400-e29b-41d4-a716-446655440002",
        "details": {
          "order_type": "dine_in",
          "total_amount": 150000
        },
        "created_at": "2024-01-15T14:30:00Z"
      },
      {
        "id": "550e8400-e29b-41d4-a716-446655440003",
        "user_id": "660e8400-e29b-41d4-a716-446655440001",
        "user_name": "admin",
        "action_type": "UPDATE",
        "entity_type": "PRODUCT",
        "entity_id": "880e8400-e29b-41d4-a716-446655440004",
        "details": {
          "field_changed": "price",
          "old_value": 25000,
          "new_value": 30000
        },
        "created_at": "2024-01-15T14:25:00Z"
      }
    ],
    "total_items": 150,
    "total_pages": 15,
    "page": 1,
    "limit": 10
  }
}

Roles

Accessible by: admin only
Activity logs are automatically created by the system when users perform actions. This endpoint is read-only and provides audit trail functionality for administrators.

Build docs developers (and LLMs) love