Skip to content

Announcement Endpoints

tkaixiang edited this page Aug 29, 2021 · 1 revision

GET /v1/announcements/list/:version

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.

Input

GET /v1/announcements/list/:version (E.g /v1/announcements/list/5)

Output

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"
}

GET /v1/announcements/list/:id

Obtains an announcement given an announcement ID

Input

GET /v1/announcements/list/:id (E.g /v1/announcements/get/6117486cc00efb423c3ad309)

Output

{
	"success": true,
        "data": {"_id": "6117486cc00efb423c3ad309", "title": title, "content": "test\nhello", "timestamp": timestamp}
}
Error Definition
not_found Announcement not found

POST /v1/announcements/create

Creates an announcement

Input

{
	"title": "announement_title",
        "content": "announcement content"
}

Output

{
	"success": true,
}

POST /v1/announcements/edit

Edits an announcement

Input

{
	"id": "6117486cc00efb423c3ad309" (announcement_id),
        "title": "content"
        "content": "announcement content"
}

Output

{
	"success": true,
}
Error Definition
not_found Announcement not found

POST /v1/announcements/delete

Deletes an announcement

Input

{
	"id": ["6117486cc00efb423c3ad309", ...] (list of announcement_ids),
}

Output

{
	"success": true,
}
Error Definition
not_found Announcement not found
validation The input was malformed