mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-22 12:00:41 +03:00
Better APIDOCS
This commit is contained in:
parent
52386a58e4
commit
abf5c14475
1 changed files with 38 additions and 38 deletions
76
APIDOCS.md
76
APIDOCS.md
|
@ -1,6 +1,4 @@
|
||||||
# API documentation of Akf-forum
|
# 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 AJAX, other clients etc.
|
Akf-forum has got an API for AJAX, other clients etc.
|
||||||
|
|
||||||
## Authorization
|
## Authorization
|
||||||
|
@ -19,51 +17,53 @@ But in front end, the API will works with session.
|
||||||
- 5 - 128 char for thread titles.
|
- 5 - 128 char for thread titles.
|
||||||
- 5 - 1024 char for messages.
|
- 5 - 1024 char for messages.
|
||||||
|
|
||||||
## How to request?
|
You can change them in config.json.
|
||||||
|
|
||||||
|
## How to request?
|
||||||
### Request types:
|
### Request types:
|
||||||
|
#### `/api/me`
|
||||||
- GET `/api/me` to get your account.
|
- GET `/api/me` to get your account.
|
||||||
|
|
||||||
|
#### `/api/bans`
|
||||||
|
- GET `/` fetch all bans.
|
||||||
|
- GET `/:ip` fetch a ban.
|
||||||
|
- DELETE `/:ip` for unban an IP adress.
|
||||||
|
- POST `/?reason=flood` for ban an IP adress.
|
||||||
|
|
||||||
- GET `/api/bans/` fetch all bans.
|
#### `/api/categories`
|
||||||
- GET `/api/bans/:ip` fetch a ban.
|
- GET `/` fetch all categories.
|
||||||
- DELETE `/api/bans/:ip` for unban an IP adress.
|
- GET `/:id` fetch a category
|
||||||
- POST `/api/bans?reason=flood` for ban an IP adress.
|
- PATCH `/:id` for update a category.
|
||||||
|
- DELETE `/:id` for delete a category.
|
||||||
|
- POST `/` for create a category.
|
||||||
|
|
||||||
|
#### `/api/messages`
|
||||||
|
- GET `/:id` for fetch message.
|
||||||
|
- DELETE `/:id` for delete message.
|
||||||
|
- PATCH `/:id` for edit message.
|
||||||
|
- POST `/:id/undelete` for undelete message.
|
||||||
|
- POST `/:id/react/:type` for react to a message.
|
||||||
|
- POST `/` for create message.
|
||||||
|
|
||||||
|
|
||||||
- GET `/api/categories/` fetch all categories.
|
#### `/api/search` use `?limit=&skip=` for skip and limit
|
||||||
- GET `/api/categories/:id` fetch a category
|
- GET `/users?q=query` find users.
|
||||||
- PATCH `/api/categories/:id` for update a category.
|
- GET `/threads?q=query&authorID=not_required` find threads.
|
||||||
- DELETE `/api/categories/:id` for delete a category.
|
- GET `/messages?q=query&authorID=not_required` find messages.
|
||||||
- POST `/api/categories` for create a category.
|
|
||||||
|
|
||||||
|
#### `/api/threads`
|
||||||
|
- GET `/:id` for fetch thread.
|
||||||
|
- DELETE `/:id` for delete thread.
|
||||||
|
- PATCH `/:id` for edit thread.
|
||||||
|
- POST `/:id/undelete` for undelete thread.
|
||||||
|
- GET `/:id/messages?skip=0&limit=10` for fetch messages in thread.
|
||||||
|
- POST `/` for create thread.
|
||||||
|
|
||||||
- GET `/api/messages/:id` for fetch message.
|
#### `/api/users`
|
||||||
- DELETE `/api/messages/:id/` for delete message.
|
- GET `/:id` for fetch user.
|
||||||
- PATCH `/api/messages/:id/` for edit message.
|
- DELETE `/:id` for delete user.
|
||||||
- POST `/api/messages/:id/undelete` for undelete message.
|
- PATCH `/:id` for edit user.
|
||||||
- POST `/api/messages/:id/react/:type` for react to a message.
|
- PUT `/:id` for add profile photo to user.
|
||||||
- POST `/api/messages` for create message.
|
|
||||||
|
|
||||||
|
|
||||||
**use ?limit&skip for skip and limit**
|
|
||||||
- GET `/api/search/users?q=query` find users.
|
|
||||||
- GET `/api/search/threads?q=query&authorID=not_required` find threads.
|
|
||||||
- GET `/api/search/messages?q=query&authorID=not_required` find messages.
|
|
||||||
|
|
||||||
|
|
||||||
- GET `/api/threads/:id` for fetch thread.
|
|
||||||
- DELETE `/api/threads/:id/` for delete thread.
|
|
||||||
- PATCH `/api/threads/:id/` for edit thread.
|
|
||||||
- POST `/api/threads/:id/undelete` for undelete thread.
|
|
||||||
- GET `/api/threads/:id/messages?skip=0&limit=10` for fetch messages in thread.
|
|
||||||
- POST `/api/threads` for create thread.
|
|
||||||
|
|
||||||
|
|
||||||
- GET `/api/users/:id` for fetch user.
|
|
||||||
- DELETE `/api/users/:id/` for delete user.
|
|
||||||
- PATCH `/api/users/:id/` for edit user.
|
|
||||||
- PUT `/api/users/:id/` for add profile photo to user.
|
|
||||||
|
|
||||||
### Example request:
|
### Example request:
|
||||||
GET ```/api/messages/0```
|
GET ```/api/messages/0```
|
||||||
|
|
Loading…
Reference in a new issue