=======================================================================
=======================================================================
=======================================================================
POST /api/users/register
Name | Description |
---|---|
Content-Type | application/json |
Name | Type | Required | Details |
---|---|---|---|
username | "String" | Yes | Must be unique |
name | "String" | No | |
"String" | No | Must be unique | |
phone_number | Number | No | Must be unique |
password | "String" | Yes |
{
"username": "new_user2",
"name": "New User2",
"email": "new_user2@gmail.com",
"phone_number": 4324324324,
"password": "password"
}
{
"u_id": 9,
"username": "new_user2",
"name": "New User2",
"email": "new_user2@gmail.com",
"phone_number": 4324324324, ,
"role": "social worker"
}
{
"message": "Something went wrong"
}
POST /api/users/login
Name | Description |
---|---|
Content-Type | application/json |
Name | Type | Required | Details |
---|---|---|---|
username | "String" | Yes | Must be unique |
password | "String" | Yes |
{
username: "johny",
password: "Just_Password"
}
{
"message": "Welcome johny",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijo2LCJ1c2VybmFtZSI6Im5ld191c2VyMiIsImlhdCI6MTU4MDg3NjU5NywiZXhwIjoxNTgxNDgxMzk3fQ.KHyM1TRfjcJ-l1RalgyDs1fGXUzelsz1zYe-rqyJIBQ"
}
{
"message": "Invalid Credentials"
}
{
"message": "Something went wrong"
}
GET /api/users
Name | Type | Required | Description |
---|---|---|---|
Authorization | token | Yes | User must be loged in |
[
{
"id": 1,
"username": "boss",
"name": "Big Boss",
"email": "big_boss@gmail.com",
"phone_number": 1234567890,
"role": "administrator"
},
{
"id": 2,
"username": "anna_maria",
"name": "Anna Maria Superkind",
"email": "anna_maria_superkind@gmail.com",
"phone_number": 2345678901,
"role": "social worker"
}
]
{
"message": "You have to be logged in!"
}
{
"message": "Something went wrong"
}
=======================================================================
=======================================================================
GET /api/students
Name | Type | Required | Description |
---|---|---|---|
Authorization | token | Yes | User must be loged in |
[
{
"id": 1,
"name": "Jane Humilton",
"grade": "high",
"class": 9,
"background": "too sleepy to write something",
"status": "student",
"age": 15,
"insurance": 1,
"birth_certificate": 1,
"special_needs": "none",
"student_contact": "name: 'Gretta Humilton', phone number: 342865467, email: 'gretta_humilton@gmail.com'",
"social_worker": "anna_maria"
},
{
"id": 2,
"name": "Mary Rock",
"grade": "middle",
"class": 8,
"background": "too sleepy to write something",
"status": "student",
"age": 14,
"insurance": 1,
"birth_certificate": 1,
"special_needs": "alergy: oranges",
"student_contact": "name: 'George Rock', phone number: 389568399, email: 'george_rock@gmail.com'",
"social_worker": "johny"
}
]
{
"message": "You have to be logged in!"
}
{
"message": "Something went wrong"
}
GET /api/students/classes/:class_id
Name | Type | Required | Description |
---|---|---|---|
Authorization | token | Yes | User must be loged in |
[
{
"id": 2,
"name": "Mary Rock",
"grade": "middle",
"class": 8,
"background": "too sleepy to write something",
"status": "student",
"age": 14,
"insurance": 1,
"birth_certificate": 1,
"special_needs": "alergy: oranges",
"student_contact": "name: 'George Rock', phone number: 389568399, email: 'george_rock@gmail.com'",
"social_worker": "johny"
},
{
"id": 3,
"name": "John Calm",
"grade": "middle",
"class": 8,
"background": "too sleepy to write something",
"status": "student",
"age": 14,
"insurance": 0,
"birth_certificate": 1,
"special_needs": "none",
"student_contact": "name: 'Clara Calm', phone number: 111111111, email: 'clara_2222@gmail.com'",
"social_worker": "johny"
}
]
{
"message": "You have to be logged in!"
}
{
"message": "Can't find this class"
}
{
"message": "Something went wrong"
}
GET /api/students/grades/:grade_id
Name | Type | Required | Description |
---|---|---|---|
Authorization | token | Yes | User must be loged in |
[
{
"id": 4,
"name": "Angela Clark",
"grade": "elementary",
"class": 4,
"background": "too sleepy to write something",
"status": "student",
"age": 10,
"insurance": 1,
"birth_certificate": 1,
"special_needs": "none",
"student_contact": "name: 'Rick Clark', phone number: 3388872992, email: 'r_clark@gmail.com'",
"social_worker": "maria_2020"
},
{
"id": 5,
"name": "Leo Foster",
"grade": "elementary",
"class": 4,
"background": "too sleepy to write something",
"status": "student",
"age": 10,
"insurance": 1,
"birth_certificate": 1,
"special_needs": "none",
"student_contact": "name: 'Lilia Foster', phone number: 47837687378, email: 'l_f123@gmail.com'",
"social_worker": "alex_k"
}
]
{
"message": "You have to be logged in!"
}
{
"message": "Can't find this grade"
}
{
"message": "Something went wrong"
}
GET /api/students/:id
Name | Type | Required | Description |
---|---|---|---|
Authorization | token | Yes | User must be loged in |
{
"s_id": 2,
"name": "Mary Rock",
"grade": "middle",
"class": 8,
"background": "too sleepy to write something",
"status": "student",
"age": 14,
"insurance": 1,
"birth_certificate": 1,
"special_needs": "alergy: oranges",
"student_contact": "name: 'George Rock', phone number: 389568399, email: 'george_rock@gmail.com'",
"social_worker": "johny"
}
{
"message": "You have to be logged in!"
}
{
"message": "Could not find student with given ID"
}
{
"message": "Something went wrong"
}
POST /api/students
Name | Type | Required | Description |
---|---|---|---|
Authorization | token | Yes | User must be loged in |
Content-Type | Yes | application/json |
Name | Type | Required | Details |
---|---|---|---|
name | "String" | Yes | Must be unique |
student_grade | "String" | No | Should be one of three: "elementary", "middle" or "high" |
student_class | Number | No | Should be between 1-12 |
background | "String" | No | |
student_status | "String" | No | Should be one of three: "student", "past student" or "visitor" |
age | Number | No | |
insurance | Boolean | No | Default to "False"; Should be 0 or 1 |
birth_certificate | Boolean | No | Default to "True"; Should be 0 or 1 |
special_needs | "String" | No | |
student_contact | "String" | No | |
social_worker | "String" | No | username of social worker |
The fields that aren't required can be missed in this request
{
"name": "Johny Ground",
"student_grade": "middle",
"student_class": 8,
"background": "too sleepy to write somithing",
"student_status": "student",
"age": 14,
"insurance": 1,
"birth_certificate": 1,
"special_needs": "alergie: oranges",
"student_contact": "name: 'James Ground', phone number: 675565567, email: 'james_g@gmail.com'",
"social_worker": "anna_maria"
}
{
"s_id": 21,
"name": "Johny Ground",
"grade": "middle",
"class": 8,
"background": "too sleepy to write somithing",
"status": "student",
"age": 14,
"insurance": 1,
"birth_certificate": 1,
"special_needs": "alergie: oranges",
"student_contact": "name: 'James Ground', phone number: 675565567, email: 'james_g@gmail.com'",
"social_worker": "anna_maria"
}
{
"message": "Something went wrong"
}
PUT /api/students/:id
Name | Type | Required | Description |
---|---|---|---|
Authorization | token | Yes | User must be loged in |
Content-Type | Yes | application/json |
Name | Type | Required | Details |
---|---|---|---|
name | "String" | Yes | Must be unique |
student_grade | "String" | No | Should be one of three: "elementary", "middle" or "high" |
student_class | Number | No | Should be between 1-12 |
background | "String" | No | |
student_status | "String" | No | Should be one of three: "student", "past student" or "visitor" |
age | Number | No | |
insurance | Boolean | No | Default to "False"; Should be 0 or 1 |
birth_certificate | Boolean | No | Default to "True"; Should be 0 or 1 |
special_needs | "String" | No | |
student_contact | "String" | No | |
social_worker | "String" | No | username of social worker |
The fields that aren't required can be missed in this request
{
"name": "Johny Ground1",
"student_grade": "middle",
"student_class": 8,
"background": "too sleepy to write somithing",
"student_status": "student",
"age": 14,
"insurance": 1,
"birth_certificate": 1,
"special_needs": "alergie: oranges",
"student_contact": "name: 'James Ground', phone number: 675565567, email: 'james_g@gmail.com'",
"social_worker": "anna_maria"
}
{
"s_id": 21,
"name": "Johny Ground1",
"grade": "middle",
"class": 8,
"background": "too sleepy to write somithing",
"status": "student",
"age": 14,
"insurance": 1,
"birth_certificate": 1,
"special_needs": "alergie: oranges",
"student_contact": "name: 'James Ground', phone number: 675565567, email: 'james_g@gmail.com'",
"social_worker": "anna_maria"
}
{
"message": "Could not find student with given ID"
}
{
"message": "Something went wrong"
}
DELETE /api/students/:id
Name | Type | Required | Description |
---|---|---|---|
Authorization | token | Yes | User must be loged in |
There is no body in this response
{
"message": "Could not find user with given ID"
}
{
"message": "Something went wrong"
}