akf-forum/util/APIDOCS.md
Akif9748 ae83e014a0 Mongoose is fixed & optimized
The dublicate key error fixed, ids as string.
classes removed. using mongoose's magic
2022-08-09 19:16:34 +03:00

1.4 KiB

API documentation of Akf-forum

Akf-forum has got an API for other clients etc.

You can find examples in /tests folder.

Authorization

You need this headers for send request to API:

{
    "username": "testUser", 
    "password": "testPassword"
}

How to request?

Request type:

GET /api/action

"action" types:

  • GET messages/:id
  • GET users/:id
  • GET threads/:id
  • POST messages

Example request:

GET /api/message/1

Example API Output:

{
   "status": 200,
   "result":
   {       
       "content": "First message",
       "time": 1647178873587,
       "deleted": false,
       "edited": false,
       "react": {},
       "id": 1,
       "author": {
           "name": "ForumcuCocuk",
           "avatar": "/images/guest.png",
           "time": 1647177723873,
           "admin": true,
           "id": 1
       },
       "thread": {
           "author": {
               "name": "Akif9748",
               "avatar": "/images/guest.png",
               "time": 1647177705200,
               "admin": true,
               "id": 0
           },
           "title": "First Thread",
           "messages": [0, 1], 
           "time": 1647178870047,
           "deleted": false,
           "id": 0
       }   
   }
}