courses Routes - SmartBeansGoe/smartbeans-backend GitHub Wiki

/courses-Routes

GET /courses/<course>/meta

Output

{
  "name": <String>,
  "title": <String>,
  "config": {
    ...
  }
}

Errors

  • 404: Invalid course

GET /courses/<course>/progress

Returns all solved tasks as a list of taskids. Requires header Authorization: Bearer <valid (session) token>.

Output

[<Integer>, ...]

Errors

  • 400: Invalid header format
  • 401: Invalid token
  • 403: Course does not correspond with session course

GET /courses/<course>/tasks

Returns a list of all tasks for the given course.

Output

[
  {
    "taskid": <Integer>,
    "task_description": <String>,
    "lang": <String>,
    "tags": <String>,
    "order_by": <Integer>,
    "prerequisites": <String>
  },
  ...
]

Errors

  • 404: Invalid course

GET /courses/<course>/tasks/<taskid>

Returns a single task.

Output

{
  "taskid": <Integer>,
  "task_description": <String>,
  "lang": <String>,
  "tags": <String>,
  "order_by": <Integer>,
  "prerequisites": <String>
}

Errors

  • 404: Invalid course or task id

GET /courses/<course>/tasks/all/submissions

Returns all submissions for the user in this course. Requires header Authorization: Bearer <valid (session) token>.

Output

[
  {
    "id": <Integer>,
    "taskid": <Integer>,
    "timestamp": <Integer>,
    "content": <String>,
    "result_type" <String>,
    "simplified": {
      "compiler": {
        "stdout": <String>,
        "statusCode": <Integer>
      },
      "testCase": {
        "stdin": <String>,
        "stdout": <String>,
        "expectedStdout": <String>,
        "statusCode": <Integer>
      }
    },
    "score": <Float>
  },
  ...
]

Errors

  • 400: Invalid header format
  • 401: Invalid token
  • 403: Course does not correspond with session course

GET /courses/<course>/tasks/<taskid>/submissions

Returns the submissions for the user in this course and a given task. Requires header Authorization: Bearer <valid (session) token>. Returns an empty array if the taskid is invalid.

Output

[
  {
    "id": <Integer>,
    "taskid": <Integer>,
    "timestamp": <Integer>,
    "content": <String>,
    "result_type" <String>,
    "simplified": {
      "compiler": {
        "stdout": <String>,
        "statusCode": <Integer>
      },
      "testCase": {
        "stdin": <String>,
        "stdout": <String>,
        "expectedStdout": <String>,
        "statusCode": <Integer>
      }
    },
    "score": <Float>
  },
  ...
]

Errors

  • 400: Invalid header format
  • 401: Invalid token
  • 403: Course does not correspond with session course

GET /courses/<course>/tasks/<taskid>/submissions/<submissionid>

Returns a specific submission for the user in this course. Requires header Authorization: Bearer <valid (session) token>.

Output

{
  "id": <Integer>,
  "taskid": <Integer>,
  "timestamp": <Integer>,
  "content": <String>,
  "result_type" <String>,
  "simplified": {
    "compiler": {
      "stdout": <String>,
      "statusCode": <Integer>
    },
    "testCase": {
      "stdin": <String>,
      "stdout": <String>,
      "expectedStdout": <String>,
      "statusCode": <Integer>
    }
  },
  "score": <Float>
}

Errors

  • 400: Invalid header format
  • 401: Invalid token
  • 403: Course does not correspond with session course
  • 404: Submission not found

POST /courses/<course>/tasks/<taskid>/submissions

Submits a solution to the sandbox. Returns 200 on success. Requires header Authorization: Bearer <valid (session) token>.

Input

{
  "submission": <String>
}

Output

-

Errors

  • 400: Invalid header or body format
  • 401: Invalid token
  • 403: Course does not correspond with session course
⚠️ **GitHub.com Fallback** ⚠️