Presentation
This project is a REST API for a blog, providing endpoints for manage the blog. It include user authentication, blog posts, comments, and file uploads. It is designed with a focus on security, performance, and scalability.
Features
Endpoints Overview
Authentication & Registration
/BlogApi/v2/auth
| Method | Path | Fields required | Actions |
|---|---|---|---|
| POST | /register | name.last, email, password | Register a new user |
| POST | /login | email, password | Login user |
| GET | /logout | / | Logout user |
User
/BlogApi/v2/user
| Method | Path | Fields required | Actions |
|---|---|---|---|
| GET | /me | / | Get current logged-in user |
| PUT | /me | / | Update current user's password |
| GET | /search | email or firstname or role or lastname | Filter users |
| GET | / | / | Get all users |
| GET | /:id | / | Get single user by ID |
| PUT | /:id | email or firstname or lastname | Update user by ID |
Blog
/BlogApi/v2/Blog
| Method | Path | Fields required | Actions |
|---|---|---|---|
| GET | / | / | Get all blogs for online user |
| POST | / | name | Create a new blog |
| GET | /:id | / | Get blog by ID |
| PUT | /:id | name | Update blog by ID |
| DELETE | /:id | / | Delete blog by ID |
Posts
/BlogApi/v2/Blog/:id/Post
| Method | Path | Fields required | Actions |
|---|---|---|---|
| GET | / | / | Get all posts |
| POST | / | title, content | Create new post |
| GET | /me | / | Get posts for online author |
| GET | /search | title or author | Filter posts |
| GET | /:postid | / | Get single post by ID |
| PUT | /:postid | title or content | Update post by ID |
| DELETE | /:postid | / | Delete post by ID |
Comments
/BlogApi/v2/Blog/:id/Post/:postId/comment
| Method | Path | Fields required | Actions |
|---|---|---|---|
| GET | / | / | Get all comments |
| POST | / | content | Create new comment |
| GET | /:commentId | / | Get single comment by ID |
| DELETE | /:commentId | title or content | Delete comment by ID |
Photo Upload
/BlogApi/v2/upload
Filtering, Sorting, and Pagination
Filtering
Specific filters depend on the endpoint:
Sorting
Pagination
Usable Fields for Sorting and Filtering
User
Posts
Comment