Emotional Map Logs
Manage and retrieve emotional map logs.
Create Log
Create a new emotional log entry for the current day. Users can record their emotions, select multiple sub-emotions and reasons, and add optional notes to track their emotional state throughout their journey.
Endpoint
- Method: POST
- URL:
/api/emotional-map/{id}/create-log
URL Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | The subscription ID |
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
| Authorization | Bearer YOUR_API_TOKEN | Yes |
Request Body
{
"emotion_id": 1,
"sub_emotions": [1, 2],
"emotion_reasons": [1, 2],
"notes": "Optional notes about the emotion"
}
Success Response
{
"success": true,
"message": "تم إنشاء البيانات بنجاح",
"data": {
"id": 1,
"user_id": 1,
"subscription_id": 1,
"emotion_id": 1,
"date": "2025-02-13",
"notes": "Optional notes about the emotion",
"created_at": "2025-02-13T13:00:00.000000Z",
"updated_at": "2025-02-13T13:00:00.000000Z"
},
"status_code": 201
}
Error Responses
Not Found (404)
{
"success": false,
"message": "لم يتم العثور على الاشتراك",
"data": null,
"status_code": 404
}
Validation Error (422)
{
"success": false,
"message": "البيانات المدخلة غير صالحة",
"data": {
"emotion_id": ["حقل المشاعر مطلوب"],
"sub_emotions": ["حقل المشاعر الفرعية مطلوب"],
"sub_emotions.0": ["المشاعر الفرعية المحددة غير موجودة"],
"emotion_reasons": ["حقل أسباب المشاعر مطلوب"],
"emotion_reasons.0": ["أسباب المشاعر المحددة غير موجودة"],
"notes": ["يجب أن تكون الملاحظات نصاً"]
},
"status_code": 422
}
Unauthorized (401)
{
"success": false,
"message": "Unauthenticated.",
"data": null,
"status_code": 401
}
Get Logs By Date
Retrieve detailed emotional log entries for a specific date. This endpoint returns all emotions logged on the given date, including their sub-emotions, reasons, and timestamps.
Endpoint
- Method: GET
- URL:
/api/emotional-map/{id}/logs
URL Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | The subscription ID |
| date | string | Yes | Date in format Y-m-d |
Success Response
{
"success": true,
"message": "تم جلب البيانات بنجاح",
"data": [
{
"id": 1,
"time": "13:00",
"emotion": "Happy",
"color": "#FFD700",
"sub_emotions": ["Joyful", "Excited"],
"emotion_reasons": ["Work", "Family"],
"notes": "Optional notes"
}
],
"status_code": 200
}
Error Responses
Not Found (404)
{
"success": false,
"message": "لم يتم العثور على الاشتراك",
"data": null,
"status_code": 404
}
Unauthorized (401)
{
"success": false,
"message": "Unauthenticated.",
"data": null,
"status_code": 401
}
Get Logs List
Get a comprehensive list of emotional logs grouped by date. This endpoint provides a chronological view of the user's emotional journey, making it easy to track patterns and changes over time.
Endpoint
- Method: GET
- URL:
/api/emotional-map/{id}/logs-list
URL Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | The subscription ID |
Success Response
{
"success": true,
"message": "تم جلب البيانات بنجاح",
"data": [
{
"date": "13/02/2025",
"emotions": [
{
"id": 1,
"time": "13:00",
"emotion": "Happy",
"color": "#FFD700",
"sub_emotions": ["Joyful", "Excited"],
"emotion_reasons": ["Work", "Family"],
"notes": "Optional notes"
}
]
}
],
"status_code": 200
}
Error Responses
Not Found (404)
{
"success": false,
"message": "لم يتم العثور على الاشتراك",
"data": null,
"status_code": 404
}
Unauthorized (401)
{
"success": false,
"message": "Unauthenticated.",
"data": null,
"status_code": 401
}
Seed Account
Seed emotional map data for testing purposes. This endpoint is only available in the testing environment.
Endpoint
GET /api/emotional-map/seed
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| string | Email of the user to seed data for |
Success Response
{
"success": true,
"message": "تم جلب البيانات بنجاح",
"data": {
"status": "success",
"message": "Account seeded successfully"
},
"status_code": 200
}
Error Responses
Not Testing Environment (400)
{
"success": false,
"message": "not testing environment",
"data": null,
"status_code": 400
}
User Not Found (404)
{
"success": false,
"message": "user not found",
"data": null,
"status_code": 404
}
Implementation Flow
-
Create Log:
- Validate request data
- Check subscription status
- Create emotional map log
- Sync sub-emotions and reasons
-
Get Logs:
- Verify subscription exists
- Filter logs by date if provided
- Format response with emotions and details
-
List Logs:
- Group logs by date
- Include emotion details and metadata
- Format timestamps appropriately