APIs - HeartUoA/HeaRT GitHub Wiki
There are four API's that receive and send JSON data using POST, PUT and GET methods
The JSON data should follow the layout from the database page.
Users
The users API is used to create a new user and also authenticate the user
/api/users
is the location where the JSON data should be sent
POST
/
This route is used to create a new user
Status | Response |
---|---|
200 | "User Created!" |
403 | "Username already exists." |
403 | "error message" |
/authenticate/:username
This route is used to check if the username and password entered from the user is correct.
Status | Response |
---|---|
200 | accessToken |
403 | "Ensure that you've hashed the password using md5 before sending it to the server" |
403 | "error message" |
Course
This API will create a new course and also get the charts for the course.
/api/course
POST
/
This route is used to create a new course associated with the user
Status | Response |
---|---|
200 | courses |
400 | "error message" |
/:courseID/chart
This route is used to create a chart for a specific course
Status | Response |
---|---|
200 | JSON(chartID, createdAt, reasonOfPlay, dimensions) |
403 | "You do not have permissions to create a chart for this course" |
400 | "error message" |
GET
/
This route is used to get all courses associated with the user
Status | Response |
---|---|
200 | courses |
400 | "No courses found" |
400 | "error message" |
/:courseID
This route is used to get all courses associated with the user
Status | Response |
---|---|
200 | courses |
403 | "You do not have permissions to access this course" |
400 | "error message" |
/:courseID/chart
This route is used to get the specific chart for the course
Status | Response |
---|---|
200 | JSON(charts) |
403 | "You do not have permissions to view charts for this course" |
404 | "No charts found" |
400 | "error message" |
Chart
/api/chart
This API is used to get the chart data associated with the chart and course
PUT
/:chartID
This is used to modify an existing chart in the server
Status | Response |
---|---|
200 | JSON(updatedField) |
403 | "You do not have permissions to modify this chart" |
404 | "No chart found. You can create one at /api/course/{courseID}/chart/" |
400 | "error message" |
GET
/:chartID
This is used to get the cards associated with the charts
Status | Response |
---|---|
200 | JSON(chart) |
403 | "You do not have permissions to modify this chart" |
404 | "No chart found. You can create one at /api/course/{courseID}/chart/" |
400 | "error message" |
Dimensions
/api/dimensions
This API is used for getting or changing a specific dimension from a chart
PUT
/:dimensionID
This is used to change the specific dimension of an chart
Status | Response |
---|---|
200 | JSON(dimensions) |
403 | |
404 | "No course exists for this dimension" |
400 | "error message" |
GET
/:dimensionID
This is used to get the specific dimension for a chart
Status | Response |
---|---|
200 | JSON(dimensions) |
403 | |
404 | "No course exists for this dimension" |
400 | "error message" |
/forchart/:chartID
This is used to get the specific dimension for a chart
Status | Response |
---|---|
200 | JSON(dimensions) |
403 | |
404 | "No course exists with that ID" |
400 | "error message" |