Skip to content

Examples ‐ Instructor Endpoints

Nguyen Nguyen edited this page Nov 3, 2023 · 1 revision

Get current enrollment for the classes.

Request

curl --location 'http://localhost:5000/api/classes/2/students/' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImFjY2Vzcy10b2tlbi1rZXkifQ.eyJhdWQiOiJrcmFrZW5kLmxvY2FsLmdkIiwiZXhwIjoxNjk4OTc2OTk0LCJmaXJzdF9uYW1lIjoiTmF0aGFuIiwiaXNzIjoiYXV0aC5sb2NhbC5nZCIsImp0aSI6IjIiLCJsYXN0X25hbWUiOiJOZ3V5ZW4iLCJyb2xlcyI6WyJTdHVkZW50IiwiSW5zdHJ1Y3RvciIsIlJlZ2lzdHJhIl0sInN1YiI6Im5hdGhhbiJ9.PpHZkB-kegraBETXcNtYLI_FQ1kOVC-F_J8ZuTQ4gh6SS3V8n7zgUCIs6_8e6fCK6_1VcyxbTVEJwaTTAHCGMp0ZE-swmgNXtBs6XNWd9zHTjU0noYaHfVjXiRS0es7RjoxOiDUpWMO5RKpXETZHndZ2jcFMMAXNbOz759FSrrHfzgF34ppwe80hwxWY_sl4ufDuLetqUK66xge819F44Djh4wl03bTCaLxg7DAeO3XemIUx8VN55YrJsWZL3P7ZGdVtGUx2AunIwciSd8seN_FEpbarBPRt1-QUUUPVlHDMjoVZPsc90phJx3uvGY2xdSD5ZFpoZ6-lDgfHQl-inA'

Response

{
    "students": [
        {
            "first_name": "Karen",
            "id": 10123456,
            "last_name": "Hall"
        },
        {
            "first_name": "Jason",
            "id": 11123456,
            "last_name": "Davis"
        },
        {
            "first_name": "Lucas",
            "id": 12112364,
            "last_name": "Hernandez"
        }
    ]
}

Get students who have dropped the class

Request

curl --location 'http://localhost:5000/api/classes/2/droplist/' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImFjY2Vzcy10b2tlbi1rZXkifQ.eyJhdWQiOiJrcmFrZW5kLmxvY2FsLmdkIiwiZXhwIjoxNjk4OTc2OTk0LCJmaXJzdF9uYW1lIjoiTmF0aGFuIiwiaXNzIjoiYXV0aC5sb2NhbC5nZCIsImp0aSI6IjIiLCJsYXN0X25hbWUiOiJOZ3V5ZW4iLCJyb2xlcyI6WyJTdHVkZW50IiwiSW5zdHJ1Y3RvciIsIlJlZ2lzdHJhIl0sInN1YiI6Im5hdGhhbiJ9.PpHZkB-kegraBETXcNtYLI_FQ1kOVC-F_J8ZuTQ4gh6SS3V8n7zgUCIs6_8e6fCK6_1VcyxbTVEJwaTTAHCGMp0ZE-swmgNXtBs6XNWd9zHTjU0noYaHfVjXiRS0es7RjoxOiDUpWMO5RKpXETZHndZ2jcFMMAXNbOz759FSrrHfzgF34ppwe80hwxWY_sl4ufDuLetqUK66xge819F44Djh4wl03bTCaLxg7DAeO3XemIUx8VN55YrJsWZL3P7ZGdVtGUx2AunIwciSd8seN_FEpbarBPRt1-QUUUPVlHDMjoVZPsc90phJx3uvGY2xdSD5ZFpoZ6-lDgfHQl-inA'

Response

{
    "students": [
        {
            "first_name": "Tariq",
            "id": 65123456,
            "last_name": "Aziz"
        },
        {
            "first_name": "Hiroshi",
            "id": 68123456,
            "last_name": "Sato"
        }
    ]
}

Get students in the waiting list

Request

curl --location 'http://localhost:5000/api/classes/2/waitlist/' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImFjY2Vzcy10b2tlbi1rZXkifQ.eyJhdWQiOiJrcmFrZW5kLmxvY2FsLmdkIiwiZXhwIjoxNjk4OTc2OTk0LCJmaXJzdF9uYW1lIjoiTmF0aGFuIiwiaXNzIjoiYXV0aC5sb2NhbC5nZCIsImp0aSI6IjIiLCJsYXN0X25hbWUiOiJOZ3V5ZW4iLCJyb2xlcyI6WyJTdHVkZW50IiwiSW5zdHJ1Y3RvciIsIlJlZ2lzdHJhIl0sInN1YiI6Im5hdGhhbiJ9.PpHZkB-kegraBETXcNtYLI_FQ1kOVC-F_J8ZuTQ4gh6SS3V8n7zgUCIs6_8e6fCK6_1VcyxbTVEJwaTTAHCGMp0ZE-swmgNXtBs6XNWd9zHTjU0noYaHfVjXiRS0es7RjoxOiDUpWMO5RKpXETZHndZ2jcFMMAXNbOz759FSrrHfzgF34ppwe80hwxWY_sl4ufDuLetqUK66xge819F44Djh4wl03bTCaLxg7DAeO3XemIUx8VN55YrJsWZL3P7ZGdVtGUx2AunIwciSd8seN_FEpbarBPRt1-QUUUPVlHDMjoVZPsc90phJx3uvGY2xdSD5ZFpoZ6-lDgfHQl-inA'

Response

{
    "students": [
        {
            "first_name": "Tariq",
            "id": 65123456,
            "last_name": "Aziz",
            "waitlist_date": "2023-08-28 09:00:00"
        },
        {
            "first_name": "Takashi",
            "id": 73123456,
            "last_name": "Nakagawa",
            "waitlist_date": "2023-08-28 10:00:00"
        }
    ]
}

Drop students administratively

Request

curl --location --request DELETE 'http://localhost:5000/api/enrollment/2/12345678/administratively/' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImFjY2Vzcy10b2tlbi1rZXkifQ.eyJhdWQiOiJrcmFrZW5kLmxvY2FsLmdkIiwiZXhwIjoxNjk4OTc2OTk0LCJmaXJzdF9uYW1lIjoiTmF0aGFuIiwiaXNzIjoiYXV0aC5sb2NhbC5nZCIsImp0aSI6IjIiLCJsYXN0X25hbWUiOiJOZ3V5ZW4iLCJyb2xlcyI6WyJTdHVkZW50IiwiSW5zdHJ1Y3RvciIsIlJlZ2lzdHJhIl0sInN1YiI6Im5hdGhhbiJ9.PpHZkB-kegraBETXcNtYLI_FQ1kOVC-F_J8ZuTQ4gh6SS3V8n7zgUCIs6_8e6fCK6_1VcyxbTVEJwaTTAHCGMp0ZE-swmgNXtBs6XNWd9zHTjU0noYaHfVjXiRS0es7RjoxOiDUpWMO5RKpXETZHndZ2jcFMMAXNbOz759FSrrHfzgF34ppwe80hwxWY_sl4ufDuLetqUK66xge819F44Djh4wl03bTCaLxg7DAeO3XemIUx8VN55YrJsWZL3P7ZGdVtGUx2AunIwciSd8seN_FEpbarBPRt1-QUUUPVlHDMjoVZPsc90phJx3uvGY2xdSD5ZFpoZ6-lDgfHQl-inA'

Response

{
    "detail": "Item deleted successfully"
}