akf-forum/util/APIDOCS.md

58 lines
1.2 KiB
Markdown
Raw Normal View History

# 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-04-03 22:03:47 +03:00
You can find examples in `/tests` folder.
## Authorization
You need this headers for send request to API:
2022-04-03 22:03:47 +03:00
```json
{
"username": "testUser",
"password": "testPassword"
}
```
## How to request?
2022-08-11 01:11:07 +03:00
### Request types:
- GET `/api/users/:id`
- POST `/api/threads`
2022-08-11 01:11:07 +03:00
- GET `/api/threads/:id`
- POST `/api/threads/:id/delete`
- GET `/api/messages/:id`
- POST `/api/messages`
- POST `/api/messages/:id/delete`
2022-08-11 01:11:07 +03:00
- POST `/api/messages/:id/react/:type`
### 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",
"author": {
"name": "ForumcuCocuk",
"avatar": "/images/guest.png",
"time": 1647177723873,
"admin": true,
2022-08-11 01:11:07 +03:00
"id": "1"
},
2022-08-11 01:11:07 +03:00
"threadID":"0"
}
}
```