-
Notifications
You must be signed in to change notification settings - Fork 3
REST API
Items that are not checked as "Optional" are required fields.
Get requests by user or group. See the Authorization section for more information on default behaviour.
Field | Type | Description | Optional |
---|---|---|---|
start_date |
Date |
Bookings from this date. | ✔️ |
group |
string |
The ID of the group that will be representing this request. | ✔️ |
end_date |
Date |
Bookings before this day | ✔️ |
room |
string |
The room number of the booking | ✔️ |
For administrators, this request returns all active future requests by default (i.e., when no parameters are supplied).
For students, this request returns all active future requests of any groups the user is a part of.
If successful, this endpoint returns an HTTP 200 code with a Request
array.
If a student tries to access other users' or groups' requests, the endpoint will return HTTP 403.
Creates a request under a group.
Parameters are not required for this API route.
This HTTP request can only be performed by members of the group specified in the group
parameter.
Field | Type | Description | Optional |
---|---|---|---|
group |
string |
The ID of the group that will be representing this request. | |
start_date |
Date |
The start date for the booking | |
end_date |
Date |
The end date for the booking | |
description |
string |
Description of the booking | |
title |
string |
The title of the booking | |
room |
string |
The room number of the booking |
If successful, this endpoint returns an HTTP 200 code with the newly created Request
object.
If the user is not part of the supplied group, HTTP 403 is returned.
If the start_date
is after end_date
HTTP 400 is returned.
Get request info given a request ID.
Do not supply request parameters with this endpoint.
For staff or for students within the requests' group.
If successful, this endpoint returns an HTTP 200 code with the Request
object specified.
If the user does not have permission to view this request, then this endpoint returns HTTP 403. It will return HTTP 404 if the request ID does not exist.
Delete a request given a request ID.
Do not supply request parameters with this endpoint.
Only managers of the group to which the request belongs, the author of the request, and administrators may delete the request.
If successful, this endpoint returns an HTTP 200 code.
If the user does not have permission to delete this request, then this endpoint returns HTTP 403. It will return HTTP 404 if the request ID does not exist.
Modify a request given its ID.
Field | Type | Description | Optional |
---|---|---|---|
start_date |
Date |
The start date for the booking | ✔️ |
group |
string |
The ID of the group that will be representing this request. | ✔️ |
end_date |
Date |
The end date for the booking | ✔️ |
description |
string |
Description of the booking | ✔️ |
title |
string |
The title of the booking | ✔️ |
room |
string |
The room number of the booking | ✔️ |
Approve a booking request
Field | Type | Description | Optional |
---|---|---|---|
reason |
string |
The reason for the approval |
Only approvers with the requisite permission can call this endpoint.
If successful, this endpoint returns an HTTP 200 code.
If the user does not have permission to approve this request, then this endpoint returns HTTP 403. It will return HTTP 404 if the request ID does not exist. It also returns HTTP 400 if the group does not exist.
Deny a booking request
Field | Type | Description | Optional |
---|---|---|---|
reason |
string |
The reason for the denial |
Only approvers with the requisite permission can call this endpoint.
If successful, this endpoint returns an HTTP 200 code.
If the user does not have permission to deny this request, then this endpoint returns HTTP 403. It will return HTTP 404 if the request ID does not exist. It also returns HTTP 400 if the group does not exist.
Cancel a booking request
Do not supply request parameters with this endpoint.
Only approvers with the requisite permission, group managers, or the author of the request can call this endpoint.
If successful, this endpoint returns an HTTP 200 code.
If the user does not have permission to approve this request, then this endpoint returns HTTP 403. It will return HTTP 404 if the request ID does not exist. It also returns HTTP 400 if the group does not exist.
Get the current user info (based on who is currently logged in)
Parameters are not required for this API route.
Can be used by anyone authenticated by Shibboleth.
this endpoint returns an HTTP 200 code with the requested Account
object.
Get a list of everyone with the approver
role.
Parameters are not required for this API route.
Can be used by anyone authenticated by Shibboleth.
this endpoint returns an HTTP 200 code with the requested Account
object.
Get the user info of a certain user.
Parameters are not required for this API route.
Can only be used by admins.
this endpoint returns an HTTP 200 code with the requested Account
object or an HTTP 403 if the user lacks permissions.
Change the role of a user.
Do not supply request parameters with this endpoint.
Field | Type | Description | Optional |
---|---|---|---|
role |
string |
The new role of the user (can either be student , approver , tcard , or admin ) |
This is an admin-only endpoint.
If successful, this endpoint returns an HTTP 200 code. If anyone other than admins tries to access this endpoint, the endpoint will return HTTP 403.
Set the webhooks settings object for this user.
Do not supply request parameters with this endpoint.
Provide a JSON dictionary with the keys being a notification event (see Notifications section) and the values a JSON array with all destinations for that event (eg. ['email','slack', 'discord']
).
Can be used by anyone authenticated by Shibboleth.
If successful, this endpoint returns an HTTP 200. 400 otherwise (bad JSON dictionary).
Set the discord webhook destination for this user.
Do not supply request parameters with this endpoint.
Field | Type | Description | Optional |
---|---|---|---|
webhook |
string |
The discord webhook URL |
Can be used by anyone authenticated by Shibboleth.
If successful, this endpoint returns an HTTP 200. 400 otherwise (invalid webhook URL).
Set the discord webhook destination for this user.
Do not supply request parameters with this endpoint.
Field | Type | Description | Optional |
---|---|---|---|
webhook |
string |
The slack webhook URL |
Can be used by anyone authenticated by Shibboleth.
If successful, this endpoint returns an HTTP 200. 400 otherwise (invalid webhook URL).
Change the current theme of the logged-in user. system
specifies that the theme will be decided based on the system preferences.
Parameters are not required for this API route.
Field | Type | Description | Optional |
---|---|---|---|
theme |
string |
The new role of the user (can either be light , dark , or system ) |
Can be used by anyone authenticated by Shibboleth.
This endpoint returns HTTP 200 on a successful theme change, otherwise, HTTP 400 is returned.
Get information about all rooms.
Do not supply request parameters with this endpoint.
Any authenticated user may access this route.
If successful, this endpoint returns an HTTP 200 code and an array of Room
objects.
Create a new room
Do not supply request parameters with this endpoint.
Only users with the administrator role may use this route.
If successful, this endpoint returns an HTTP 200 code and an array of Room
objects.
Get room info given its room number.
Field | Type | Description | Optional |
---|---|---|---|
friendlyName |
string |
The room's common name (e.g., Hacklab, TA Room, etc) | |
room |
string |
The room's ID or room number (e.g., DH2014) | |
capacity |
integer |
How many people can fit in this room |
Only managers of the group to which the request belongs, the author of the request, and administrators may edit the request.
If successful, this endpoint returns an HTTP 200 code and the Room
object specified by the request parameter.
If the user does not have permission to delete this request, then this endpoint returns HTTP 403.
Return all the dates already booked or pending, defaults to within the next week.
Field | Type | Description | Optional |
---|---|---|---|
start_date |
Date |
The start date to filter by in the ISO 8601 format. (YYYY-MM-DD). Defaults to the current date. | ✔️ |
end_date |
string |
The end date to filter by in ISO 8601 format. (YYYY-MM-DD). Defaults to the current date + 7 days. | ✔️ |
All authenticated users can access this endpoint.
If successful, this endpoint returns an HTTP 200 code and an array of date strings in ISO 8061 format.
Given a room and UTORid, update the user with the supplied UTORid to have access to the room supplied by the path parameters.
Do not supply request parameters with this endpoint.
Only tcard
and admin
roles are approved to call this endpoint.
Field | Type | Description | Optional |
---|---|---|---|
utorid |
string |
The UTORid of the student that will be granted access. |
If successful, this endpoint returns an HTTP 200 code.
If the user or room doesn't exist or is not found, this endpoint returns an HTTP 404 code.
If the method caller does not have the tcard
or admin
role, this endpoint returns an HTTP 430 code.
Given a room and UTORid, update the user with the supplied UTORid to not have access to the room supplied by the path parameters.
Do not supply request parameters with this endpoint.
Only tcard
and admin
roles are approved to call this endpoint.
Field | Type | Description | Optional |
---|---|---|---|
utorid |
string |
The UTORid of the student that will be granted access. |
If successful, this endpoint returns an HTTP 200 code.
If the user or room doesn't exist or is not found, this endpoint returns an HTTP 404 code.
If the method caller does not have the tcard
or admin
role, this endpoint returns an HTTP 430 code.
Given a room and UTORid, update the approver with the given UTORid to have permission to approve the room specified in the path parameter.
Note that the user with the given utorid
must already have the approver role.
Do not supply request parameters with this endpoint.
Only users with the admin
role are allowed to call this endpoint.
Field | Type | Description | Optional |
---|---|---|---|
utorid |
string |
The UTORid of the approver that will be granted access. |
If successful, this endpoint returns an HTTP 200 code.
If the user or room doesn't exist or is not found, this endpoint returns an HTTP 404 code.
If the method caller does not have the admin
role, this endpoint returns an HTTP 430 code.
Given a room and UTORid, remove the approver with the given UTORid's permission to approve the room specified in the path parameter.
Note that the user with the given utorid
must already have the approver role.
Do not supply request parameters with this endpoint.
Only users with the admin
role are allowed to call this endpoint.
Field | Type | Description | Optional |
---|---|---|---|
utorid |
string |
The UTORid of the approver that will be revoked access. |
If successful, this endpoint returns an HTTP 200 code.
If the user or room doesn't exist or is not found, this endpoint returns an HTTP 404 code.
If the method caller does not have the admin
role, this endpoint returns an HTTP 430 code.
Get all groups you belong to (will return all existing groups for staff)
Do not supply request parameters with this endpoint.
Can be used by anyone authenticated by Shibboleth.
This endpoint returns an HTTP 200 code with an array of Group
objects.
Get information about a certain group.
Do not supply request parameters with this endpoint.
Can be used by anyone authenticated by Shibboleth.
If successful, this endpoint returns an HTTP 200 code with a Group
object.
Returns 403 if the user is not an admin and is not part of the group.
Create a new student group, with the current user as its manager.
Do not supply request parameters with this endpoint.
Can be used by anyone authenticated by Shibboleth.
Field | Type | Description | Optional |
---|---|---|---|
name |
string |
The name of the new group. |
If successful, this endpoint returns an HTTP 200 code.
If a group with the same name already exists, HTTP 409 will be returned.
Change the role of a user. Note that the caller cannot change their own role. Other members must change their roles for them.
Do not supply request parameters with this endpoint.
This endpoint's caller must be a group manager identified by the path parameters.
Field | Type | Description | Optional |
---|---|---|---|
utorid |
string |
The utorid of the target user | |
role |
string |
The new role of the specified user (either manager or member ). |
If successful, this endpoint returns an HTTP 200 code. If the caller is not a manager of the group, HTTP 403 will be returned. If the caller tries to change their own role, HTTP 400 will be returned. If the user is not found or is not in the group, 404 will be returned
Invite a user to the group.
Do not supply request parameters with this endpoint.
This endpoint's caller must be a group manager identified by the path parameters.
Field | Type | Description | Optional |
---|---|---|---|
utorid |
string |
The utorid of the target user |
If successful, this endpoint returns an HTTP 200 code. If the caller is not a manager of the group, HTTP 403 will be returned. If the caller tries to invite someone who is already in the group, HTTP 400 will be returned. If the user is not found, 404 will be returned
Accept a pending invite from a group.
Do not supply request parameters with this endpoint.
The caller of this endpoint must be invited to the group specified by the path parameters.
Do not supply a request body with this endpoint.
If successful, this endpoint returns an HTTP 200 code. If the caller is not invited to the group HTTP 400 will be returned.
Reject a pending invite from a group.
Do not supply request parameters with this endpoint.
The caller of this endpoint must be invited to the group specified by the path parameters.
Do not supply a request body with this endpoint.
If successful, this endpoint returns an HTTP 200 code. If the caller is not invited to the group HTTP 400 will be returned.
Remove a user from the group.
Do not supply request parameters with this endpoint.
The caller of this endpoint must be one of the following:
- a manager of the group identified by the path parameters,
- have the
administrator
role, - or be trying to remove themselves (i.e., the
utorid
in the request body is the same as the caller'sutorid
).
Field | Type | Description | Optional |
---|---|---|---|
utorid |
string |
The utorid of the target user |
If successful, this endpoint returns an HTTP 200 code. If the caller is not a manager of the group, HTTP 403 will be returned. If the user is not found or is not in the group, 404 will be returned.
Delete a group.
Do not supply request parameters with this endpoint.
This endpoint's caller must be a group manager identified by the path parameters.
Do not supply a request body with this endpoint.
If successful, this endpoint returns an HTTP 200 code. If the caller is not a manager of the group, HTTP 403 will be returned.