cURL
curl --request GET \ --url https://api.example.com/api/post/{id}
{ "code": 123, "status": "<string>", "posts": { "id": 123, "user_id": 123, "category_id": 123, "title": "<string>", "content": "<string>", "image": "<string>", "created_at": "<string>", "updated_at": "<string>", "category": {}, "user": {} }, "message": "<string>" }
Retrieve a single blog post with its category and user information
GET /api/post/{id}
api.auth
{ "code": 200, "status": "success", "posts": { "id": 1, "user_id": 5, "category_id": 2, "title": "Introduction to Laravel", "content": "Laravel is a powerful PHP framework for building web applications. It provides elegant syntax and many features out of the box...", "image": "1678901234image.jpg", "created_at": "2026-03-01T10:30:00.000000Z", "updated_at": "2026-03-01T10:30:00.000000Z", "category": { "id": 2, "name": "Technology", "created_at": "2026-01-15T08:00:00.000000Z", "updated_at": "2026-01-15T08:00:00.000000Z" }, "user": { "id": 5, "name": "John Doe", "surname": "Smith", "email": "[email protected]", "role": "ROLE_USER", "created_at": "2026-01-01T09:00:00.000000Z", "updated_at": "2026-01-01T09:00:00.000000Z" } } }
{ "code": 404, "status": "error", "message": "La entrada no existe" }
$post = Post::find($id)->load('category')->load('user');