API Documentation
Post
API endpoints related to post.
Post (list)
GET http://<kono-api server>/api/v1/post
Retrieve a list of posts, providing the filters and pagination.
Query Parameters
filter_type
string
Type of posts to retrieve. Only "notice" or "lostfound" values are allowed.
start_index
number
The response contains the latest posts, starting from the start_index-th one. Default value is 0 if not provided. Should be larger or equal than 0.
max_size
number
Maximum number of posts to retrieve. Should be larger than 0 and lesser or equal than 64.
[
{
"sid": <number, sid of the post, NOT NULL>,
"type": "notice" | "lostfound",
"title_kr": <string, korean title of the post>,
"title_en": <string, english title of the post>,
"created_time": <timestamp of the created time, NOT NULL>,
"thumbnail": <post에 이미지가 딸려 있다면 첫 번째 이미지의 URL, 없으면 null>
}
]// invalid query
{
"msg": "invalid <query variable name>"
}
// parameter not provided
{
"msg": "<query variable name> required"
}{
"msg": "server error"
}Post (single)
GET http://<kono-api server>/api/v1/post/:sid
Retrieve a single post with detailed information.
Path Parameters
sid
number
sid of the post to retrieve.
Post (count)
GET http://<kono-api server>/api/v1/post/count
Retrieve the number of posts of each type, notice or lostfound.
Image
API endpoints related to image.
Image (list)
GET http://<kono-api server>/api/v1/image
Retrieve the list of images attached to existing posts, providing the filters and pagination.
Query Parameters
filter_type
string
Type of posts to retrieve. Only notice and lostfound values are allowed.
start_index
number
The response contains images from the latest posts, starting from the start_index-th image. Should be larger or equal than 0.
max_size
number
Maximum number of images to retrieve. Should be larger than 0 and lesser or equal than 64.
Image (count)
GET http://<kono-api server>/api/v1/image/count
Retrieve the number of images attached to posts of each type, notice or lostfound.
Room
API endpoints related to room states.
Create
POST http://<kono-api server>/api/v1/room
Add a (room_number, state) record. Authorization via GET /api/v1/auth/login (with valid access_token cookie) is required.
Query Parameters
room_number
number
Room number of the room to add record. Should be an integer larger or equal than 1.
state
number
0 for empty, 1 for using
Recent (single)
GET http://<kono-api server>/api/v1/room/recent/:room_number
Retrieve the most recent record of the specific room.
Path Parameters
room_number
number
The index of the room to retrieve state. Should be an integer larger or equal than 1.
Recent (list)
GET http://<kono-api server>/api/v1/room/recent
Retrieve the most recent records of all existing rooms.
Auth
Login
POST http://<kono-api server>/api/v1/auth/login
Administrator login.
Request Body
password
string
Should match the password predefined or previously set by the user.
Logout
POST http://<kono-api server>/api/v1/auth/logout
Logout from the server. Should be already logged in.
Check
GET http://<kono-api server>/api/v1/auth/check
Check if this user is logged in.
Change password
PUT http://<kono-api server>/api/v1/auth/password
Update the user's own password.
Request Body
password
string
New password. Should be a string no longer than 20 characters.
Noti
Retrieve
GET http://<kono-api server>/api/v1/noti
Retrieve the list of active notifications.
Query Parameters
max_size
number
Maximum number of notifications to retrieve. Should be larger than 0 and less or equal than 64.
Create
POST http://<kono-api server>/api/v1/noti
Create a notification. The user should be logged in.
Request Body
noti_kr
string
Notification content (in korean). Should be no longer than 40 characters.
noti_en
string
Notification content (in english). Should be no longer than 80 characters.
Update
PUT http://<kono-api server>/api/v1/noti/:sid
Update a notification of given sid. The user should be logged in.
Path Parameters
sid
number
sid of the notification to update.
Request Body
noti_kr
string
Noti content in korean to update. Should be no longer than 40 characters.
noti_en
string
Noti content in english to update. Should be no longer than 80 characters.
Delete
DELETE http://<kono-api server>/api/v1/noti/:sid
Delete a notification with given sid. The user should be logged in.
Path Parameters
sid
number
sid of a notification to delete.
Last updated
Was this helpful?