-
Notifications
You must be signed in to change notification settings - Fork 2
Students
Maxwell Carter edited this page Jul 18, 2017
·
15 revisions
Retrieve a list of all students and their corresponding details.
GET https://smart-classroom-ece452.mybluemix.net/api/v1/students
[
{
"_id": "594abc3ddd08c70029b4222f",
"lastName": "Wayne",
"firstName": "Bruce",
"displayName": "Batman",
"password": "BatMobile",
"username": "Batman",
"__v": 1,
"goals": [],
"quizHistory": [],
"attendanceHistory": [],
"classrooms": [
"594abefadd08c70029b42235"
]
}
]
Retrieve details of a particular student.
https://smart-classroom-ece452.mybluemix.net/api/v1/students/594abc3ddd08c70029b4222f
{
"_id": "594abc3ddd08c70029b4222f",
"lastName": "Wayne",
"firstName": "Bruce",
"displayName": "Batman",
"password": "BatMobile",
"username": "Batman",
"__v": 1,
"goals": [],
"quizHistory": [],
"attendanceHistory": [],
"classrooms": [
"594abefadd08c70029b42235"
]
}
Create a student.
https://smart-classroom-ece452.mybluemix.net/api/v1/students
{
"lastName": "Wayne",
"firstName": "Bruce",
"displayName": "Batman",
"username": "Batman",
"password": "BatMobile"
}
{
"_id": "594abc3ddd08c70029b4222f",
"lastName": "Wayne",
"firstName": "Bruce",
"displayName": "Batman",
"password": "BatMobile",
"username": "Batman",
"__v": 1,
"goals": [],
"quizHistory": [],
"attendanceHistory": [],
"classrooms": [
"594abefadd08c70029b42235"
]
}
Creates a goal for a student.
POST https://smart-classroom-ece452.mybluemix.net/api/v1/students/594ad1ccdd08c70029b42237/goals
{
"title": "Shoot an Arrow",
"startDate": "06/21/17",
"goal": "594ad28add08c70029b4223a"
}
{
"_id": "594abc3ddd08c70029b4222f",
"lastName": "Wayne",
"firstName": "Bruce",
"displayName": "Batman",
"password": "BatMobile",
"username": "Batman",
"__v": 1,
"goals": [
{
"title": "Shoot an Arrow",
"startDate": "2017-06-21T00:00:00.000Z",
"goal": "594ad28add08c70029b4223a",
"_id": "594ad32bdd08c70029b4223d",
"activityLog": [],
"mark": 0,
"active": true,
"completed": false
}
],
"quizHistory": [],
"attendanceHistory": [],
"classrooms": []
}
Updates the activity log of a goal for a particular student. Note: goalId is the id of the student goal, not the generic goal!
POST https://smart-classroom-ece452.mybluemix.net/api/v1/students/594ad1ccdd08c70029b42237/goals/594ad32bdd08c70029b4223d/activityLogs
{
"log": "Shot Bullseye",
"date": "06/21/17",
"weight": 1.0,
"mark": 100
}
Notice that the total goal mark is automatically updated.
{
"_id": "594abc3ddd08c70029b4222f",
"lastName": "Wayne",
"firstName": "Bruce",
"displayName": "Batman",
"password": "BatMobile",
"username": "Batman",
"__v": 1,
"goals": [
{
"title": "Shoot an Arrow",
"startDate": "2017-06-21T00:00:00.000Z",
"goal": "594ad28add08c70029b4223a",
"_id": "594ad32bdd08c70029b4223d",
"activityLog": [
{
"log": "Shot Bullseye",
"date": "2017-06-21T00:00:00.000Z",
"weight": 1,
"mark": 100
}
],
"mark": 100,
"active": true,
"completed": false
}
],
"quizHistory": [],
"attendanceHistory": [],
"classrooms": []
}
Creates a goal for a list of students
POST https://smart-classroom-ece452.mybluemix.net/api/v1/students/goals
{
"students": ["596c50eb80d6b418d49923ef","596c510d80d6b418d49923f3"],
"goal": {
"title": "Shoot an Arrow",
"startDate": "06/21/17",
"goal": "596d0fed1dcb551b486cbd49"
}
}
You will receive a response indicating the request was accepted. The backend will then finish assigning the goals to students asynchronously.
{
"accepted": true
}
Submits a quiz
POST https://smart-classroom-ece452.mybluemix.net/api/v1/students/596bbbd9a7b8400ea9f239e2/quizzes
{
"title": "sample test",
"quiz": "596c0bf4ba50a0156a05dce8",
"_id": "596c00a38d9a8a148179be46",
"results": [{
"question": "When was the war of 1812?",
"answer": "1812",
"correct": true
}],
"weight": 0.5,
"mark": 80
}
{
"_id": "596bbbd9a7b8400ea9f239e2",
"username": "mcarter",
"password": "$2a$10$XSkYb4npT/rS3yYxJfl7l.z/9xXOrtZR2UKC5NNaBxbQfKn1HGmfi",
"firstName": "Max",
"lastName": "Carter",
"__v": 2,
"goals": [],
"quizHistory": [
{
"title": "sample test",
"quiz": "596c0bf4ba50a0156a05dce8",
"_id": "596c00a38d9a8a148179be46",
"results": [{
"question": "When was the war of 1812?",
"answer": "1812",
"correct": true
}],
"weight": 0.5,
"mark": 80
}
],
"classrooms": [
"596bea98afce0f111c7c2762"
],
"attendanceHistory": [],
"displayName": "Student"
}
Delete a student.
DELETE https://smart-classroom-ece452.mybluemix.net/api/v1/students/594abc3ddd08c70029b4222f
Returns the deleted document.
{
"_id": "594abc3ddd08c70029b4222f",
"lastName": "Wayne",
"firstName": "Bruce",
"displayName": "Batman",
"password": "BatMobile",
"username": "Batman",
"__v": 1,
"goals": [],
"quizHistory": [],
"attendanceHistory": [],
"classrooms": [
"594abefadd08c70029b42235"
]
}