Skip to main content

Hobbies List

This endpoint provides a list of available hobbies in the LAX application. The list is cached for 7 days to improve performance.

Request

Endpoint

  • Method: GET
  • URL: /api/lists/hobbies

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes

Response Format

The response will include a list of hobbies with their IDs and names in the user's preferred language (based on the Accept-Language header).

Success Response

{
"success": true,
"message": "Data has been retrieved successfully",
"data": [
{
"id": 1,
"name": "Reading"
},
{
"id": 2,
"name": "Writing"
}
],
"status_code": 200
}

Error Responses

Invalid Accept Header (406)

{
"success": false,
"message": "Not Acceptable",
"data": null,
"status_code": 406
}

Invalid Content-Type (415)

{
"success": false,
"message": "Unsupported Media Type",
"data": null,
"status_code": 415
}

Server Error (500)

{
"success": false,
"message": "Something went wrong",
"data": null,
"status_code": 500
}

Cache Behavior

The hobbies list is cached for 7 days to improve performance. The cache is automatically invalidated when:

  • A new hobby is added
  • An existing hobby is updated
  • A hobby is deleted

Example Implementation Flow

  1. Make a GET request to /api/lists/hobbies
  2. Upon success:
    • Store the hobbies list in local state
    • Use the list to populate dropdown menus or selection lists
    • Note: The list is already sorted by name
  3. Upon error:
    • Display error message to user
    • Implement retry mechanism if needed
    • Check if the error is due to invalid headers and fix accordingly