inginious.frontend.pages.api package

REST API for the webapp

Submodules

inginious.frontend.pages.api.auth_methods module

Auth methods

class inginious.frontend.pages.api.auth_methods.APIAuthMethods[source]

Bases: APIPage

Endpoint /api/v0/auth_methods

API_GET()[source]

Returns all the auth methods available. (200 OK)

Response: list of auth methods. The values in the last are auth methods, represented by:

id

id of the auth method

name

the name of the authentication method, typically displayed by the webapp

input

a list containing the inputs to this method. Each input is represented as a dictionary containing three fields:

id

the id of the input, to be returned as id in the POST request of /api/v0/authentication

name

the placeholder for the input

type

text or password

methods: t.ClassVar[t.Collection[str] | None] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

inginious.frontend.pages.api.authentication module

Authentication

class inginious.frontend.pages.api.authentication.APIAuthentication[source]

Bases: APIPage

Endpoint /api/v0/authentication

API_GET()[source]

Returns {“authenticated”: false} or {“authenticated”: true, “username”: “your_username”} (always 200 OK)

API_POST()[source]

Authenticates the remote client. Takes as input:

login

the INGInious account login

password

the associated password

Response: a dict in the form {“status”: “success”} (200 OK) or {“status”: “error”} (403 Forbidden)

methods: t.ClassVar[t.Collection[str] | None] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

inginious.frontend.pages.api.courses module

Courses

class inginious.frontend.pages.api.courses.APICourses[source]

Bases: APIAuthenticatedPage

Endpoint
/api/v0/courses(/[a-zA-Z_\-\.0-9]+)?
API_GET(courseid)[source]

List courses available to the connected client. Returns a dict in the form

{
    "courseid1":
    {
        "name": "Name of the course",     #the name of the course
        "require_password": False,        #indicates if this course requires a password or not
        "is_registered": False,           #indicates if the user is registered to this course or not
        "tasks":                          #only appears if is_registered is True
        {
            "taskid1": "name of task1",
            "taskid2": "name of task2"
            #...
        },
        "grade": 0.0                      #the current grade in the course. Only appears if is_registered is True
    }
    #...
}

If you use the endpoint /api/v0/courses/the_course_id, this dict will contain one entry or the page will return 404 Not Found.

methods: t.ClassVar[t.Collection[str] | None] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

inginious.frontend.pages.api.submissions module

Submissions

class inginious.frontend.pages.api.submissions.APISubmissionSingle[source]

Bases: APIAuthenticatedPage

Endpoint
/api/v0/courses/[a-zA-Z_\-\.0-9]+/tasks/[a-zA-Z_\-\.0-9]+/submissions/[a-zA-Z_\-\.0-9]+
API_GET(courseid, taskid, submissionid)[source]

List all the submissions that the connected user made. Returns list of the form

[
    {
        "id": "submission_id1",
        "submitted_on": "date",
        "status" : "done",          #can be "done", "waiting", "error" (execution status of the task).
        "grade": 0.0,
        "input": {},                #the input data. File are base64 encoded.
        "result" : "success"        #only if status=done. Result of the execution.
        "feedback": ""              #only if status=done. the HTML global feedback for the task
        "problems_feedback":        #only if status=done. HTML feedback per problem. Some pid may be absent.
        {
            "pid1": "feedback1",
            #...
        }
    }
    #...
]

If you use the endpoint /api/v0/courses/the_course_id/tasks/the_task_id/submissions/submissionid, this dict will contain one entry or the page will return 404 Not Found.

methods: t.ClassVar[t.Collection[str] | None] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

class inginious.frontend.pages.api.submissions.APISubmissions[source]

Bases: APIAuthenticatedPage

Endpoint
/api/v0/courses/[a-zA-Z_\-\.0-9]+/tasks/[a-zA-Z_\-\.0-9]+/submissions
API_GET(courseid, taskid)[source]

List all the submissions that the connected user made. Returns dicts in the form

[
    {
        "id": "submission_id1",
        "submitted_on": "date",
        "status" : "done",          #can be "done", "waiting", "error" (execution status of the task).
        "grade": 0.0,
        "input": {},                #the input data. File are base64 encoded.
        "result" : "success"        #only if status=done. Result of the execution.
        "feedback": ""              #only if status=done. the HTML global feedback for the task
        "problems_feedback":        #only if status=done. HTML feedback per problem. Some pid may be absent.
        {
            "pid1": "feedback1",
            #...
        }
    }
    #...
]

If you use the endpoint /api/v0/courses/the_course_id/tasks/the_task_id/submissions/submissionid, this dict will contain one entry or the page will return 404 Not Found.

API_POST(courseid, taskid)[source]

Creates a new submissions. Takes as (POST) input the key of the subproblems, with the value assigned each time.

Returns

  • an error 400 Bad Request if all the input is not (correctly) given,

  • an error 403 Forbidden if you are not allowed to create a new submission for this task

  • an error 404 Not found if the course/task id not found

  • an error 500 Internal server error if the grader is not available,

  • 200 Ok, with {“submissionid”: “the submission id”} as output.

methods: t.ClassVar[t.Collection[str] | None] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.

inginious.frontend.pages.api.tasks module

Tasks

class inginious.frontend.pages.api.tasks.APITasks[source]

Bases: APIAuthenticatedPage

Endpoint
/api/v0/courses/[a-zA-Z_\-\.0-9]+/tasks(/[a-zA-Z_\-\.0-9]+)?
API_GET(courseid, taskid)[source]

List tasks available to the connected client. Returns a dict in the form

{
    "taskid1":
    {
        "name": "Name of the course",     #the name of the course
        "authors": [],
        "contact_url": "",
        "deadline": "",
        "status": "success"               # can be "succeeded", "failed" or "notattempted"
        "grade": 0.0,
        "context": ""                     # context of the task, in RST
        "problems":                       # dict of the subproblems
        {
                                          # see the format of task.yaml for the content of the dict. Contains everything but
                                          # responses of multiple-choice and match problems.
        }
    }
    #...
}

If you use the endpoint /api/v0/courses/the_course_id/tasks/the_task_id, this dict will contain one entry or the page will return 404 Not Found.

methods: t.ClassVar[t.Collection[str] | None] = {'GET', 'POST'}

The methods this view is registered for. Uses the same default (["GET", "HEAD", "OPTIONS"]) as route and add_url_rule by default.