Skip to content
Kent Wu edited this page Mar 29, 2016 · 18 revisions

##Search Endpoints ###POST /auth Authenticates a user based on email and password

Takes:

{
  'username': '[email protected]',
  'password': 'testpass'
}

Returns:

{
  'access_token': 'jwttokenhere'
}

###POST /signup Creates a user in the database

Takes:

{
  'firstName': 'firstname',
  'lastname': 'lastname',
  'email': '[email protected]',
  'password': 'testpass'
}

Returns:

{
  'status': 'success',
  'message': 'User successfully created'
}

###GET /instructors/f/:search_string

Sample request: GET /instructors/f/levitin

Returns:

{
  "data": [
    {
      "courses": [
        {
          "attributes": [],
          "course_name": "Analysis of Algorithms",
          "department": "CSC",
          "level": "1700"
        }
      ],
      "departments": [
        {
          "code": "CSC",
          "name": "Computer Science"
        }
      ],
      "name": "Anany Levitin",
      "rating": 4.4,
      "traits": []
    },
    {
      "courses": [
        {
          "attributes": [],
          "course_name": "Statistical Theory II",
          "department": "MAT",
          "level": "8401"
        },
        {
          "attributes": [
            "Distance Learning"
          ],
          "course_name": "Stats in Health Care Research",
          "department": "MAT",
          "level": "1250"
        }
      ],
      "departments": [
        {
          "code": "MAT",
          "name": "Mathematics"
        }
      ],
      "name": "Michael L. Levitan",
      "rating": null,
      "traits": []
    },
    {
      "courses": [
        {
          "attributes": [
            "Distance Learning"
          ],
          "course_name": "Greece & Rome Art & Culture",
          "department": "CLA",
          "level": "7301"
        },
        {
          "attributes": [],
          "course_name": "Proseminar",
          "department": "LAT",
          "level": "9850"
        },
        {
          "attributes": [],
          "course_name": "Intermediate Latin II",
          "department": "LAT",
          "level": "1122"
        },
        {
          "attributes": [],
          "course_name": "Independent Study",
          "department": "CLA",
          "level": "3001"
        },
        {
          "attributes": [],
          "course_name": "Latin:  Independent Study",
          "department": "LAT",
          "level": "5900"
        },
        {
          "attributes": [],
          "course_name": "Greek:  Indpendent Study",
          "department": "GRK",
          "level": "5900"
        }
      ],
      "departments": [
        {
          "code": "LAT",
          "name": "Latin"
        },
        {
          "code": "CLA",
          "name": "Classical Studies"
        },
        {
          "code": "GRK",
          "name": "Greek"
        }
      ],
      "name": "Valentina S. DeNardis",
      "rating": null,
      "traits": []
    }
  ],
  "status": "success"
}

###GET /courses/f/:search_string

Sample request: GET /courses/f/algorithms

{
  "data": [
    {
      "attributes": [],
      "course_name": "Algorithms & Data Struc I",
      "department": "CSC",
      "level": "1051",
      "match": 90
    },
    {
      "attributes": [],
      "course_name": "Algorithms & Data Struc II",
      "department": "CSC",
      "level": "1052",
      "match": 90
    },
    {
      "attributes": [],
      "course_name": "Analysis of Algorithms",
      "department": "CSC",
      "level": "1700",
      "match": 90
    }
  ],
  "status": "success"
}

###GET /instructor/:instructor_name

Takes the name (exact) of a single instructor, and returns their info Sample Request:

GET /instructor/Anany Levitin

Returns:

{
  "data": {
    "courses": [
      {
        "attributes": [],
        "course_name": "Design and Ana of Algs",
        "department": "CSC",
        "level": "8301"
      },
      {
        "attributes": [],
        "course_name": "Analysis of Algorithms",
        "department": "CSC",
        "level": "1700"
      }
    ],
    "departments": [
      {
        "code": "CSC",
        "name": "Computer Science"
      }
    ],
    "name": "Anany Levitin",
    "rating": 5,
    "reviews": [
      {
        "class_rating": 5,
        "course": "Analysis of Algorithms",
        "date_created": "2016-03-29T14:38:11.274687",
        "inst_rating": 5,
        "instructor_name": "Anany Levitin",
        "student": "[email protected]",
        "subject": "CSC",
        "subject_level": "1700",
        "text": "This is a test review body."
      },
      {
        "class_rating": 5,
        "course": "Analysis of Algorithms",
        "date_created": "2016-03-29T14:38:14.669924",
        "inst_rating": 5,
        "instructor_name": "Anany Levitin",
        "student": "[email protected]",
        "subject": "CSC",
        "subject_level": "1700",
        "text": "This is a test review body."
      }
    ],
    "traits": []
  },
  "status": "success"
}

###GET /course/:course_name Takes a a single name of a course and returns its info Sample Request: GET /courses/Analysis of Algorithms

Returns:

