-
Notifications
You must be signed in to change notification settings - Fork 12
Announcement Endpoints
tkaixiang edited this page Aug 29, 2021
·
1 revision
Obtains announcements data given a version. If the version sent is outdated, the FULL announcement list is sent to the client along with the up to date announcement version.
GET /v1/announcements/list/:version (E.g /v1/announcements/list/5)
If the announcement list is outdated/non-existent on the client side
{
"success": true,
"data": [{"_id": "6117486cc00efb423c3ad309", "title": title, "content": "test\nhello", "timestamp": timestamp}] (List of announcements)
"version": 5 (latest announcement version in int)
}
If the announcement list is up to date on the client side
{
"success": true,
"data": "UpToDate"
}
Obtains an announcement given an announcement ID
GET /v1/announcements/list/:id (E.g /v1/announcements/get/6117486cc00efb423c3ad309)
{
"success": true,
"data": {"_id": "6117486cc00efb423c3ad309", "title": title, "content": "test\nhello", "timestamp": timestamp}
}
Error | Definition |
---|---|
not_found |
Announcement not found |
Creates an announcement
{
"title": "announement_title",
"content": "announcement content"
}
{
"success": true,
}
Edits an announcement
{
"id": "6117486cc00efb423c3ad309" (announcement_id),
"title": "content"
"content": "announcement content"
}
{
"success": true,
}
Error | Definition |
---|---|
not_found |
Announcement not found |
Deletes an announcement
{
"id": ["6117486cc00efb423c3ad309", ...] (list of announcement_ids),
}
{
"success": true,
}
Error | Definition |
---|---|
not_found |
Announcement not found |
validation |
The input was malformed |