Challenge Logs
View the history of a user's answers and progress in a challenge.
List Challenge Logs
Get all logs for a specific challenge subscription.
Endpoint
- Method: GET
- URL:
/api/challenges/{id}/log
Request Headers
| Header | Value | Required |
|---|---|---|
| Accept | application/json | Yes |
| Authorization | Bearer YOUR_API_TOKEN | Yes |
URL Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | ID of the challenge subscription |
Success Response
{
"success": true,
"message": "تم جلب البيانات بنجاح",
"data": [
{
"id": 1,
"created_at": "12:00:00, 13/02/2024",
"question": "Today's question",
"day": "1",
"answer": "completed",
"notes": "Optional notes about the answer"
}
],
"status_code": 200
}
Error Responses
Unauthorized (401)
{
"success": false,
"message": "Unauthenticated",
"data": null,
"status_code": 401
}
Subscription Not Found (404)
{
"success": false,
"message": "Subscription not found",
"data": null,
"status_code": 404
}
Example Implementation Flow
View Challenge Logs
- Get the user's API token from storage
- Get subscription ID from route/state
- Make GET request to
/api/challenges/{id}/log - Upon success:
- Display list of answered questions
- Show answers and notes
- Group by days/dates
- Indicate completion status
- Upon error:
- If unauthorized (401), redirect to login
- If not found (404), show error message
- Handle expired subscriptions