Skip to main content

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

HeaderValueRequired
Acceptapplication/jsonYes
AuthorizationBearer YOUR_API_TOKENYes

URL Parameters

ParameterTypeRequiredDescription
idintegerYesID 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

  1. Get the user's API token from storage
  2. Get subscription ID from route/state
  3. Make GET request to /api/challenges/{id}/log
  4. Upon success:
    • Display list of answered questions
    • Show answers and notes
    • Group by days/dates
    • Indicate completion status
  5. Upon error:
    • If unauthorized (401), redirect to login
    • If not found (404), show error message
    • Handle expired subscriptions