{
  "data": {
    "instructors": [
      {
        "courses": [
          {
            "attributes": [],
            "course_name": "Design and Ana of Algs",
            "department": "CSC",
            "level": "8301"
          },
          {
            "attributes": [],
            "course_name": "Analysis of Algorithms",
            "department": "CSC",
            "level": "1700"
          }
        ],
        "departments": [
          {
            "code": "CSC",
            "name": "Computer Science"
          }
        ],
        "name": "Anany Levitin",
        "rating": 5,
        "traits": []
      }
    ],
    "name": "Analysis of Algorithms",
    "reviews": [
      {
        "class_rating": 5,
        "course": "Analysis of Algorithms",
        "date_created": "2016-03-29T14:38:11.274687",
        "inst_rating": 5,
        "instructor_name": "Anany Levitin",
        "student": "[email protected]",
        "subject": "CSC",
        "subject_level": "1700",
        "text": "This is a test review body."
      },
      {
        "class_rating": 5,
        "course": "Analysis of Algorithms",
        "date_created": "2016-03-29T14:38:14.669924",
        "inst_rating": 5,
        "instructor_name": "Anany Levitin",
        "student": "[email protected]",
        "subject": "CSC",
        "subject_level": "1700",
        "text": "This is a test review body."
      }
    ],
    "sections": [
      32978,
      32979
    ],
    "subject": "CSC",
    "subject_level": "1700",
    "traits": []
  },
  "status": "success"
}

POST /reviews

Takes an object with relevant review data and returns a review

POST /reviews

{
    "course": "Analysis of Algorithms", 
    "reviewBody": "This is a test review body.", 
    "traits": [0, 1, 2, 3, 4, 5], 
    "classRating": 5, 
    "student": "[email protected]", 
    "instructor": "Anany Levitin", 
    "instRating": 5
}

Response:

{
    'status': 'success',
    'message': 'Review Successfully Added'
}

GET /reviews/student/:student_email

Takes a single student email and returns a list of the reviews they have written Sample request:

GET /reviews/student/[email protected]

Returns:

{
  "reviews": [
    {
      "class_rating": 5,
      "course": "Analysis of Algorithms",
      "date_created": "2016-03-29T14:38:11.274687",
      "inst_rating": 5,
      "instructor_name": "Anany Levitin",
      "student": "[email protected]",
      "subject": "CSC",
      "subject_level": "1700",
      "text": "This is a test review body. Review Number 1"
    },
    {
      "class_rating": 5,
      "course": "Analysis of Algorithms",
      "date_created": "2016-03-29T14:38:14.669924",
      "inst_rating": 5,
      "instructor_name": "Anany Levitin",
      "student": "[email protected]",
      "subject": "CSC",
      "subject_level": "1700",
      "text": "This is a test review body. Review Number 2"
    },
    {
      "class_rating": 5,
      "course": "Analysis of Algorithms",
      "date_created": "2016-03-29T14:45:47.084143",
      "inst_rating": 5,
      "instructor_name": "Anany Levitin",
      "student": "[email protected]",
      "subject": "CSC",
      "subject_level": "1700",
      "text": "This is a test review body. Review Number 3"
    }
  ]
}

GET /reviews/:id

Gets a single review given it's id

Sample request: GET /reviews/1

Response:

{
  "data": {
    "class_rating": 5,
    "course": "Analysis of Algorithms",
    "date_created": "2016-03-29T14:38:11.274687",
    "inst_rating": 5,
    "instructor_name": "Anany Levitin",
    "student": "[email protected]",
    "subject": "CSC",
    "subject_level": "1700",
    "text": "This is a test review body. Review Number 1"
  },
  "status": "success"
}

GET /recent

Returns a list of the 5 most recent reviews, sorted by reverse chronological order (most recent first)

Sample Request: GET /recent

Response:

{
  "data": [
    {
      "class_rating": 5,
      "course": "Analysis of Algorithms",
      "date_created": "2016-03-29T14:45:47.084143",
      "inst_rating": 5,
      "instructor_name": "Anany Levitin",
      "student": "[email protected]",
      "subject": "CSC",
      "subject_level": "1700",
      "text": "This is a test review body. Review Number 1"
    },
    {
      "class_rating": 5,
      "course": "Analysis of Algorithms",
      "date_created": "2016-03-29T14:38:14.669924",
      "inst_rating": 5,
      "instructor_name": "Anany Levitin",
      "student": "[email protected]",
      "subject": "CSC",
      "subject_level": "1700",
      "text": "This is a test review body. Review Number 2"
    },
    {
      "class_rating": 5,
      "course": "Analysis of Algorithms",
      "date_created": "2016-03-29T14:38:11.274687",
      "inst_rating": 5,
      "instructor_name": "Anany Levitin",
      "student": "[email protected]",
      "subject": "CSC",
      "subject_level": "1700",
      "text": "This is a test review body. Review Number 3"
    }
  ],
  "status": "success"
}