2022-03-20 21:37:47 +03:00
|
|
|
# API documentation of Akf-forum
|
|
|
|
<img src="https://raw.githubusercontent.com/Akif9748/akf-forum/main/public/images/logo.jpg" align="right" width="300px" />
|
|
|
|
|
|
|
|
Akf-forum has got an API for other clients etc.
|
|
|
|
|
2022-08-11 03:12:40 +03:00
|
|
|
You can find examples in `tests` folder.
|
2022-03-20 21:37:47 +03:00
|
|
|
|
|
|
|
## Authorization
|
|
|
|
You need this headers for send request to API:
|
2022-04-03 22:03:47 +03:00
|
|
|
```json
|
2022-03-20 21:37:47 +03:00
|
|
|
{
|
|
|
|
"username": "testUser",
|
|
|
|
"password": "testPassword"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## How to request?
|
|
|
|
|
2022-08-11 01:11:07 +03:00
|
|
|
### Request types:
|
2022-08-11 03:12:40 +03:00
|
|
|
- GET `/api/users/:id` for fetch user.
|
|
|
|
- POST `/api/users/:id/delete` for delete user.
|
2022-08-11 03:48:35 +03:00
|
|
|
- POST `/api/users/:id/admin` for give admin permissions for a user.
|
|
|
|
|
2022-08-11 03:12:40 +03:00
|
|
|
- GET `/api/threads/:id` for fetch thread.
|
2022-08-11 17:55:48 +03:00
|
|
|
- GET `/api/threads/:id/messages/:limit` for fetch messages in thread.
|
2022-08-11 03:48:35 +03:00
|
|
|
- POST `/api/threads` for create thread.
|
2022-08-11 03:12:40 +03:00
|
|
|
- POST `/api/threads/:id/delete` for delete thread.
|
2022-08-11 03:48:35 +03:00
|
|
|
|
2022-08-11 03:12:40 +03:00
|
|
|
- GET `/api/messages/:id` for fetch message.
|
|
|
|
- POST `/api/messages` for create message.
|
|
|
|
- POST `/api/messages/:id/delete` for delete message.
|
|
|
|
- POST `/api/messages/:id/react/:type` for react to a message.
|
2022-03-20 21:37:47 +03:00
|
|
|
|
|
|
|
### Example request:
|
|
|
|
```GET /api/message/1```
|
|
|
|
|
|
|
|
#### Example API Output:
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"status": 200,
|
|
|
|
"result":
|
|
|
|
{
|
|
|
|
"content": "First message",
|
|
|
|
"time": 1647178873587,
|
|
|
|
"deleted": false,
|
|
|
|
"edited": false,
|
|
|
|
"react": {},
|
2022-08-11 01:11:07 +03:00
|
|
|
"id": "1",
|
2022-03-20 21:37:47 +03:00
|
|
|
"author": {
|
|
|
|
"name": "ForumcuCocuk",
|
|
|
|
"avatar": "/images/guest.png",
|
|
|
|
"time": 1647177723873,
|
|
|
|
"admin": true,
|
2022-08-11 01:11:07 +03:00
|
|
|
"id": "1"
|
2022-03-20 21:37:47 +03:00
|
|
|
},
|
2022-08-11 01:11:07 +03:00
|
|
|
"threadID":"0"
|
2022-03-20 21:37:47 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|