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
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
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
- Make a GET request to
/api/lists/hobbies - 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
- Upon error:
- Display error message to user
- Implement retry mechanism if needed
- Check if the error is due to invalid headers and fix accordingly