Touutae-lab/FastGraduation-API

API Routes

Closed this issue · 0 comments

Part Student

  • GET /api/student/browse_course

Assignee: add yourself here

Description: This route sends a list of available courses to users. This route corresponds to the Search page.

Search

Params:

  • q=[keywords to search] (optional): a query text that a user may input in the search box.
  • init=1 (optional): a flag whether should we return a predefined list of courses regardless of the enrolled courses. This param must come with the exact value 1, or it would get rejected as if such the param had not been sent.

Response:

  • If there are no params, use the user's list of enrolled courses to determine the order of courses to respond to; the most recommended — important — course comes first.
  • If q exists, respond with the order based on relevance instead — without using the user's enrolled courses to determine the order. However, the student's
  • If init=1 exists, use the predefined plan — the exact same as the ones written by the department of CS. init will ignore any other params, especially q if we provide one. This param must come with the exact value 1, or it would get rejected as if such the param had not been sent.

Response Format

{
    "status": 200,
    "msg": "OK",
    "data": [
        {
            "course_id": [string of 6-digit course ID],
            "course_name_th": [string of course name in Thai],
            "course_name_en": [string of course name in English],
            "possible_category": [
                {
                    "cat_id": [integer id of the category],
                    "cat_name_th": [category name in Thai],
                    "cat_name_en": [category name in English],
                    "cat_abbr_th": [abbreviated name in Thai],
                    "cat_abbr_en": [abbreviated name in English]
                },
                // ...
            ]
        },
        // ...
    ]
}

Note: params are pairs of a key and a value appending at the end of URLs following the ? symbol. For instance,

http://localhost:8000/myroute?a=5&b=2

has 2 params: a with value 5, and b with value 2.