Session Log
Manage session activity logs.
Get Session Logs
Get a list of all activity logs for a specific session.
Endpoint
- Method: GET
- URL:
/v1/customer/sessions/{id}/log
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
| Authorization | Bearer token | Yes |
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| id | string | Session ID | Yes |
Query Parameters
| Parameter | Type | Description | Required | Default |
|---|---|---|---|---|
| per_page | integer | Number of logs per page | No | 30 |
Success Response
{
"success": true,
"message": "تم جلب البيانات بنجاح",
"data": {
"current_page": 1,
"data": [
{
"text": "Customer entered the session",
"date": "2:30 PM",
"action_type": "ENTERED"
},
{
"text": "Customer temporarily left the session",
"date": "2:35 PM",
"action_type": "LEFT"
}
],
"first_page_url": "http://example.com/path?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://example.com/path?page=1",
"links": [],
"next_page_url": null,
"path": "http://example.com/path",
"per_page": 30,
"prev_page_url": null,
"to": 2,
"total": 2
},
"statusCode": 200
}
Error Response
Session Not Found (404)
{
"success": false,
"message": "لم يتم العثور على الجلسة",
"data": null,
"statusCode": 404
}
Create Session Log
Create a new activity log entry for a session.
Endpoint
- Method: POST
- URL:
/v1/customer/sessions/{id}/log
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
| Authorization | Bearer token | Yes |
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| id | string | Session ID | Yes |
Request Body
| Parameter | Type | Description | Required | Validation |
|---|---|---|---|---|
| action_type | string | Type of action | Yes | See action types below |
Action Types
- ENTERED: Customer entered the session
- LEFT: Customer left the session
- ENDED: Session was ended
- CANCELLED: Session was cancelled
- TEMPORARILY_LEFT: Customer temporarily left the session
- CANCEL_REQUEST: Request to cancel the session
- SESSION_PERIOD: Session period record
Success Response
{
"success": true,
"message": "تم حفظ البيانات بنجاح",
"data": {
"text": "Customer entered the session",
"date": "2:30 PM",
"action_type": "ENTERED"
},
"statusCode": 200
}
Error Response
Session Not Found (404)
{
"success": false,
"message": "لم يتم العثور على الجلسة",
"data": null,
"statusCode": 404
}
Session Already Ended (422)
{
"success": false,
"message": "لايمكنك تسجيل سجل العمليات بعد انتهاء الجلسة",
"data": null,
"statusCode": 422
}
Validation Error (422)
{
"success": false,
"message": "بيانات غير صالحة",
"data": {
"action_type": [
"نوع الإجراء غير صالح"
]
},
"statusCode": 422
}
Important Notes
- Logs are automatically created for certain actions (like entering/leaving)
- Logs are displayed in chronological order
- Each log entry includes:
- Action description
- Timestamp
- Action type
- Logs cannot be created after a session has ended
- The session period is automatically recorded when the session is ended or cancelled
- Logs are paginated with a default of 30 entries per page