Endpoints
This page documents two GET endpoints for retrieving articles:Get Articles by Category
Get Article by ID
Both endpoints do NOT require authentication. They are publicly accessible.
Get Articles by Category
Retrieves all articles belonging to a specific category.Path Parameters
The name of the category to filter articles by (e.g., “Tech”, “Anime”)
Headers
Language preference for response messages. Supported values:
en, esResponse content type
Response
Indicates whether the request was successful
Human-readable message describing the result
Example Request
Example Response
Error Response - Not Found
Get Article by ID
Retrieves a specific article by its unique ID.Path Parameters
The unique ID of the article to retrieve
Headers
Language preference for response messages. Supported values:
en, esResponse content type
Response
Indicates whether the request was successful
Human-readable message describing the result
Example Request
Example Response
Error Response - Not Found
Implementation Notes
- The category endpoint uses a
whereHasquery to filter articles by category name - Both endpoints eager-load relationships (images, category, subcategory) for optimal performance
- Laravel’s route model binding is used for the ID endpoint for automatic 404 handling
- If no articles match the category, a 404 error is returned
Source Code References:
- Category:
ArticleController::show()at /home/daytona/workspace/source/app/Http/Controllers/ArticleController.php:149 - By ID:
ArticleController::showById()at /home/daytona/workspace/source/app/Http/Controllers/ArticleController.php:187