Notification Routes
GET /api/notification/:user_id
Return an array of notifications of a user.
| Name | Type | Description | |
|---|---|---|---|
| Params | user_id | String | JHED_ID |
| Output | Notification[] | Empty if user_id is invalid or the user does not have any notifications. |
Sample Output
[
{
"user_id": "qwu29",
"message": "You have created a plan!",
"quick_link_id": "61cd000b723b840004850eb5",
"link_type": "PLAN",
"read": false,
"date": "2021-12-31T00:40:43.334Z"
},
{
"user_id": "qwu29",
"message": "Welcome to uCredit!",
"read": true,
"date": "2021-12-30T22:43:08.305Z"
}
]
POST /api/notification
Creates a notification.
| Name | Type | Description | ||
|---|---|---|---|---|
| Body | user_id | String | JHED_ID | |
| message | String | message to the user | ||
| quick_link_id(opt) | String | id of an object the message is referred to | ||
| link_type(opt) | enum:["PLAN", "REVIEW", "USER"] | |||
| Output | Notification | Created Notification with date as the current time and read as false. |
Sample Output
{
"user_id": "qwu29",
"message": "You have created a plan!",
"quick_link_id": "61cd000b723b840004850eb5",
"link_type": "PLAN",
"read": false,
"date": "2021-12-31T00:40:43.334Z"
}
POST /api/notification/read/:notification_id
Change the status of the read field of a notification to true.
| Name | Type | Description | |
|---|---|---|---|
| Params | notification_id | String | |
| Output | Notification | read becomes true. |
Sample Output
{
"user_id": "qwu29",
"message": "Welcome to uCredit!",
"read": true,
"date": "2021-12-30T22:43:08.305Z"
}
DELETE /api/notifications/:notification_id
Deletes a notification.
| Name | Type | Description | |
|---|---|---|---|
| Params | notification_id | String | |
| Output | Notification | `The deleted notification object. |
Sample Output
{
"user_id": "qwu29",
"message": "You have created a plan!",
"quick_link_id": "61cd000b723b840004850eb5",
"link_type": "PLAN",
"read": false,
"date": "2021-12-31T00:40:43.334Z"
}