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:
inginious.frontend.pages.api._api_page.APIPage
Endpoint /api/v0/auth_methods
-
API_GET
()[source]¶ Returns all the auth methods available. (200 OK)
Response: list of auth methods. The value of the dict is an auth method, represented by:
- id
- id of the auth method
- name
- the name of the authentication method, typically displayed by the webapp
- input
a dictionary containing as key the name of the input (in the HTML sense of name), and, as value, a dictionary containing two fields:
- name
- the placeholder for the input
- type
- text or password
-
inginious.frontend.pages.api.authentication module¶
Authentication
-
class
inginious.frontend.pages.api.authentication.
APIAuthentication
[source]¶ Bases:
inginious.frontend.pages.api._api_page.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:
- auth_method_id
- an id for an auth method as returned be /api/v0/auth_methods
- input_key_1
- the first input key and its value
- input_key_2
- the first input key and its value
- …
- …
Response: a dict in the form {“status”: “success”} (200 OK) or {“status”: “error”} (403 Forbidden)
-
inginious.frontend.pages.api.courses module¶
Courses
-
class
inginious.frontend.pages.api.courses.
APICourses
[source]¶ Bases:
inginious.frontend.pages.api._api_page.APIAuthenticatedPage
Endpoint /api/v0/courses(/[a-zA-Z_-.0-9]+)?
-
API_GET
(courseid=None)[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.
-
inginious.frontend.pages.api.submissions module¶
Submissions
-
class
inginious.frontend.pages.api.submissions.
APISubmissionSingle
[source]¶ Bases:
inginious.frontend.pages.api._api_page.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.
-
-
class
inginious.frontend.pages.api.submissions.
APISubmissions
[source]¶ Bases:
inginious.frontend.pages.api._api_page.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.
-
inginious.frontend.pages.api.tasks module¶
Tasks
-
class
inginious.frontend.pages.api.tasks.
APITasks
[source]¶ Bases:
inginious.frontend.pages.api._api_page.APIAuthenticatedPage
Endpoint /api/v0/courses/[a-zA-Z_-.0-9]+/tasks(/[a-zA-Z_-.0-9]+)?
-
API_GET
(courseid, taskid=None)[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": [], "deadline": "", "status": "success" # can be "succeeded", "failed" or "notattempted" "grade": 0.0, "grade_weight": 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.
-