diff --git a/astro.config.mjs b/astro.config.mjs index a2598ea..19a17f7 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -133,12 +133,8 @@ export default defineConfig({ link: '/backend/api/units', }, { - label: 'units (1)', - link: '/backend/api/units_1', - }, - { - label: 'units (2)', - link: '/backend/api/units_2', + label: 'units id', + link: '/backend/api/units_id', }, { label: 'users', @@ -164,6 +160,14 @@ export default defineConfig({ label: 'Units Task Definition', link: '/backend/api/api-task_definitions', }, + { + label: 'learning', + link: '/backend/api/learning', + }, + { + label: 'stats', + link: '/backend/api/stats', + }, ], }, { diff --git a/package-lock.json b/package-lock.json index 9d6bd3d..e65649e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1856,9 +1856,9 @@ } }, "node_modules/@pagefind/darwin-arm64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@pagefind/darwin-arm64/-/darwin-arm64-1.1.0.tgz", - "integrity": "sha512-SLsXNLtSilGZjvqis8sX42fBWsWAVkcDh1oerxwqbac84HbiwxpxOC2jm8hRwcR0Z55HPZPWO77XeRix/8GwTg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@pagefind/darwin-arm64/-/darwin-arm64-1.1.1.tgz", + "integrity": "sha512-tZ9tysUmQpFs2EqWG2+E1gc+opDAhSyZSsgKmFzhnWfkK02YHZhvL5XJXEZDqYy3s1FAKhwjTg8XDxneuBlDZQ==", "cpu": [ "arm64" ], @@ -1868,9 +1868,9 @@ ] }, "node_modules/@pagefind/darwin-x64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@pagefind/darwin-x64/-/darwin-x64-1.1.0.tgz", - "integrity": "sha512-QjQSE/L5oS1C8N8GdljGaWtjCBMgMtfrPAoiCmINTu9Y9dp0ggAyXvF8K7Qg3VyIMYJ6v8vg2PN7Z3b+AaAqUA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@pagefind/darwin-x64/-/darwin-x64-1.1.1.tgz", + "integrity": "sha512-ChohLQ39dLwaxQv0jIQB/SavP3TM5K5ENfDTqIdzLkmfs3+JlzSDyQKcJFjTHYcCzQOZVeieeGq8PdqvLJxJxQ==", "cpu": [ "x64" ], @@ -1880,14 +1880,14 @@ ] }, "node_modules/@pagefind/default-ui": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@pagefind/default-ui/-/default-ui-1.1.0.tgz", - "integrity": "sha512-+XiAJAK++C64nQcD7s3Prdmd5S92lT05fwjOxm0L1jj80jbL+tmvcqkkFnPpoqhnicIPgcAX/Y5W0HRZnBt35w==" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@pagefind/default-ui/-/default-ui-1.1.1.tgz", + "integrity": "sha512-ZM0zDatWDnac/VGHhQCiM7UgA4ca8jpjA+VfuTJyHJBaxGqZMQnm4WoTz9E0KFcue1Bh9kxpu7uWFZfwpZZk0A==" }, "node_modules/@pagefind/linux-arm64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@pagefind/linux-arm64/-/linux-arm64-1.1.0.tgz", - "integrity": "sha512-8zjYCa2BtNEL7KnXtysPtBELCyv5DSQ4yHeK/nsEq6w4ToAMTBl0K06khqxdSGgjMSwwrxvLzq3so0LC5Q14dA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@pagefind/linux-arm64/-/linux-arm64-1.1.1.tgz", + "integrity": "sha512-H5P6wDoCoAbdsWp0Zx0DxnLUrwTGWGLu/VI1rcN2CyFdY2EGSvPQsbGBMrseKRNuIrJDFtxHHHyjZ7UbzaM9EA==", "cpu": [ "arm64" ], @@ -1897,9 +1897,9 @@ ] }, "node_modules/@pagefind/linux-x64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@pagefind/linux-x64/-/linux-x64-1.1.0.tgz", - "integrity": "sha512-4lsg6VB7A6PWTwaP8oSmXV4O9H0IHX7AlwTDcfyT+YJo/sPXOVjqycD5cdBgqNLfUk8B9bkWcTDCRmJbHrKeCw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@pagefind/linux-x64/-/linux-x64-1.1.1.tgz", + "integrity": "sha512-yJs7tTYbL2MI3HT+ngs9E1BfUbY9M4/YzA0yEM5xBo4Xl8Yu8Qg2xZTOQ1/F6gwvMrjCUFo8EoACs6LRDhtMrQ==", "cpu": [ "x64" ], @@ -1909,9 +1909,9 @@ ] }, "node_modules/@pagefind/windows-x64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@pagefind/windows-x64/-/windows-x64-1.1.0.tgz", - "integrity": "sha512-OboCM76BcMKT9IoSfZuFhiqMRgTde8x4qDDvKulFmycgiJrlL5WnIqBHJLQxZq+o2KyZpoHF97iwsGAm8c32sQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@pagefind/windows-x64/-/windows-x64-1.1.1.tgz", + "integrity": "sha512-b7/qPqgIl+lMzkQ8fJt51SfguB396xbIIR+VZ3YrL2tLuyifDJ1wL5mEm+ddmHxJ2Fki340paPcDan9en5OmAw==", "cpu": [ "x64" ], @@ -3796,9 +3796,9 @@ "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==" }, "node_modules/dset": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/dset/-/dset-3.1.3.tgz", - "integrity": "sha512-20TuZZHCEZ2O71q9/+8BwKwZ0QtD9D8ObhrihJPr+vLLYlSuAU3/zL4cSlgbfeoGHTjCSJBa7NGcrF9/Bx/WJQ==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/dset/-/dset-3.1.4.tgz", + "integrity": "sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA==", "engines": { "node": ">=4" } @@ -6059,9 +6059,9 @@ ] }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -6356,18 +6356,18 @@ } }, "node_modules/pagefind": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pagefind/-/pagefind-1.1.0.tgz", - "integrity": "sha512-1nmj0/vfYcMxNEQj0YDRp6bTVv9hI7HLdPhK/vBBYlrnwjATndQvHyicj5Y7pUHrpCFZpFnLVQXIF829tpFmaw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pagefind/-/pagefind-1.1.1.tgz", + "integrity": "sha512-U2YR0dQN5B2fbIXrLtt/UXNS0yWSSYfePaad1KcBPTi0p+zRtsVjwmoPaMQgTks5DnHNbmDxyJUL5TGaLljK3A==", "bin": { "pagefind": "lib/runner/bin.cjs" }, "optionalDependencies": { - "@pagefind/darwin-arm64": "1.1.0", - "@pagefind/darwin-x64": "1.1.0", - "@pagefind/linux-arm64": "1.1.0", - "@pagefind/linux-x64": "1.1.0", - "@pagefind/windows-x64": "1.1.0" + "@pagefind/darwin-arm64": "1.1.1", + "@pagefind/darwin-x64": "1.1.1", + "@pagefind/linux-arm64": "1.1.1", + "@pagefind/linux-x64": "1.1.1", + "@pagefind/windows-x64": "1.1.1" } }, "node_modules/parse-entities": { @@ -6441,9 +6441,9 @@ } }, "node_modules/path-to-regexp": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", - "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==" + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==" }, "node_modules/periscopic": { "version": "3.1.0", @@ -6456,9 +6456,9 @@ } }, "node_modules/picocolors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -6491,9 +6491,9 @@ } }, "node_modules/postcss": { - "version": "8.4.40", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.40.tgz", - "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==", + "version": "8.4.47", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", + "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", "funding": [ { "type": "opencollective", @@ -6510,8 +6510,8 @@ ], "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" + "picocolors": "^1.1.0", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -7858,9 +7858,9 @@ } }, "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "engines": { "node": ">=0.10.0" } @@ -8405,13 +8405,13 @@ } }, "node_modules/vite": { - "version": "5.3.5", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.5.tgz", - "integrity": "sha512-MdjglKR6AQXQb9JGiS7Rc2wC6uMjcm7Go/NHNO63EwiJXfuk9PgqiP/n5IDJCziMkfw9n4Ubp7lttNwz+8ZVKA==", + "version": "5.4.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.7.tgz", + "integrity": "sha512-5l2zxqMEPVENgvzTuBpHer2awaetimj2BGkhBPdnwKbPNOlHsODU+oiazEZzLK7KhAnOrO+XGYJYn4ZlUhDtDQ==", "dependencies": { "esbuild": "^0.21.3", - "postcss": "^8.4.39", - "rollup": "^4.13.0" + "postcss": "^8.4.43", + "rollup": "^4.20.0" }, "bin": { "vite": "bin/vite.js" @@ -8430,6 +8430,7 @@ "less": "*", "lightningcss": "^1.21.0", "sass": "*", + "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.4.0" @@ -8447,6 +8448,9 @@ "sass": { "optional": true }, + "sass-embedded": { + "optional": true + }, "stylus": { "optional": true }, diff --git a/src/content/docs/backend/API/api-task_definitions.md b/src/content/docs/backend/API/api-task_definitions.md index aa4ade3..05eac6a 100644 --- a/src/content/docs/backend/API/api-task_definitions.md +++ b/src/content/docs/backend/API/api-task_definitions.md @@ -20,6 +20,13 @@ This "units" API has the following operations. - **DELETE**: /api/units/{unit_id}/task_definitions/{task_def_id}/task_assessment_resources - **GET**: /api/units/{unit_id}/task_definitions/{task_def_id}/task_assessment_resources - **POST**: /api/units/{unit_id}/task_definitions/{task_def_id}/task_assessment_resources +- **GET** /api/units/{unit_id}/task_definitions/{task_def_id}/task_pdf +- **GET** /api/units/{unit_id}/task_definitions/{task_def_id}/tasks +- **POST** /api/units/{unit_id}/task_definitions/task_pdfs +- **DELETE** /api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet +- **DELETE** /api/units/{unit_id}/task_definitions/{id} +- **PUT** /api/units/{unit_id}/task_definitions/{id} +- **POST** /api/units/{unit_id}/task_definitions ## Detail of Operations related to units. @@ -354,4 +361,595 @@ GET /api/units/{unit_id}/task_definitions/{task_def_id}/task_assessment_resource - Response body: ``` - ``` \ No newline at end of file + ``` + ### GET: Download the task sheet containing the details related to performing that task +GET /api/units/{unit_id}/task_definitions/{task_def_id}/task_pdf + +- URL: `/api/units/{unit_id}/task_definitions/{task_def_id}/task_pdf` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |---------------|--------------------------------------------|----------------|-----------|-----------| + | unit_id | The unit to upload tasks for | path | integer | Yes | + | task_def_id | The task definition to get the PDF of | path | integer | Yes | + | as_attachment | Whether or not to download file as attachment. Default is false. | query | boolean | No | + | Username | Username of the user | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + +- Response: `200` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/pdf' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' 'http://localhost:3000/api/units/1/task_definitions/1/task_pdf?as_attachment=true' + + ``` +- Response Body: + ``` + Download task_pdf?as_attachment=true + ``` + + +-------------------------------------------------------------------- + +### GET: Download the tasks related to a task definition +GET /api/units/{unit_id}/task_definitions/{task_def_id}/tasks + +- URL: `/api/units/{unit_id}/task_definitions/{task_def_id}/tasks` +- Method: `GET` +- Parameter: + +| Parameter | Description | Parameter Type | Data Type | Mandatory | +|---------------|---------------------------------------|----------------|-----------|-----------| +| unit_id | The unit containing the task definition | path | integer | Yes | +| task_def_id | The task definition's id | path | integer | Yes | +| Username | Username of the user | header | string | Yes | +| Auth_Token | Authentication token | header | string | Yes | + +- Response: `200` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: Ym3A6yiuucA-82kcxcgF' 'http://localhost:3000/api/units/1/task_definitions/1/tasks' + ``` +- Response Body: + ```json + [ + { + "project_id": 2, + "id": 12, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-22", + "submission_date": "2024-04-20T10:56:18.978Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 3, + "id": 31, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-21", + "submission_date": "2024-04-20T10:56:24.059Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 4, + "id": 45, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-16", + "submission_date": "2024-04-20T10:57:04.514Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 5, + "id": 63, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-21", + "submission_date": "2024-04-20T10:57:35.703Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 7, + "id": 86, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-19", + "submission_date": "2024-04-20T10:58:28.084Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 8, + "id": 105, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-16", + "submission_date": "2024-04-20T10:58:33.116Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 9, + "id": 127, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-16", + "submission_date": "2024-04-20T10:58:38.421Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 10, + "id": 146, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-17", + "submission_date": "2024-04-20T10:58:43.259Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 11, + "id": 165, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-23", + "submission_date": "2024-04-20T10:59:13.681Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 12, + "id": 177, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-23", + "submission_date": "2024-04-20T10:59:16.725Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 13, + "id": 201, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-19", + "submission_date": "2024-04-20T10:59:22.471Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 15, + "id": 226, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-18", + "submission_date": "2024-04-20T10:59:48.270Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 16, + "id": 245, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-23", + "submission_date": "2024-04-20T10:59:53.349Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 17, + "id": 269, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-19", + "submission_date": "2024-04-20T11:00:28.887Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 18, + "id": 288, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "complete", + "completion_date": "2024-03-20", + "submission_date": "2024-04-20T11:00:33.670Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 14, + "id": 223, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "working_on_it", + "completion_date": null, + "submission_date": "2024-04-20T10:59:27.895Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 6, + "id": 77, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "redo", + "completion_date": null, + "submission_date": "2024-04-20T10:58:04.345Z", + "times_assessed": 1, + "similarity_flag": false, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + }, + { + "project_id": 1, + "id": 3, + "task_definition_id": 1, + "tutorial_id": null, + "tutorial_stream_id": null, + "status": "demonstrate", + "completion_date": "2024-03-18", + "submission_date": "2024-04-20T10:56:15.653Z", + "times_assessed": 1, + "similarity_flag": true, + "grade": null, + "quality_pts": -1, + "has_extensions": 0 + } + ] + ``` + +-------------------------------------------------------------------------------------------------- + +### POST: Upload a zip file containing the task pdfs for a given task +POST /api/units/{unit_id}/task_definitions/task_pdfs + +- URL: `/api/units/{unit_id}/task_definitions/task_pdfs` +- Method: `POST` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |-----------|-------------------------------|----------------|-----------|-----------| + | unit_id | The unit to upload tasks for | path | integer | Yes | + | file | Batch file upload | formData | file | Yes | + | Username | Username | header | string | Yes | + | Auth_Token| Authentication token | header | string | Yes | + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: S8Qzr1uoToYidkezNeZL' -F file=@"1.1P submission.zip" 'http://localhost:3000/api/units/1/task_definitions/task_pdfs' + ``` +- Response Body: + ```json + { + "success": [ + { + "row": "1.1P submission.pdf", + "message": "Added as task 1.1P" + } + ], + "errors": [], + "ignored": [] + } + ``` + +-------------------------------------------------------------------------------------------- +### DELETE: Remove the task sheet for a given task +DELETE /api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet + +- URL: `/api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet` +- Method: `DELETE` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |-------------|----------------------------|----------------|-----------|-----------| + | unit_id | The related unit | path | integer | Yes | + | task_def_id | The related task definition| path | integer | Yes | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + +- Response: `204` + +- Example Request: + ```bash + curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/task_definitions/12/task_sheet' + ``` +- Response Body: + ``` + true + ``` +---------------------------------------------------------------------------------- +### POST: Upload the task sheet for a given task +POST /api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet + +- URL: `/api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet` +- Method: `POST` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |-------------|-------------------------------|----------------|-----------|-----------| + | unit_id | The related unit | path | integer | Yes | + | task_def_id | The related task definition | path | integer | Yes | + | file | The task sheet pdf | formData | file | Yes | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: S8Qzr1uoToYidkezNeZL' -F file=@"1.1P submission.pdf" 'http://localhost:3000/api/units/1/task_definitions/1/task_sheet' + ``` +- Response Body: + ``` + true + ``` + + +### DELETE: Delete a task definition +DELETE /api/units/{unit_id}/task_definitions/{id} + +- URL: `/api/units/{unit_id}/task_definitions/{id}` +- Method: `DELETE` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |-----------|-------------|----------------|-----------|-----------| + | Username | Username of the user | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | unit_id | ID of the unit | header | integer | Yes | + | id | ID of the task | path | integer | Yes | + + +- Response: `204` + +- Example Request: + ```bash + curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/task_definitions/1' + ``` +- Response Body: + ``` + true + ``` + + +--------------------------------------------------------------------- + +### PUT: Edits the given task definition +- **PUT** /api/units/{unit_id}/task_definitions/{id} + +- URL: `/api/units/{unit_id}/task_definitions/{id}` +- Method: `PUT` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type |Mandatory| + |--------------------------|-----------------------------------------------------------|----------------|-----------|--| + | id | (required) The task id to edit | path | integer |Yes| + | task_def[tutorial_stream_abbr] | The abbreviation of the tutorial stream | formData | string | | + | task_def[name] | The name of this task def | formData | string | | + | task_def[description] | The description of this task def | formData | string | | + | task_def[weighting] | The weighting of this task | formData | integer | | + | task_def[target_grade] | Target grade for task | formData | integer | | + | task_def[group_set_id] | Related group set | formData | integer | | + | task_def[start_date] | The date when the task should be started | formData | date | | + | task_def[target_date] | The date when the task is due | formData | date | | + | task_def[due_date] | The deadline date | formData | date | | + | task_def[abbreviation] | The abbreviation of the task | formData | string | | + | task_def[restrict_status_updates] | Restrict updating of the status to staff | formData | boolean | | + | task_def[upload_requirements] | Task file upload requirements | formData | string | | + | task_def[plagiarism_checks] | The list of checks to perform | formData | string | | + | task_def[plagiarism_warn_pct] | The percent at which to record and warn about plagiarism | formData | integer | | + | task_def[is_graded] | Whether or not this task definition is a graded task | formData | boolean | | + | task_def[max_quality_pts] | A range for quality points when quality is assessed | formData | integer | | + | task_def[assessment_enabled] | Enable or disable assessment | formData | boolean | | + | task_def[overseer_image_id] | The id of the Docker image name for overseer | formData | integer | | + | Username | (required) Username | header | string | Yes| + | Auth_Token | (required) Authentication token | header | string | Yes| + | unit_id | (required) | header | integer |Yes | + +- Response: `200` + +- Example Request: + ```bash + curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' -d 'task_def%5Boverseer_image_id%5D=6578' 'http://localhost:3000/api/units/1/task_definitions/1' + ``` +- Response Body: + ```json + { + "id": 1, + "abbreviation": "1.1P", + "name": "Pass Task 1.1 - Hello World", + "description": "As a first step, create the classic 'Hello World' program. This will help ensure that you have all of the software installed correctly, and are ready to move on with creating other,,, programs.", + "weighting": 1, + "target_grade": 0, + "target_date": "2024-03-19", + "due_date": "2024-04-08", + "start_date": "2024-03-12", + "upload_requirements": [ + { + "key": "file0", + "name": "HelloWorld.pas", + "type": "code" + }, + { + "key": "file1", + "name": "Screenshot", + "type": "image" + } + ], + "tutorial_stream_abbr": "wrkshop-1", + "plagiarism_checks": null, + "plagiarism_warn_pct": 90, + "restrict_status_updates": false, + "group_set_id": null, + "has_task_sheet": true, + "has_task_resources": true, + "has_task_assessment_resources": false, + "is_graded": false, + "max_quality_pts": 0, + "overseer_image_id": 6578, + "assessment_enabled": false, + "moss_language": null + } + ``` + + +---------------------------------------------------------------------- + +### POST: Add a new task definition to the given unit +POST /api/units/{unit_id}/task_definitions + +- URL: `/api/units/{unit_id}/task_definitions` +- Method: `POST` +- Parameter: + + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |------------------------------------|--------------------------------------------------------|----------------|-----------|-----------| + | task_def[tutorial_stream_abbr] | The abbreviation of tutorial stream | formData | string | No | + | task_def[name] | The name of this task def | formData | string | Yes | + | task_def[description] | The description of this task def | formData | string | Yes | + | task_def[weighting] | The weighting of this task | formData | integer | Yes | + | task_def[target_grade] | Minimum grade for task | formData | integer | Yes | + | task_def[group_set_id] | Related group set | formData | integer | No | + | task_def[start_date] | The date when the task should be started | formData | date | Yes | + | task_def[target_date] | The date when the task is due | formData | date | Yes | + | task_def[due_date] | The deadline date | formData | date | No | + | task_def[abbreviation] | The abbreviation of the task | formData | string | Yes | + | task_def[restrict_status_updates] | Restrict updating of the status to staff | formData | boolean | No | + | task_def[upload_requirements] | Task file upload requirements | formData | string | No | + | task_def[plagiarism_checks] | The list of checks to perform | formData | string | No | + | task_def[plagiarism_warn_pct] | The percent at which to record and warn about plagiarism | formData | integer | Yes | + | task_def[is_graded] | Whether or not this task definition is a graded task | formData | boolean | No | + | task_def[max_quality_pts] | A range for quality points when quality is assessed | formData | integer | Yes | + | task_def[assessment_enabled] | Enable or disable assessment | formData | boolean | No | + | task_def[overseer_image_id] | The id of the Docker image for overseer | formData | integer | No | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | unit_id | The id for the unit | path | integer | Yes | + + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: text/error' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' -d 'task_def%5Bname%5D=test_test123&task_def%5Bdescription%5D=test_test1234&task_def%5Bweighting%5D=55&task_def%5Btarget_grade%5D=0&task_def%5Bstart_date%5D=2024-06-09T00%3A00%3A00.000Z&task_def%5Btarget_date%5D=2024-09-20T00%3A00%3A00.000Z&task_def%5Babbreviation%5D=test_test123&task_def%5Brestrict_status_updates%5D=true&task_def%5Bplagiarism_warn_pct%5D=40&task_def%5Bis_graded%5D=true&task_def%5Bmax_quality_pts%5D=99' 'http://localhost:3000/api/units/1/task_definitions' + ``` +- Response Body: + ```json + { + "id": 1234, + "name": "Assignment 1", + "description": "This is the first assignment", + "weighting": 10, + "target_grade": 80, + "group_set_id": 5678, + "start_date": "2024-06-01", + "target_date": "2024-06-30", + "due_date": "2024-07-05", + "abbreviation": "ASS1", + "restrict_status_updates": true, + "upload_requirements": "PDF only", + "plagiarism_checks": "Turnitin", + "plagiarism_warn_pct": 20, + "is_graded": true, + "max_quality_pts": 5, + "assessment_enabled": true, + "overseer_image_id": 9876 + } + ``` + + + +---------------------------------------------------------------------- \ No newline at end of file diff --git a/src/content/docs/backend/API/learning.md b/src/content/docs/backend/API/learning.md new file mode 100644 index 0000000..3f02b28 --- /dev/null +++ b/src/content/docs/backend/API/learning.md @@ -0,0 +1,405 @@ +--- +title: Doubtfire API +--- + +# List of Doubtfire + +# API: Units - Learning Alignments + +Units : Operations about Units + +This markdown document provides detailed documentation for the "learning alignments" API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl. + +This "Units" API page has the following operations. + +- **GET** /api/units/{unit_id}/learning_alignments/class_details +- **GET** /api/units/{unit_id}/learning_alignments/class_stats +- **DELETE** /api/units/{unit_id}/learning_alignments/{id} +- **PUT** /api/units/{unit_id}/learning_alignments/{id} +- **GET** /api/units/{unit_id}/learning_alignments +- **POST** /api/units/{unit_id}/learning_alignments +- **GET** /api/units/{unit_id}/learning_alignments/csv +- **POST** /api/units/{unit_id}/learning_alignments/csv + +### GET: Return unit learning alignment values with median stats for each tutorial +GET /api/units/{unit_id}/learning_alignments/class_details + +- URL: `/api/units/{unit_id}/learning_alignments/class_details` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |------------|------------------------|----------------|-----------|-----------| + | unit_id | The id of the unit | path | integer | Yes | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + +- Response: `200 OK` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: H8jTVdiyWzBz28cqkgDe' 'http://localhost:3000/api/units/1/learning_alignments/class_details' + ``` +- Response Body: + ```json + { + "1": { + "1": { + "median": 10.5, + "lower": 8.4, + "upper": 29.4, + "min": 8.2, + "max": 33 + }, + "2": { + "median": 22.4, + "lower": 11.4, + "upper": 31.5, + "min": 7.8, + "max": 39.6 + }, + "3": { + "median": 14.6, + "lower": 11.6, + "upper": 31.4, + "min": 10.8, + "max": 41.2 + }, + "4": { + "median": 4.8, + "lower": 0.8, + "upper": 8.3, + "min": 0.8, + "max": 8.8 + } + }, + "3": { + "1": { + "median": 37.3, + "lower": 31, + "upper": 52, + "min": 0.7, + "max": 54.4 + }, + "2": { + "median": 41.5, + "lower": 38, + "upper": 64.5, + "min": 0.7, + "max": 70.5 + }, + "3": { + "median": 42.9, + "lower": 38.5, + "upper": 52.5, + "min": 0.7, + "max": 54.3 + }, + "4": { + "median": 10.4, + "lower": 5.1, + "upper": 15, + "min": 0, + "max": 16 + } + }, + } + ``` + +----------------------------------------------------------------------- + +### GET: Return unit learning alignment median values +GET /api/units/{unit_id}/learning_alignments/class_stats + +- URL: `/api/units/{unit_id}/learning_alignments/class_stats` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |------------|--------------------------------------|----------------|-----------|-----------| + | unit_id | The id of the unit | path | integer | Yes | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + + +- Response: `200` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 9v88UUcnEy1cN7jyvUTK' 'http://localhost:3000/api/units/1/learning_alignments/class_stats' + ``` +- Response Body: + ```json + { + "1": { + "median": 33.7, + "lower": 10.6, + "upper": 40, + "min": 0.7, + "max": 54.4 + }, + "2": { + "median": 39.6, + "lower": 22.4, + "upper": 46.3, + "min": 0.7, + "max": 70.5 + }, + "3": { + "median": 40.7, + "lower": 14.6, + "upper": 48.3, + "min": 0.7, + "max": 54.7 + }, + "4": { + "median": 7.7, + "lower": 3.7, + "upper": 13.2, + "min": 0, + "max": 16 + } + } + ``` + + +------------------------------------------------------------------------ + +### DELETE: Delete the alignment between a task and unit outcome +- **DELETE** /api/units/{unit_id}/learning_alignments/{id} + +- URL: `/api/units/{unit_id}/learning_alignments/{id}` +- Method: `DELETE` +- Parameter: + + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |--------------|--------------------------------------------------------|----------------|-----------|-----------| + | id | The id of the task alignment | path | integer | Yes | + | unit_id | The id of the unit | path | integer | Yes | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + + +- Response: `204` + +- Example Request: + ```bash + curl -X DELETE --header 'Accept: text/error' --header 'Username: aadmin' --header 'Auth_Token: 9v88UUcnEy1cN7jyvUTK' 'http://localhost:3000/api/units/5/learning_alignments/1' + ``` +- Response Body: + ``` + true + ``` + + +----------------------------------------------------------------------- + +### PUT: Update the alignment between a task and unit outcome +PUT /api/units/{unit_id}/learning_alignments/{id} + + +- URL: `/api/units/{unit_id}/learning_alignments/{id}` +- Method: `PUT` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |--------------|--------------------------------------------------------|----------------|-----------|-----------| + | id | The id of the task alignment | path | integer | Yes | + | unit_id | The id of the unit | path | integer | Yes | + | description | The description of the alignment | formData | string | No | + | rating | The rating for this link, indicating the strength of this alignment | formData | integer | No | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + + +- Response: `200` + +- Example Request: + ```bash + curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 9v88UUcnEy1cN7jyvUTK' -d 'description=aligntest&rating=5' 'http://localhost:3000/api/units/1/learning_alignments/1' + ``` +- Response Body: + ```json + { + "id": 1, + "description": "aligntest", + "rating": 5, + "learning_outcome_id": 2, + "task_definition_id": 1 + } + ``` + + +------------------------------------------------------------------------ +### GET: Get the task/outcome alignment details for a unit or a project +GET /api/units/{unit_id}/learning_alignments + +- URL: `/api/units/{unit_id}/learning_alignments` +- Method: `GET` +- Parameter: + + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |------------|-----------------------------------------------------|----------------|-----------|-----------| + | unit_id | The id of the unit | path | integer | Yes | + | project_id | The id of the student project to get the alignment from | query | integer | Yes | + | Username | User Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + + +- Response: `200` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: mRHxyNJYkdxiCushUmm_' 'http://localhost:3000/api/units/1/learning_alignments?project_id=1' + ``` +- Response Body: + ```json + [ + { + "id": 104, + "description": "Simulated rationale text...", + "rating": 5, + "learning_outcome_id": 1, + "task_definition_id": 1, + "task_id": 3 + }, + { + "id": 105, + "description": "Simulated rationale text...", + "rating": 5, + "learning_outcome_id": 1, + "task_definition_id": 2, + "task_id": 4 + }, + { + "id": 106, + "description": "Simulated rationale text...", + "rating": 3, + "learning_outcome_id": 3, + "task_definition_id": 2, + "task_id": 4 + }, + { + "id": 107, + "description": "Simulated rationale text...", + "rating": 3, + "learning_outcome_id": 4, + "task_definition_id": 2, + "task_id": 4 + }, + { + "id": 108, + "description": "Simulated rationale text...", + "rating": 4, + "learning_outcome_id": 3, + "task_definition_id": 3, + "task_id": 5 + }, + ] + ``` + +----------------------------------------------------------------------------------- + +### POST: Add an outcome to a unit's task definition +POST /api/units/{unit_id}/learning_alignments + +- URL: `/api/units/{unit_id}/learning_alignments` +- Method: `POST` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |--------------------|-----------------------------------------------------|----------------|-----------|-----------| + | unit_id | The id of the unit | path | integer | Yes | + | learning_outcome_id | The id of the learning outcome | formData | integer | Yes | + | task_definition_id | The id of the task definition | formData | integer | Yes | + | project_id | The id of the project if this is a self reflection | formData | integer | Yes | + | description | The ILOs description | formData | string | Yes | + | rating | The rating for this link, indicating the strength of this alignment | formData | integer | Yes | + | Username | User username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: mRHxyNJYkdxiCushUmm_' -d 'learning_outcome_id=2&task_definition_id=2&project_id=1&description=test_ILO&rating=5' 'http://localhost:3000/api/units/1/learning_alignments' + ``` +- Response Body: + ```json + { + "id": 684, + "description": "test_ILO", + "rating": 5, + "learning_outcome_id": 2, + "task_definition_id": 2, + "task_id": 4 + } + ``` + +------------------------------------------------------------------------------------------------------ + +### GET: Download CSV of task alignments in this unit + +GET /api/units/{unit_id}/learning_alignments/csv + +- URL: `/api/units/{unit_id}/learning_alignments/csv` +- Method: `GET` +- Parameter: + + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |------------|--------------------------------------------|----------------|-----------|-----------| + | unit_id | The id of the unit | path | integer | Yes | + | project_id | The id of the student project to get from | query | integer | No | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + + +- Response: `200` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/octet-stream' --header 'Username: atutor' --header 'Auth_Token: m5s8cJP38mzC85iQz7FM' 'http://localhost:3000/api/units/1/learning_alignments/csv?project_id=1' + ``` +- Response Body: + ``` + Download csv?project_id=1 + ``` +------------------------------------------------------------------------------------------------- + + +### POST: Upload CSV of task to outcome alignments +POST /api/units/{unit_id}/learning_alignments/csv + +- URL: `/api/units/{unit_id}/learning_alignments/csv` +- Method: `POST` +- Parameter: + + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |-------------|--------------------------------------------|----------------|-----------|-----------| + | file | CSV upload file. | formData | file | | + | project_id | The id of the student project to upload the alignment to | formData | integer | | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | unit_id | The id of the unit | path | integer | Yes | + + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: m5s8cJP38mzC85iQz7FM' -F file=@"Book2.xlsx" -F project_id=1 'http://localhost:3000/api/units/1/learning_alignments/csv' + ``` +- Response Body: + ```json + { + "success": [], + "ignored": [], + "errors": [] + } + ``` +---------------------------------------------------------------- \ No newline at end of file diff --git a/src/content/docs/backend/API/stats.md b/src/content/docs/backend/API/stats.md new file mode 100644 index 0000000..5024061 --- /dev/null +++ b/src/content/docs/backend/API/stats.md @@ -0,0 +1,239 @@ +--- +title: Doubtfire API +--- + +# List of Doubtfire + +# API: Stats + +tutorials : Operations about tutorials +This markdown document provides detailed documentation for the "Stats" API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl. + +This "Units" API has the following operations. + +- **GET** /api/units/{id}/stats/task_completion_stats +- **GET** /api/units/{id}/stats/task_status_pct +- **GET** /api/units/{id}/stats/student_target_grade + +### GET: Download stats related to the number of completed tasks + +GET /api/units/{id}/stats/task_completion_stats + +- URL: `/api/units/{id}/stats/task_completion_stats` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | -------------------- | -------------- | --------- | --------- | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | id | The project id | path | integer | Yes | + +- Response: `200 OK` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/stats/task_completion_stats' + ``` +- Response Body: + + ```json + { + "unit": { + "median": 13, + "lower": 12, + "upper": 17, + "min": 2, + "max": 19 + }, + "tutorial": { + "1": { + "median": 11, + "lower": 2, + "upper": 13, + "min": 2, + "max": 13 + }, + "3": { + "median": 16, + "lower": 13, + "upper": 17, + "min": 12, + "max": 17 + } + }, + "grade": { + "0": { + "median": 11, + "lower": 8, + "upper": 11, + "min": 8, + "max": 11 + }, + "1": { + "median": 17, + "lower": 13, + "upper": 17, + "min": 13, + "max": 17 + }, + "2": { + "median": 7.5, + "lower": 2, + "upper": 13, + "min": 2, + "max": 13 + }, + "3": { + "median": 13, + "lower": 13, + "upper": 17, + "min": 2, + "max": 19 + } + } + } + ``` + +--- + +### GET: Download stats related to the status of students with tasks + +GET /api/units/{id}/stats/task_status_pct + +- URL: `/api/units/{id}/stats/task_status_pct` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | -------------------- | -------------- | --------- | --------- | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | id | The project id | path | integer | Yes | + +- Response: `200 OK` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/stats/task_status_pct' + ``` +- Response Body: + ```json + { + "1": { + "1": [ + { + "tutorial_stream_id": null, + "status": "complete", + "num": 4 + }, + { + "tutorial_stream_id": null, + "status": "redo", + "num": 1 + }, + { + "tutorial_stream_id": null, + "status": "demonstrate", + "num": 1 + } + ] + } + } + ``` + +--- + +### GET: Download the stats related to the number of students aiming for each grade + +GET /api/units/{id}/stats/student_target_grade + +- URL: `/api/units/{id}/stats/student_target_grade` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | -------------------- | -------------- | --------- | --------- | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | id | The project id | path | integer | Yes | + +- Response: `200 OK` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/stats/student_target_grade' + ``` +- Response Body: + ```json + [ + { + "tutorial_id": null, + "tutorial_stream_id": null, + "grade": 0, + "num": 1 + }, + { + "tutorial_id": null, + "tutorial_stream_id": null, + "grade": 1, + "num": 1 + }, + { + "tutorial_id": null, + "tutorial_stream_id": null, + "grade": 2, + "num": 1 + }, + { + "tutorial_id": null, + "tutorial_stream_id": null, + "grade": 3, + "num": 3 + }, + { + "tutorial_id": 1, + "tutorial_stream_id": 4, + "grade": 0, + "num": 2 + }, + { + "tutorial_id": 1, + "tutorial_stream_id": 4, + "grade": 1, + "num": 1 + }, + { + "tutorial_id": 1, + "tutorial_stream_id": 4, + "grade": 2, + "num": 1 + }, + { + "tutorial_id": 1, + "tutorial_stream_id": 4, + "grade": 3, + "num": 2 + }, + { + "tutorial_id": 3, + "tutorial_stream_id": 3, + "grade": 0, + "num": 1 + }, + { + "tutorial_id": 3, + "tutorial_stream_id": 3, + "grade": 1, + "num": 1 + }, + { + "tutorial_id": 3, + "tutorial_stream_id": 3, + "grade": 3, + "num": 4 + } + ] + ``` + +--- diff --git a/src/content/docs/backend/API/tutorials.md b/src/content/docs/backend/API/tutorials.md index 6229186..61e5cad 100644 --- a/src/content/docs/backend/API/tutorials.md +++ b/src/content/docs/backend/API/tutorials.md @@ -1,10 +1,11 @@ --- -title: Doubtfire API +title: Doubtfire API --- -# List of Doubtfire +# List of Doubtfire + +# API: tutorials -# API: tutorials tutorials : Operations about tutorials This markdown document provides detailed documentation for the "tutorials" API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl. @@ -13,110 +14,174 @@ This "tutorials" API has the following operations. - **DELETE** /api/tutorials/{id} - **PUT** /api/tutorials/{id} - **POST** /api/tutorials - +- **DELETE** /api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id} +- **POST** /api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id} ## Detail of Operations related to users. ### DELETE: Delete a tutorial + DELETE /api/tutorials/{id} - URL: `/api/tutorials/{id}` - Method: `DELETE` -- Parameters: - | Parameter | Description |Parameter Type| Data Type|Mandatory| - |---------------------|-----------------|------------|------------|---| - |id | | path | integer|Yes| - |Username | User username | header | string |Yes| - |Auth_Token | Authentication token | header | string |Yes| - +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |---------------------|-----------------|------------|------------|---| + |id | | path | integer|Yes| + |Username | User username | header | string |Yes| + |Auth_Token | Authentication token | header | string |Yes| -- Response: - `204 OK`: Tutorial deleted successfully. +- Response: + `204 OK`: Tutorial deleted successfully. - Example Request: - ```bash - curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' 'http://localhost:3000/api/campuses/6' - ``` -- Response body: - ``` - true - ``` ------------------------------------------------------------------------------ + ```bash + curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' 'http://localhost:3000/api/campuses/6' + ``` +- Response body: + ``` + true + ``` + +--- + ### PUT: Update a tutorial + PUT /api/tutorials/{id} - URL: `/api/tutorials/{id}` - Method: `PUT` -- Parameters: - | Parameter | Description |Parameter Type| Data Type|Mandatory| - |---------------------|-----------------|------------|------------|---| - | tutorial [unit_id] | Id of the unit| formData | integer|Yes| - | tutorial [tutor_id] | Id of the tutor| formData | integer|| - | tutorial [campus_id] | Id of the campus| formData | integer|| - | tutorial [capacity] | Capacity of the tutorial| formData | integer|| - |tutorial[abbreviation] | The tutorials code| formData | string|| - |tutorial[meeting_location] |The tutorials location | formData | string|| - |tutorial[meeting_day] |Day of the tutorials | formData | string|| - |tutorial[meeting_time] |Time of the tutorials | formData | string|| - |Username | User username | header | string |Yes| - |Auth_Token | Authentication token | header | string |Yes| - - -- Response: - `200 OK` +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |---------------------|-----------------|------------|------------|---| + | tutorial [unit_id] | Id of the unit| formData | integer|Yes| + | tutorial [tutor_id] | Id of the tutor| formData | integer|| + | tutorial [campus_id] | Id of the campus| formData | integer|| + | tutorial [capacity] | Capacity of the tutorial| formData | integer|| + |tutorial[abbreviation] | The tutorials code| formData | string|| + |tutorial[meeting_location] |The tutorials location | formData | string|| + |tutorial[meeting_day] |Day of the tutorials | formData | string|| + |tutorial[meeting_time] |Time of the tutorials | formData | string|| + |Username | User username | header | string |Yes| + |Auth_Token | Authentication token | header | string |Yes| + +- Response: + `200 OK` - Example Request: - ```bash - curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 3DLo9xQoiKbXb7-ViNzJ' -d 'tutorial%5Btutor_id%5D=43&tutorial%5Bcapacity%5D=45' 'http://localhost:3000/api/tutorials/1' - ``` -- Response body: - ```json - { - "id": 1, - "meeting_day": "Wednesday", - "meeting_time": "15:00", - "meeting_location": "geelong", - "abbreviation": "LA1-01", - "campus_id": 2, - "capacity": 45, - "tutorial_stream_abbr": "wrkshop-2", - "num_students": 6, - "tutor_id": 2 - } - ``` - - ------------------------------------------------------------------------------ + ```bash + curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 3DLo9xQoiKbXb7-ViNzJ' -d 'tutorial%5Btutor_id%5D=43&tutorial%5Bcapacity%5D=45' 'http://localhost:3000/api/tutorials/1' + ``` +- Response body: + ```json + { + "id": 1, + "meeting_day": "Wednesday", + "meeting_time": "15:00", + "meeting_location": "geelong", + "abbreviation": "LA1-01", + "campus_id": 2, + "capacity": 45, + "tutorial_stream_abbr": "wrkshop-2", + "num_students": 6, + "tutor_id": 2 + } + ``` + +--- ### POST: Create a tutorial + POST /api/tutorials - URL: `/api/tutorials` - Method: `POST` -- Parameters: - | Parameter | Description |Parameter Type| Data Type|Mandatory| - |---------------------|-----------------|------------|------------|---| - | tutorial [unit_id] | Id of the unit| formData | integer|Yes| - | tutorial [tutor_id] | Id of the tutor| formData | integer|Yes| - | tutorial [campus_id] | Id of the campus| formData | integer|| - | tutorial [capacity] | Capacity of the tutorial| formData | integer|Yes| - |tutorial[abbreviation] | The tutorials code| formData | string|Yes| - |tutorial[meeting_location] |The tutorials location | formData | string|Yes| - |tutorial[meeting_day] |Day of the tutorials | formData | string|Yes| - |tutorial[meeting_time] |Time of the tutorials | formData | string|Yes| - |tutorial[tutorial_stream_abbr] |Abbreviation of the associated tutorial stream | formData | string| | - |Username | User username | header | string |Yes| - |Auth_Token | Authentication token | header | string |Yes| - - -- Response: - `201 Created`: Tutorial added successfully. +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |---------------------|-----------------|------------|------------|---| + | tutorial [unit_id] | Id of the unit| formData | integer|Yes| + | tutorial [tutor_id] | Id of the tutor| formData | integer|Yes| + | tutorial [campus_id] | Id of the campus| formData | integer|| + | tutorial [capacity] | Capacity of the tutorial| formData | integer|Yes| + |tutorial[abbreviation] | The tutorials code| formData | string|Yes| + |tutorial[meeting_location] |The tutorials location | formData | string|Yes| + |tutorial[meeting_day] |Day of the tutorials | formData | string|Yes| + |tutorial[meeting_time] |Time of the tutorials | formData | string|Yes| + |tutorial[tutorial_stream_abbr] |Abbreviation of the associated tutorial stream | formData | string| | + |Username | User username | header | string |Yes| + |Auth_Token | Authentication token | header | string |Yes| + +- Response: + `201 Created`: Tutorial added successfully. - Example Request: - ```bash - curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 3DLo9xQoiKbXb7-ViNzJ' -d 'tutorial%5Bunit_id%5D=1&tutorial%5Btutor_id%5D=43&tutorial%5Bcapacity%5D=45&tutorial%5Babbreviation%5D=tut_test2&tutorial%5Bmeeting_location%5D=online&tutorial%5Bmeeting_day%5D=Tue&tutorial%5Bmeeting_time%5D=11%3A00' 'http://localhost:3000/api/tutorials' - ``` -- Response body: - ``` - Tutorial added successfully. - ``` \ No newline at end of file + ```bash + curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 3DLo9xQoiKbXb7-ViNzJ' -d 'tutorial%5Bunit_id%5D=1&tutorial%5Btutor_id%5D=43&tutorial%5Bcapacity%5D=45&tutorial%5Babbreviation%5D=tut_test2&tutorial%5Bmeeting_location%5D=online&tutorial%5Bmeeting_day%5D=Tue&tutorial%5Bmeeting_time%5D=11%3A00' 'http://localhost:3000/api/tutorials' + ``` +- Response body: + ` Tutorial added successfully. + ` + ---- ### DELETE: Delete an enrolment in the tutorial + DELETE /api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id} + +- URL: `/api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id}` +- Method: `DELETE` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ------------- | -------------------- | -------------- | --------- | --------- | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | unit_id | | path | integer | Yes | + | tutorial_abbr | | path | integer | Yes | + | project_id | | path | integer | Yes | + +- Response: `204` + +- Example Request: + ```bash + curl -X DELETE --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: _RjGmj9uZ1yDNLJy-rLa' 'http://localhost:3000/api/units/1/tutorials/LA1-01/enrolments/1' + ``` +- Response Body: + ``` + true + ``` + +--- + +### POST: Enrol project in a tutorial + +POST /api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id} + +- URL: `/api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id}` +- Method: `POST` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ------------- | -------------------- | -------------- | --------- | --------- | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | unit_id | | path | integer | Yes | + | tutorial_abbr | | path | integer | Yes | + | project_id | | path | integer | Yes | + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: _RjGmj9uZ1yDNLJy-rLa' 'http://localhost:3000/api/units/1/tutorials/LA1-01/enrolments/1' + ``` +- Response Body: + ```json + { + "enrolments": [ + { + "project_id": 1, + "tutorial_id": 1 + } + ] + } + ``` + +--- diff --git a/src/content/docs/backend/API/unit-group_sets.md b/src/content/docs/backend/API/unit-group_sets.md index 6e2fdac..3aa6128 100644 --- a/src/content/docs/backend/API/unit-group_sets.md +++ b/src/content/docs/backend/API/unit-group_sets.md @@ -22,6 +22,10 @@ This "units" API page has the following operations. - **GET** /api/units/{unit_id}/group_sets/{group_set_id}/groups/csv - **POST** /api/units/{unit_id}/group_sets/{group_set_id}/groups/csv - **POST** /api/units/{unit_id}/group_sets/{group_set_id}/groups +- **GET** /api/units/{unit_id}/group_sets/{id}/groups +- **DELETE** /api/units/{unit_id}/group_sets/{id} +- **PUT** /api/units/{unit_id}/group_sets/{id} +- **POST** /api/units/{unit_id}/group_sets ### DELETE: Remove a group member @@ -46,10 +50,13 @@ DELETE /api/units/{unit_id}/group_sets/{group_set_id}/groups/{group_id}/members/ ```bash curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/group_sets/2/groups/3/members/4' + ``` + - Response Body: ``` True ``` + --- ### POST : Add a member to a group @@ -87,7 +94,9 @@ POST /api/units/{unit_id}/group_sets/{group_set_id}/groups/{group_id}/members/{p "target_grade": "A" } ``` + --- + ### GET: Get the members of the group GET /api/units/{unit_id}/group_sets/{group_set_id}/groups/{group_id}/members @@ -125,7 +134,9 @@ GET /api/units/{unit_id}/group_sets/{group_set_id}/groups/{group_id}/members } ] ``` + --- + ### DELETE: Delete a group DELETE /api/units/{unit_id}/group_sets/{group_set_id}/groups/{group_id} @@ -149,11 +160,14 @@ DELETE /api/units/{unit_id}/group_sets/{group_set_id}/groups/{group_id} ```bash curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/group_sets/2/groups/3' ``` + - Response Body: ``` True ``` + --- + ### PUT: Update a group PUT /api/units/{unit_id}/group_sets/{group_set_id}/groups/{group_id} @@ -161,27 +175,27 @@ PUT /api/units/{unit_id}/group_sets/{group_set_id}/groups/{group_id} - URL: `/api/units/{unit_id}/group_sets/{group_set_id}/groups/{group_id}` - Method: `PUT` - Parameter: - - Header -| Parameter | Description | Parameter Type | Data Type | Mandatory | + +Header +| Parameter | Description | Parameter Type | Data Type | Mandatory | | ------------------- | -------------------------------------- | -------------- | --------- | --------- | -| Username | Username | header | string | Yes | -| Auth_Token | Authentication token | header | string | Yes | +| Username | Username | header | string | Yes | +| Auth_Token | Authentication token | header | string | Yes | - Path -| Parameter | Description | Parameter Type | Data Type | Mandatory | +Path +| Parameter | Description | Parameter Type | Data Type | Mandatory | | ------------------- | -------------------------------------- | -------------- | --------- | --------- | -| unit_id | The unit id | path | integer | Yes | -| group_set_id | Id of the group set | path | integer | Yes | -| group_id | id of the group | path | integer | Yes | +| unit_id | The unit id | path | integer | Yes | +| group_set_id | Id of the group set | path | integer | Yes | +| group_id | id of the group | path | integer | Yes | - Body(Group) -| Parameter | Description | Parameter Type | Data Type | Mandatory | +Body(Group) +| Parameter | Description | Parameter Type | Data Type | Mandatory | | ------------------- | -------------------------------------- | -------------- | --------- | --------- | -| name | name of the group | body | string | No | -| tutorial_id | tutorial id for the group | body | integer | No | -| capacity_adjustment | how capacity for the group is adjusted | body | integer | No | -| locked | Is the group locked | body | boolean | No | +| name | name of the group | body | string | No | +| tutorial_id | tutorial id for the group | body | integer | No | +| capacity_adjustment | how capacity for the group is adjusted | body | integer | No | +| locked | Is the group locked | body | boolean | No | - Response: `200 OK` @@ -199,6 +213,7 @@ PUT /api/units/{unit_id}/group_sets/{group_set_id}/groups/{group_id} "locked": true } ``` + --- ### GET:Download a CSV of students in groups within a group set @@ -225,10 +240,12 @@ GET /api/units/{unit_id}/group_sets/{group_set_id}/groups/student_csv ``` - Response Body: + ``` (Binary CSV file download) - + ``` + --- ### POST: Upload a CSV for students in groups within a group set @@ -262,6 +279,7 @@ POST /api/units/{unit_id}/group_sets/{group_set_id}/groups/student_csv "result": "Success" } ``` + --- ### GET: Download a CSV of groups within a group set @@ -290,8 +308,10 @@ GET /api/units/{unit_id}/group_sets/{group_set_id}/groups/csv - Response Body: ``` (Binary CSV file download) - ```` + ``` + --- + ### POST: Upload a CSV for groups within a group set POST /api/units/{unit_id}/group_sets/{group_set_id}/groups/csv @@ -323,7 +343,9 @@ POST /api/units/{unit_id}/group_sets/{group_set_id}/groups/csv "result": "Success" } ``` + --- + ### POST: Add a new group to the group set POST /api/units/{unit_id}/group_sets/{group_set_id}/groups @@ -331,25 +353,25 @@ POST /api/units/{unit_id}/group_sets/{group_set_id}/groups - URL: `/api/units/{unit_id}/group_sets/{group_set_id}/groups` - Method: `POST` - Parameter: - - Header -| Parameter | Description | Parameter Type | Data Type | Mandatory | + +Header +| Parameter | Description | Parameter Type | Data Type | Mandatory | | ------------------- | -------------------------------------- | -------------- | --------- | --------- | -| Username | Username | header | string | Yes | -| Auth_Token | Authentication token | header | string | Yes | +| Username | Username | header | string | Yes | +| Auth_Token | Authentication token | header | string | Yes | - Path -| Parameter | Description | Parameter Type | Data Type | Mandatory | +Path +| Parameter | Description | Parameter Type | Data Type | Mandatory | | ------------------- | -------------------------------------- | -------------- | --------- | --------- | -| unit_id | The unit id | path | integer | Yes | -| group_set_id | Id of the group set | path | integer | Yes | +| unit_id | The unit id | path | integer | Yes | +| group_set_id | Id of the group set | path | integer | Yes | - Body(Group) -| Parameter | Description | Parameter Type | Data Type | Mandatory | +Body(Group) +| Parameter | Description | Parameter Type | Data Type | Mandatory | | ------------------- | -------------------------------------- | -------------- | --------- | --------- | -| name | name of the group | body | string | No | -| tutorial_id | tutorial id for the group | body | integer | No | -| capacity_adjustment | how capacity for the group is adjusted | body | integer | No | +| name | name of the group | body | string | No | +| tutorial_id | tutorial id for the group | body | integer | No | +| capacity_adjustment | how capacity for the group is adjusted | body | integer | No | - Response: `201 created` @@ -358,6 +380,7 @@ POST /api/units/{unit_id}/group_sets/{group_set_id}/groups ```bash curl -X POST \--header 'Accept: application/json' \--header 'Username: aadmin' \--header 'Auth_Token: Say13yA497H8wSFFXZxh' \-d '{"name":"Group A","tutorial_id":1,"capacity_adjustment":0}' \'http://localhost:3000/api/units/1/group_sets/2/groups'' ``` + - Response Body: ```json @@ -367,7 +390,146 @@ POST /api/units/{unit_id}/group_sets/{group_set_id}/groups "name": "Group A", "tutorial_id": 1, "capacity_adjustment": 0 -} + } } ``` + +--- + +### GET: Get the groups in a group set + +GET /api/units/{unit_id}/group_sets/{id}/groups + +- URL: `/api/units/{unit_id}/group_sets/{id}/groups` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | -------------------- | -------------- | --------- | --------- | + | Username | User Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | unit_id | | path | integer | Yes | + | id | | path | integer | Yes | + +- Response: `200` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: student_1' --header 'Auth_Token: sWkFmUyHxKDEN_9Qjxjj' 'http://localhost:3000/api/units/1/group_sets/3/groups' + ``` +- Response Body: + ``` + [] + ``` + +--- + +### DELETE: Delete a group set + +DELETE /api/units/{unit_id}/group_sets/{id} + +- URL: `/api/units/{unit_id}/group_sets/{id}` +- Method: `DELETE` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | -------------------- | -------------- | --------- | --------- | + | Username | User Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | unit_id | | path | integer | Yes | + | id | | path | integer | Yes | + +- Response: `204` + +- Example Request: + ```bash + curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 5tRKys7u_zJ3ZQ5a4tny' 'http://localhost:3000/api/units/1/group_sets/1' + ``` +- Response Body: + ``` + true + ``` + +--- + +### PUT: Edits the given group set + +PUT /api/units/{unit_id}/group_sets/{id} + +- URL: `/api/units/{unit_id}/group_sets/{id}` +- Method: `PUT` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ------------------------------------------ | ------------------------------------------------------ | -------------- | --------- | --------- | + | id | The group set id to edit | path | integer | Yes | + | group_set[name] | | formData | string | Yes | + | group_set[allow_students_to_create_groups] | Are students allowed to create groups | formData | boolean | No | + | group_set[allow_students_to_manage_groups] | Are students allowed to manage their group memberships | formData | boolean | No | + | group_set[keep_groups_in_same_class] | Must groups be kept in the one class | formData | boolean | No | + | group_set[capacity] | Capacity for each group | formData | integer | No | + | group_set[locked] | Is this group set locked | formData | boolean | No | + | Username | User Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | unit_id | | header | integer | Yes | + +- Response: `200` + +- Example Request: + ```bash + curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 5tRKys7u_zJ3ZQ5a4tny' -d 'group_set%5Bname%5D=test_group_test&group_set%5Ballow_students_to_create_groups%5D=true&group_set%5Ballow_students_to_manage_groups%5D=true' 'http://localhost:3000/api/units/1/group_sets/1' + ``` +- Response Body: + ```json + { + "id": 1, + "name": "test_group_test", + "allow_students_to_create_groups": true, + "allow_students_to_manage_groups": true, + "keep_groups_in_same_class": false, + "capacity": null, + "locked": false + } + ``` + +--- + +### POST: Add a new group set to the given unit + +POST /api/units/{unit_id}/group_sets + +- URL: `/api/units/{unit_id}/group_sets` +- Method: `POST` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ------------------------------------------ | ------------------------------------------------------ | -------------- | --------- | --------- | + | unit_id | The unit for the new group set | path | integer | Yes | + | group_set[name] | | formData | string | Yes | + | group_set[allow_students_to_create_groups] | Are students allowed to create groups | formData | boolean | No | + | group_set[allow_students_to_manage_groups] | Are students allowed to manage their group memberships | formData | boolean | No | + | group_set[keep_groups_in_same_class] | Must groups be kept in the one class | formData | boolean | No | + | group_set[capacity] | Capacity for each group | formData | integer | No | + | Username | User Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 5tRKys7u_zJ3ZQ5a4tny' -d 'group_set%5Bname%5D=test_group&group_set%5Ballow_students_to_create_groups%5D=true' 'http://localhost:3000/api/units/1/group_sets' + ``` +- Response Body: + ```json + { + "id": 1, + "name": "test_group", + "allow_students_to_create_groups": true, + "allow_students_to_manage_groups": true, + "keep_groups_in_same_class": false, + "capacity": null, + "locked": false + } + ``` + --- diff --git a/src/content/docs/backend/API/units_1.md b/src/content/docs/backend/API/units_1.md deleted file mode 100644 index 4c382db..0000000 --- a/src/content/docs/backend/API/units_1.md +++ /dev/null @@ -1,1043 +0,0 @@ ---- -title: Doubtfire API ---- - -# List of Doubtfire - -# API: Units (Page 1) -units : Operations about units - -This markdown document provides detailed documentation for the "units" API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl. - -This "units" API page has the following operations (**_17 operations_**). - -- **GET** /api/units/{id}/stats/task_completion_stats -- **GET** /api/units/{id}/stats/task_status_pct -- **GET** /api/units/{id}/stats/student_target_grade -- **GET** /api/units/{id}/grades -- **GET** /api/units/{id}/tasks/inbox -- **GET** /api/units/{id}/feedback -- **POST** /api/units/{id}/rollover -- **GET** /api/units -- **POST** /api/units -- **GET** /api/units/{id} -- **PUT** /api/units/{id} -- **DELETE** /api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id} -- **POST** /api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id} -- **GET** /api/units/{unit_id}/group_sets/{id}/groups -- **DELETE** /api/units/{unit_id}/group_sets/{id} -- **PUT** /api/units/{unit_id}/group_sets/{id} -- **POST** /api/units/{unit_id}/group_sets - - ----------------------------------------------------------------------- - - -### GET: Download stats related to the number of completed tasks -GET /api/units/{id}/stats/task_completion_stats - -- URL: `/api/units/{id}/stats/task_completion_stats` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|------------------------|----------------|-----------|-----------| - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | id | The project id | path | integer | Yes | - - -- Response: `200 OK` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/stats/task_completion_stats' - ``` -- Response Body: - ```json - { - "unit": { - "median": 13, - "lower": 12, - "upper": 17, - "min": 2, - "max": 19 - }, - "tutorial": { - "1": { - "median": 11, - "lower": 2, - "upper": 13, - "min": 2, - "max": 13 - }, - "3": { - "median": 16, - "lower": 13, - "upper": 17, - "min": 12, - "max": 17 - } - }, - "grade": { - "0": { - "median": 11, - "lower": 8, - "upper": 11, - "min": 8, - "max": 11 - }, - "1": { - "median": 17, - "lower": 13, - "upper": 17, - "min": 13, - "max": 17 - }, - "2": { - "median": 7.5, - "lower": 2, - "upper": 13, - "min": 2, - "max": 13 - }, - "3": { - "median": 13, - "lower": 13, - "upper": 17, - "min": 2, - "max": 19 - } - } - } - - ``` ------------------------------------------------------------------------- - -### GET: Download stats related to the status of students with tasks -GET /api/units/{id}/stats/task_status_pct - -- URL: `/api/units/{id}/stats/task_status_pct` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|------------------------|----------------|-----------|-----------| - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | id | The project id | path | integer | Yes | - -- Response: `200 OK` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/stats/task_status_pct' - ``` -- Response Body: - ```json - { - "1": { - "1": [ - { - "tutorial_stream_id": null, - "status": "complete", - "num": 4 - }, - { - "tutorial_stream_id": null, - "status": "redo", - "num": 1 - }, - { - "tutorial_stream_id": null, - "status": "demonstrate", - "num": 1 - } - ], - } - } - -------------------------------------------------------------------- - -### GET: Download the stats related to the number of students aiming for each grade -GET /api/units/{id}/stats/student_target_grade - -- URL: `/api/units/{id}/stats/student_target_grade` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|------------------------|----------------|-----------|-----------| - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | id | The project id | path | integer | Yes | - -- Response: `200 OK` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/stats/student_target_grade' - ``` -- Response Body: - ```json - [ - { - "tutorial_id": null, - "tutorial_stream_id": null, - "grade": 0, - "num": 1 - }, - { - "tutorial_id": null, - "tutorial_stream_id": null, - "grade": 1, - "num": 1 - }, - { - "tutorial_id": null, - "tutorial_stream_id": null, - "grade": 2, - "num": 1 - }, - { - "tutorial_id": null, - "tutorial_stream_id": null, - "grade": 3, - "num": 3 - }, - { - "tutorial_id": 1, - "tutorial_stream_id": 4, - "grade": 0, - "num": 2 - }, - { - "tutorial_id": 1, - "tutorial_stream_id": 4, - "grade": 1, - "num": 1 - }, - { - "tutorial_id": 1, - "tutorial_stream_id": 4, - "grade": 2, - "num": 1 - }, - { - "tutorial_id": 1, - "tutorial_stream_id": 4, - "grade": 3, - "num": 2 - }, - { - "tutorial_id": 3, - "tutorial_stream_id": 3, - "grade": 0, - "num": 1 - }, - { - "tutorial_id": 3, - "tutorial_stream_id": 3, - "grade": 1, - "num": 1 - }, - { - "tutorial_id": 3, - "tutorial_stream_id": 3, - "grade": 3, - "num": 4 - } - ] - ``` -------------------------------------------------------------------------- - -### GET: Download the grades for a unit -GET /api/units/{id}/grades - -- URL: `/api/units/{id}/grades` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|------------------------|----------------|-----------|-----------| - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | id | The project id | path | integer | Yes | - - -- Response: `200 OK` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/octet-stream' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/grades' - ``` -- Response Body: - ``` - Download grades - ``` ------------------------------------------------------------------------------ - -### GET: Download the tasks that should be listed under the task inbox -GET /api/units/{id}/tasks/inbox - -- URL: `/api/units/{id}/tasks/inbox` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|------------------------|----------------|-----------|-----------| - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | id | The project id | path | integer | Yes | - -- Response: `200 OK` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: xpx2aQkGKtgDsX4r-LY1' 'http://localhost:3000/api/units/1/tasks/inbox' - ``` -- Response Body: - ```json - [ - { - "id": 7, - "project_id": 1, - "task_definition_id": 5, - "tutorial_id": null, - "status": "discuss", - "completion_date": "2024-03-25", - "submission_date": "2024-04-20T10:56:17.318Z", - "times_assessed": 1, - "grade": null, - "quality_pts": -1, - "num_new_comments": 1, - "similarity_flag": false, - "pinned": 0, - "has_extensions": 0 - }, - { - "id": 8, - "project_id": 1, - "task_definition_id": 6, - "tutorial_id": null, - "status": "ready_for_feedback", - "completion_date": "2024-03-26", - "submission_date": "2024-04-20T10:56:17.627Z", - "times_assessed": 1, - "grade": null, - "quality_pts": -1, - "num_new_comments": 0, - "similarity_flag": false, - "pinned": 0, - "has_extensions": 0 - }, - { - "id": 10, - "project_id": 1, - "task_definition_id": 8, - "tutorial_id": null, - "status": "ready_for_feedback", - "completion_date": "2024-03-28", - "submission_date": "2024-04-20T10:56:18.175Z", - "times_assessed": 1, - "grade": null, - "quality_pts": -1, - "num_new_comments": 1, - "similarity_flag": false, - "pinned": 0, - "has_extensions": 0 - }, - { - "id": 11, - "project_id": 1, - "task_definition_id": 9, - "tutorial_id": null, - "status": "ready_for_feedback", - "completion_date": "2024-03-31", - "submission_date": "2024-04-20T10:56:18.510Z", - "times_assessed": 1, - "grade": null, - "quality_pts": 0, - "num_new_comments": 1, - "similarity_flag": false, - "pinned": 0, - "has_extensions": 0 - }, - { - "id": 12, - "project_id": 2, - "task_definition_id": 1, - "tutorial_id": null, - "status": "complete", - "completion_date": "2024-03-22", - "submission_date": "2024-04-20T10:56:18.978Z", - "times_assessed": 1, - "grade": null, - "quality_pts": -1, - "num_new_comments": 1, - "similarity_flag": true, - "pinned": 0, - "has_extensions": 0 - }, - ] - ``` - ---------------------------------------------------------------- - -### GET: Download the tasks that are awaiting feedback for a unit -GET /api/units/{id}/feedback - - -- URL: `/api/units/{id}/feedback` -- Method: `GET` -- Parameter: - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|------------------------|----------------|-----------|-----------| - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | id | The project id | path | integer | Yes | - -- Response: `200 OK` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: xpx2aQkGKtgDsX4r-LY1' 'http://localhost:3000/api/units/1/feedback' - ``` -- Response Body: - ```json - [ - { - "id": 77, - "project_id": 6, - "task_definition_id": 1, - "tutorial_id": null, - "status": "redo", - "completion_date": null, - "submission_date": "2024-04-20T10:58:04.345Z", - "times_assessed": 1, - "grade": null, - "quality_pts": -1, - "num_new_comments": 0, - "similarity_flag": false, - "pinned": 0, - "has_extensions": 0 - }, - { - "id": 3, - "project_id": 1, - "task_definition_id": 1, - "tutorial_id": null, - "status": "demonstrate", - "completion_date": "2024-03-18", - "submission_date": "2024-04-20T10:56:15.653Z", - "times_assessed": 1, - "grade": null, - "quality_pts": -1, - "num_new_comments": 0, - "similarity_flag": true, - "pinned": 0, - "has_extensions": 0 - }, - { - "id": 79, - "project_id": 6, - "task_definition_id": 3, - "tutorial_id": null, - "status": "discuss", - "completion_date": "2024-03-20", - "submission_date": "2024-04-20T10:58:04.866Z", - "times_assessed": 1, - "grade": null, - "quality_pts": -1, - "num_new_comments": 1, - "similarity_flag": false, - "pinned": 0, - "has_extensions": 0 - }, - { - "id": 5, - "project_id": 1, - "task_definition_id": 3, - "tutorial_id": null, - "status": "demonstrate", - "completion_date": "2024-03-25", - "submission_date": "2024-04-20T10:56:16.843Z", - "times_assessed": 1, - "grade": null, - "quality_pts": -1, - "num_new_comments": 0, - "similarity_flag": false, - "pinned": 0, - "has_extensions": 0 - }, - ] - ``` -------------------------------------------------------------------- - -### POST: Rollover unit -POST /api/units/{id}/rollover - -- URL: `/api/units/{id}/rollover` -- Method: `POST` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |---------------------|------------------------|----------------|-----------|-----------| - | teaching_period_id | The teaching period id | formData | string | Yes | - | start_date | The start date | formData | string | | - | end_date | The end date | formData | string | | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | id | The project id | path | integer | Yes | - - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' -d 'teaching_period_id=1' 'http://localhost:3000/api/units/1/rollover' - ``` -- Response Body: - ```json - { - "code": "COS10001", - "id": 5, - "name": "Introduction to Programming", - "my_role": "Admin", - "main_convenor_id": 17, - "description": "illo quas voluptatem ea tempore aperiam sapiente cum harum tenetur vitae", - "teaching_period_id": 1, - "start_date": "2018-03-05", - "end_date": "2018-05-25", - "active": true, - "overseer_image_id": null, - "assessment_enabled": true, - "auto_apply_extension_before_deadline": true, - "send_notifications": true, - "enable_sync_enrolments": true, - "enable_sync_timetable": true, - "draft_task_definition_id": null, - "allow_student_extension_requests": true, - "extension_weeks_on_resubmit_request": 1, - "allow_student_change_tutorial": true, - "ilos": [ - { - "id": 8, - "ilo_number": 4, - "abbreviation": "DECOMP", - "name": "Functional Decomposition", - "description": "Use modular and functional decomposition to break problems down functionally, represent the resulting structures diagrammatically, and implement these structures in code as functions and procedures.\r\n" - }, - { - "id": 9, - "ilo_number": 3, - "abbreviation": "PROG", - "name": "Program", - "description": "Construct small programs, using the programming languages covered, that include the use of arrays, functions and procedures, parameter passing with call by value and call by reference, custom data types, and pointers.\r\n" - }, - { - "id": 10, - "ilo_number": 2, - "abbreviation": "PRIN", - "name": "Structured Programming", - "description": "Describe the principles of structured programming, and relate these to the syntactical elements of the programming language used and the way programs are developed.\r\n" - }, - ] - } - ``` - ------------------------------------------------------------------------------------------------------ - -### GET: Get units related to the current user for admin purposes -GET /api/units - -- URL: `/api/units` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |---------------------|----------------------------------|----------------|-----------|-----------| - | include_in_active | Include units that are not active| query | boolean | | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - -- Response: `200 OK` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' 'http://localhost:3000/api/units?include_in_active=true' - ``` -- Response Body: - ```json - [ - { - "code": "COS10001", - "id": 1, - "name": "Introduction to Programming", - "my_role": "Admin", - "main_convenor_user_id": 2, - "description": "illo quas voluptatem ea tempore aperiam sapiente cum harum tenetur vitae", - "start_date": "2024-03-09", - "end_date": "2024-06-08", - "active": true - }, - { - "code": "COS20007", - "id": 2, - "name": "Object Oriented Programming", - "my_role": "Admin", - "main_convenor_user_id": 2, - "description": "laudantium dolores rerum tenetur sint aut distinctio velit magni quasi", - "start_date": "2024-03-09", - "end_date": "2024-06-08", - "active": true - }, - { - "code": "COS30046", - "id": 3, - "name": "Artificial Intelligence for Games", - "my_role": "Admin", - "main_convenor_user_id": 3, - "description": "est laboriosam repellat eos numquam iusto cupiditate praesentium corporis et eligendi pariatur", - "start_date": "2024-03-09", - "end_date": "2024-06-08", - "active": true - }, - { - "code": "COS30243", - "id": 4, - "name": "Game Programming", - "my_role": "Admin", - "main_convenor_user_id": 3, - "description": "omnis delectus perferendis earum culpa voluptate nesciunt fugiat quam dicta et eius ut dignissimos", - "start_date": "2024-03-09", - "end_date": "2024-06-08", - "active": true - }, - { - "code": "COS10001", - "id": 5, - "name": "Introduction to Programming", - "my_role": "Admin", - "main_convenor_user_id": 2, - "description": "illo quas voluptatem ea tempore aperiam sapiente cum harum tenetur vitae", - "teaching_period_id": 1, - "start_date": "2018-03-05", - "end_date": "2018-05-25", - "active": true - } - ] - ``` - ------------------------------------------------------------------------------------------------ - -### POST: Create Unit -POST /api/units - - -- URL: `/api/units` -- Method: `POST` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------------------------------------------|--------------------------------------------------------------------------------|----------------|-----------|-----------| - | unit[name] | The name of the unit | formData | string | Yes | - | unit[code] | The code of the unit | formData | string | Yes | - | unit[description] | The description of the unit | formData | string | No | - | unit[active] | Indicates if the unit is active | formData | boolean | Yes | - | unit[teaching_period_id] | The ID of the teaching period | formData | integer | Yes | - | unit[start_date] | The start date of the unit | formData | date | No | - | unit[end_date] | The end date of the unit | formData | date | No | - | unit[main_convenor_user_id] | The user ID of the main convenor | formData | integer | Yes | - | unit[auto_apply_extension_before_deadline] | Indicates if extensions before the deadline should be automatically applied | formData | boolean | No | - | unit[send_notifications] | Indicates if emails should be sent on updates each week | formData | boolean | No | - | unit[enable_sync_timetable] | Sync to timetable automatically if supported by deployment | formData | boolean | No | - | unit[enable_sync_enrolments] | Sync student enrolments automatically if supported by deployment | formData | boolean | No | - | unit[allow_student_extension_requests] | Can turn on/off student extension requests | formData | boolean | No | - | unit[extension_weeks_on_resubmit_request] | Determines the number of weeks extension on a resubmit request | formData | integer | No | - | unit[portfolio_auto_generation_date] | Indicates a date where student portfolio will automatically compile | formData | date | No | - | unit[allow_student_change_tutorial] | Can turn on/off student ability to change tutorials | formData | boolean | No | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' -d 'unit%5Bname%5D=Test%20unit&unit%5Bcode%5D=COS11115&unit%5Bactive%5D=true&unit%5Bteaching_period_id%5D=1&unit%5Bmain_convenor_user_id%5D=2&unit%5Bauto_apply_extension_before_deadline%5D=true&unit%5Bsend_notifications%5D=true&unit%5Benable_sync_timetable%5D=true&unit%5Benable_sync_enrolments%5D=true&unit%5Ballow_student_extension_requests%5D=true&unit%5Bextension_weeks_on_resubmit_request%5D=1&unit%5Ballow_student_change_tutorial%5D=true' 'http://localhost:3000/api/units' - ``` -- Response Body: - ```json - { - "code": "COS11115", - "id": 6, - "name": "Test unit", - "my_role": "Convenor", - "main_convenor_id": 18, - "description": "Test unit", - "teaching_period_id": 1, - "start_date": "2018-03-05", - "end_date": "2018-05-25", - "active": true, - "overseer_image_id": null, - "assessment_enabled": true, - "auto_apply_extension_before_deadline": true, - "send_notifications": true, - "enable_sync_enrolments": true, - "enable_sync_timetable": true, - "draft_task_definition_id": null, - "allow_student_extension_requests": true, - "extension_weeks_on_resubmit_request": 1, - "allow_student_change_tutorial": true, - "ilos": [], - "tutorial_streams": [], - "staff": [ - { - "id": 18, - "role": "Convenor", - "user": { - "id": 1, - "email": "aadmin@doubtfire.com", - "first_name": "Admin", - "last_name": "Admin", - "username": "aadmin", - "nickname": "Admin" - } - } - ], - "tutorials": [], - "task_definitions": [], - "task_outcome_alignments": [], - "group_sets": [], - "groups": [] - } - ``` ------------------------------------------------------------------------------------------ - -### GET: Get a unit's details -GET /api/units/{id} - -- URL: `/api/units/{id}` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|------------------------|----------------|-----------|-----------| - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | id | The project id | path | integer | Yes | - -- Response: `200 OK` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' 'http://localhost:3000/api/units/1' - ``` -- Response Body: - ```json - { - "code": "COS10001", - "id": 1, - "name": "Introduction to Programming", - "my_role": "Admin", - "main_convenor_id": 1, - "description": "illo quas voluptatem ea tempore aperiam sapiente cum harum tenetur vitae", - "start_date": "2024-03-09", - "end_date": "2024-06-08", - "active": true, - "overseer_image_id": null, - "assessment_enabled": true, - "auto_apply_extension_before_deadline": true, - "send_notifications": true, - "enable_sync_enrolments": true, - "enable_sync_timetable": true, - "draft_task_definition_id": null, - "allow_student_extension_requests": true, - "extension_weeks_on_resubmit_request": 1, - "allow_student_change_tutorial": true, - "ilos": [ - { - "id": 1, - "ilo_number": 4, - "abbreviation": "DECOMP", - "name": "Functional Decomposition", - "description": "Use modular and functional decomposition to break problems down functionally, represent the resulting structures diagrammatically, and implement these structures in code as functions and procedures.\r\n" - },] - "tutorial_streams": [ - { - "id": 1, - "name": "Workshop-1", - "abbreviation": "wrkshop-1", - "activity_type": "wrkshop" - },] - "task_definitions": [ - { - "id": 1, - "abbreviation": "1.1P", - "name": "Pass Task 1.1 - Hello World", - "description": "As a first step, create the classic 'Hello World' program. This will help ensure that you have all of the software installed correctly, and are ready to move on with creating other,,, programs.", - "weighting": 1, - "target_grade": 0, - "target_date": "2024-03-19", - "due_date": "2024-04-08", - "start_date": "2024-03-12", - "upload_requirements": [ - { - "key": "file0", - "name": "HelloWorld.pas", - "type": "code" - },] - }] - } - - ``` --------------------------------------------------------------------------------------- - -### PUT: Update unit -PUT /api/units/{id} - -- URL: `/api/units/{id}` -- Method: `PUT` -- Parameter: - -| Parameter | Description | Parameter Type | Data Type | Mandatory | -|--------------------------------------------------|---------------------------------------------------------------------------------------|----------------|-----------|-----------| -| id | The unit id to update | path | integer | Yes | -| unit[name] | Test unit_ Introduction to Programming | formData | string | Yes | -| unit[code] | | formData | string | No | -| unit[description] | | formData | string | No | -| unit[active] | | formData | boolean | No | -| unit[teaching_period_id] | | formData | integer | No | -| unit[start_date] | | formData | date | No | -| unit[end_date] | | formData | date | No | -| unit[main_convenor_id] | | formData | integer | No | -| unit[auto_apply_extension_before_deadline] | Indicates if extensions before the deadline should be automatically applied | formData | boolean | No | -| unit[send_notifications] | Indicates if emails should be sent on updates each week | formData | boolean | No | -| unit[enable_sync_timetable] | Sync to timetable automatically if supported by deployment | formData | boolean | No | -| unit[enable_sync_enrolments] | Sync student enrolments automatically if supported by deployment | formData | boolean | No | -| unit[draft_task_definition_id] | Indicates the ID of the task definition used as the "draft learning summary task" | formData | integer | No | -| unit[portfolio_auto_generation_date] | Indicates a date where student portfolio will automatically compile | formData | date | No | -| unit[allow_student_extension_requests] | Can turn on/off student extension requests | formData | boolean | No | -| unit[allow_student_change_tutorial] | Can turn on/off student ability to change tutorials | formData | boolean | No | -| unit[extension_weeks_on_resubmit_request] | Determines the number of weeks extension on a resubmit request | formData | integer | No | -| unit[overseer_image_id] | The id of the docker image used with | formData | integer | No | -| unit [assessment_enabled] | |formData | boolean | No | -|Username | User username | header| string| Yes| -|Auth_token| Authentication token | header| string | Yes| - -- Response: `200` - -- Example Request: - ```bash - curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' -d 'unit%5Bname%5D=Test%20unit_%20Introduction%20to%20Programming&unit%5Bassessment_enabled%5D=true' 'http://localhost:3000/api/units/1' - ``` -- Response Body: - ```json - { - "name": "Test unit_ Introduction to Programming", - "assessment_enabled": true - } - ``` ----------------------------------------------------------------------------------------- -### DELETE: Delete an enrolment in the tutorial -DELETE /api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id} - -- URL: `/api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id}` -- Method: `DELETE` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type |Mandatory| - |--------------------|------------------------|----------------|-----------|---------| - | Username | Username | header | string |Yes | - | Auth_Token | Authentication token | header | string |Yes | - | unit_id | | path | integer |Yes | - | tutorial_abbr | | path | integer |Yes | - | project_id | | path | integer |Yes | - - -- Response: `204` - -- Example Request: - ```bash - curl -X DELETE --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: _RjGmj9uZ1yDNLJy-rLa' 'http://localhost:3000/api/units/1/tutorials/LA1-01/enrolments/1' - ``` -- Response Body: - ``` - true - ``` ----------------------------------------------------------------------------------- - -### POST: Enrol project in a tutorial -POST /api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id} - -- URL: `/api/units/{unit_id}/tutorials/{tutorial_abbr}/enrolments/{project_id}` -- Method: `POST` -- Parameter: - - - | Parameter | Description | Parameter Type | Data Type |Mandatory| - |--------------------|------------------------|----------------|-----------|---------| - | Username | Username | header | string |Yes | - | Auth_Token | Authentication token | header | string |Yes | - | unit_id | | path | integer |Yes | - | tutorial_abbr | | path | integer |Yes | - | project_id | | path | integer |Yes | - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: _RjGmj9uZ1yDNLJy-rLa' 'http://localhost:3000/api/units/1/tutorials/LA1-01/enrolments/1' - ``` -- Response Body: - ```json - { - "enrolments": [ - { - "project_id": 1, - "tutorial_id": 1 - } - ] - } - ``` ------------------------------------------------------------------------------------ - -### GET: Get the groups in a group set -GET /api/units/{unit_id}/group_sets/{id}/groups - -- URL: `/api/units/{unit_id}/group_sets/{id}/groups` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |------------|------------------------------------|----------------|-----------|-----------| - | Username | User Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | unit_id | | path | integer | Yes | - | id | | path | integer | Yes | - -- Response: `200` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: student_1' --header 'Auth_Token: sWkFmUyHxKDEN_9Qjxjj' 'http://localhost:3000/api/units/1/group_sets/3/groups' - ``` -- Response Body: - ``` - [] - ``` - -------------------------------------------------------------------------- -### DELETE: Delete a group set -DELETE /api/units/{unit_id}/group_sets/{id} - -- URL: `/api/units/{unit_id}/group_sets/{id}` -- Method: `DELETE` -- Parameter: - - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |------------|-----------------------------------------------------|----------------|-----------|-----------| - | Username | User Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | unit_id | | path | integer | Yes | - | id | | path | integer | Yes | - - -- Response: `204` - -- Example Request: - ```bash - curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 5tRKys7u_zJ3ZQ5a4tny' 'http://localhost:3000/api/units/1/group_sets/1' - ``` -- Response Body: - ``` - true - ``` - -------------------------------------------------------------------------- - -### PUT: Edits the given group set -PUT /api/units/{unit_id}/group_sets/{id} - -- URL: `/api/units/{unit_id}/group_sets/{id}` -- Method: `PUT` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |--------------------------------------------|-----------------------------------------------------|----------------|-----------|-----------| - | id | The group set id to edit | path | integer | Yes | - | group_set[name] | | formData | string | Yes | - | group_set[allow_students_to_create_groups] | Are students allowed to create groups | formData | boolean | No | - | group_set[allow_students_to_manage_groups] | Are students allowed to manage their group memberships | formData | boolean | No | - | group_set[keep_groups_in_same_class] | Must groups be kept in the one class | formData | boolean | No | - | group_set[capacity] | Capacity for each group | formData | integer | No | - | group_set[locked] | Is this group set locked | formData | boolean | No | - | Username | User Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | unit_id | | header | integer | Yes | - - -- Response: `200` - -- Example Request: - ```bash - curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 5tRKys7u_zJ3ZQ5a4tny' -d 'group_set%5Bname%5D=test_group_test&group_set%5Ballow_students_to_create_groups%5D=true&group_set%5Ballow_students_to_manage_groups%5D=true' 'http://localhost:3000/api/units/1/group_sets/1' - ``` -- Response Body: - ```json - { - "id": 1, - "name": "test_group_test", - "allow_students_to_create_groups": true, - "allow_students_to_manage_groups": true, - "keep_groups_in_same_class": false, - "capacity": null, - "locked": false - } - ``` - --------------------------------------------------------------------------- - -### POST: Add a new group set to the given unit -POST /api/units/{unit_id}/group_sets - -- URL: `/api/units/{unit_id}/group_sets` -- Method: `POST` -- Parameter: - - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |--------------------------------------------|-----------------------------------------------------|----------------|-----------|-----------| - | unit_id | The unit for the new group set | path | integer | Yes | - | group_set[name] | | formData | string | Yes | - | group_set[allow_students_to_create_groups] | Are students allowed to create groups | formData | boolean | No | - | group_set[allow_students_to_manage_groups] | Are students allowed to manage their group memberships | formData | boolean | No | - | group_set[keep_groups_in_same_class] | Must groups be kept in the one class | formData | boolean | No | - | group_set[capacity] | Capacity for each group | formData | integer | No | - | Username | User Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 5tRKys7u_zJ3ZQ5a4tny' -d 'group_set%5Bname%5D=test_group&group_set%5Ballow_students_to_create_groups%5D=true' 'http://localhost:3000/api/units/1/group_sets' - ``` -- Response Body: - ```json - { - "id": 1, - "name": "test_group", - "allow_students_to_create_groups": true, - "allow_students_to_manage_groups": true, - "keep_groups_in_same_class": false, - "capacity": null, - "locked": false - } - ``` ---------------------------------------------------------------------------- - - diff --git a/src/content/docs/backend/API/units_2.md b/src/content/docs/backend/API/units_2.md deleted file mode 100644 index 48bcaa9..0000000 --- a/src/content/docs/backend/API/units_2.md +++ /dev/null @@ -1,1169 +0,0 @@ ---- -title: Doubtfire API ---- - -# List of Doubtfire - -# API: Units (Page 2) -units : Operations about units - -This markdown document provides detailed documentation for the "units" API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl. - -## This "units" API page has the following operations -- **GET** /api/units/{unit_id}/task_definitions/{task_def_id}/task_pdf -- **GET** /api/units/{unit_id}/task_definitions/{task_def_id}/tasks -- **POST** /api/units/{unit_id}/task_definitions/task_pdfs -- **DELETE** /api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet -- **DELETE** /api/units/{unit_id}/task_definitions/{id} -- **PUT** /api/units/{unit_id}/task_definitions/{id} -- **POST** /api/units/{unit_id}/task_definitions -- **GET** /api/units/{unit_id}/learning_alignments/class_details -- **GET** /api/units/{unit_id}/learning_alignments/class_stats -- **DELETE** /api/units/{unit_id}/learning_alignments/{id} -- **PUT** /api/units/{unit_id}/learning_alignments/{id} -- **GET** /api/units/{unit_id}/learning_alignments -- **POST** /api/units/{unit_id}/learning_alignments -- **GET** /api/units/{unit_id}/learning_alignments/csv -- **POST** /api/units/{unit_id}/learning_alignments/csv -- **GET** /api/units/{unit_id}/outcomes/csv -- **POST** /api/units/{unit_id}/outcomes/csv -- **DELETE** /api/units/{unit_id}/outcomes/{id} -- **PUT** /api/units/{unit_id}/outcomes/{id} -- **POST** /api/units/{unit_id}/outcomes - - - -------------------------------------------------------------------- - -### GET: Download the task sheet containing the details related to performing that task -GET /api/units/{unit_id}/task_definitions/{task_def_id}/task_pdf - -- URL: `/api/units/{unit_id}/task_definitions/{task_def_id}/task_pdf` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |---------------|--------------------------------------------|----------------|-----------|-----------| - | unit_id | The unit to upload tasks for | path | integer | Yes | - | task_def_id | The task definition to get the PDF of | path | integer | Yes | - | as_attachment | Whether or not to download file as attachment. Default is false. | query | boolean | No | - | Username | Username of the user | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - -- Response: `200` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/pdf' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' 'http://localhost:3000/api/units/1/task_definitions/1/task_pdf?as_attachment=true' - - ``` -- Response Body: - ``` - Download task_pdf?as_attachment=true - ``` - - --------------------------------------------------------------------- - -### GET: Download the tasks related to a task definition -GET /api/units/{unit_id}/task_definitions/{task_def_id}/tasks - -- URL: `/api/units/{unit_id}/task_definitions/{task_def_id}/tasks` -- Method: `GET` -- Parameter: - -| Parameter | Description | Parameter Type | Data Type | Mandatory | -|---------------|---------------------------------------|----------------|-----------|-----------| -| unit_id | The unit containing the task definition | path | integer | Yes | -| task_def_id | The task definition's id | path | integer | Yes | -| Username | Username of the user | header | string | Yes | -| Auth_Token | Authentication token | header | string | Yes | - -- Response: `200` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: Ym3A6yiuucA-82kcxcgF' 'http://localhost:3000/api/units/1/task_definitions/1/tasks' - ``` -- Response Body: - ```json - [ - { - "project_id": 2, - "id": 12, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-22", - "submission_date": "2024-04-20T10:56:18.978Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 3, - "id": 31, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-21", - "submission_date": "2024-04-20T10:56:24.059Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 4, - "id": 45, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-16", - "submission_date": "2024-04-20T10:57:04.514Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 5, - "id": 63, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-21", - "submission_date": "2024-04-20T10:57:35.703Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 7, - "id": 86, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-19", - "submission_date": "2024-04-20T10:58:28.084Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 8, - "id": 105, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-16", - "submission_date": "2024-04-20T10:58:33.116Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 9, - "id": 127, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-16", - "submission_date": "2024-04-20T10:58:38.421Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 10, - "id": 146, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-17", - "submission_date": "2024-04-20T10:58:43.259Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 11, - "id": 165, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-23", - "submission_date": "2024-04-20T10:59:13.681Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 12, - "id": 177, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-23", - "submission_date": "2024-04-20T10:59:16.725Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 13, - "id": 201, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-19", - "submission_date": "2024-04-20T10:59:22.471Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 15, - "id": 226, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-18", - "submission_date": "2024-04-20T10:59:48.270Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 16, - "id": 245, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-23", - "submission_date": "2024-04-20T10:59:53.349Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 17, - "id": 269, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-19", - "submission_date": "2024-04-20T11:00:28.887Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 18, - "id": 288, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "complete", - "completion_date": "2024-03-20", - "submission_date": "2024-04-20T11:00:33.670Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 14, - "id": 223, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "working_on_it", - "completion_date": null, - "submission_date": "2024-04-20T10:59:27.895Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 6, - "id": 77, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "redo", - "completion_date": null, - "submission_date": "2024-04-20T10:58:04.345Z", - "times_assessed": 1, - "similarity_flag": false, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - }, - { - "project_id": 1, - "id": 3, - "task_definition_id": 1, - "tutorial_id": null, - "tutorial_stream_id": null, - "status": "demonstrate", - "completion_date": "2024-03-18", - "submission_date": "2024-04-20T10:56:15.653Z", - "times_assessed": 1, - "similarity_flag": true, - "grade": null, - "quality_pts": -1, - "has_extensions": 0 - } - ] - ``` - --------------------------------------------------------------------------------------------------- - -### POST: Upload a zip file containing the task pdfs for a given task -POST /api/units/{unit_id}/task_definitions/task_pdfs - -- URL: `/api/units/{unit_id}/task_definitions/task_pdfs` -- Method: `POST` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-----------|-------------------------------|----------------|-----------|-----------| - | unit_id | The unit to upload tasks for | path | integer | Yes | - | file | Batch file upload | formData | file | Yes | - | Username | Username | header | string | Yes | - | Auth_Token| Authentication token | header | string | Yes | - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: S8Qzr1uoToYidkezNeZL' -F file=@"1.1P submission.zip" 'http://localhost:3000/api/units/1/task_definitions/task_pdfs' - ``` -- Response Body: - ```json - { - "success": [ - { - "row": "1.1P submission.pdf", - "message": "Added as task 1.1P" - } - ], - "errors": [], - "ignored": [] - } - ``` - --------------------------------------------------------------------------------------------- -### DELETE: Remove the task sheet for a given task -DELETE /api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet - -- URL: `/api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet` -- Method: `DELETE` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|----------------------------|----------------|-----------|-----------| - | unit_id | The related unit | path | integer | Yes | - | task_def_id | The related task definition| path | integer | Yes | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - -- Response: `204` - -- Example Request: - ```bash - curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/task_definitions/12/task_sheet' - ``` -- Response Body: - ``` - true - ``` ----------------------------------------------------------------------------------- -### POST: Upload the task sheet for a given task -POST /api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet - -- URL: `/api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet` -- Method: `POST` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|-------------------------------|----------------|-----------|-----------| - | unit_id | The related unit | path | integer | Yes | - | task_def_id | The related task definition | path | integer | Yes | - | file | The task sheet pdf | formData | file | Yes | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: S8Qzr1uoToYidkezNeZL' -F file=@"1.1P submission.pdf" 'http://localhost:3000/api/units/1/task_definitions/1/task_sheet' - ``` -- Response Body: - ``` - true - ``` - - -### DELETE: Delete a task definition -DELETE /api/units/{unit_id}/task_definitions/{id} - -- URL: `/api/units/{unit_id}/task_definitions/{id}` -- Method: `DELETE` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-----------|-------------|----------------|-----------|-----------| - | Username | Username of the user | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | unit_id | ID of the unit | header | integer | Yes | - | id | ID of the task | path | integer | Yes | - - -- Response: `204` - -- Example Request: - ```bash - curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/task_definitions/1' - ``` -- Response Body: - ``` - true - ``` - - ---------------------------------------------------------------------- - -### PUT: Edits the given task definition -- **PUT** /api/units/{unit_id}/task_definitions/{id} - -- URL: `/api/units/{unit_id}/task_definitions/{id}` -- Method: `PUT` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type |Mandatory| - |--------------------------|-----------------------------------------------------------|----------------|-----------|--| - | id | (required) The task id to edit | path | integer |Yes| - | task_def[tutorial_stream_abbr] | The abbreviation of the tutorial stream | formData | string | | - | task_def[name] | The name of this task def | formData | string | | - | task_def[description] | The description of this task def | formData | string | | - | task_def[weighting] | The weighting of this task | formData | integer | | - | task_def[target_grade] | Target grade for task | formData | integer | | - | task_def[group_set_id] | Related group set | formData | integer | | - | task_def[start_date] | The date when the task should be started | formData | date | | - | task_def[target_date] | The date when the task is due | formData | date | | - | task_def[due_date] | The deadline date | formData | date | | - | task_def[abbreviation] | The abbreviation of the task | formData | string | | - | task_def[restrict_status_updates] | Restrict updating of the status to staff | formData | boolean | | - | task_def[upload_requirements] | Task file upload requirements | formData | string | | - | task_def[plagiarism_checks] | The list of checks to perform | formData | string | | - | task_def[plagiarism_warn_pct] | The percent at which to record and warn about plagiarism | formData | integer | | - | task_def[is_graded] | Whether or not this task definition is a graded task | formData | boolean | | - | task_def[max_quality_pts] | A range for quality points when quality is assessed | formData | integer | | - | task_def[assessment_enabled] | Enable or disable assessment | formData | boolean | | - | task_def[overseer_image_id] | The id of the Docker image name for overseer | formData | integer | | - | Username | (required) Username | header | string | Yes| - | Auth_Token | (required) Authentication token | header | string | Yes| - | unit_id | (required) | header | integer |Yes | - -- Response: `200` - -- Example Request: - ```bash - curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' -d 'task_def%5Boverseer_image_id%5D=6578' 'http://localhost:3000/api/units/1/task_definitions/1' - ``` -- Response Body: - ```json - { - "id": 1, - "abbreviation": "1.1P", - "name": "Pass Task 1.1 - Hello World", - "description": "As a first step, create the classic 'Hello World' program. This will help ensure that you have all of the software installed correctly, and are ready to move on with creating other,,, programs.", - "weighting": 1, - "target_grade": 0, - "target_date": "2024-03-19", - "due_date": "2024-04-08", - "start_date": "2024-03-12", - "upload_requirements": [ - { - "key": "file0", - "name": "HelloWorld.pas", - "type": "code" - }, - { - "key": "file1", - "name": "Screenshot", - "type": "image" - } - ], - "tutorial_stream_abbr": "wrkshop-1", - "plagiarism_checks": null, - "plagiarism_warn_pct": 90, - "restrict_status_updates": false, - "group_set_id": null, - "has_task_sheet": true, - "has_task_resources": true, - "has_task_assessment_resources": false, - "is_graded": false, - "max_quality_pts": 0, - "overseer_image_id": 6578, - "assessment_enabled": false, - "moss_language": null - } - ``` - - ----------------------------------------------------------------------- - -### POST: Add a new task definition to the given unit -POST /api/units/{unit_id}/task_definitions - -- URL: `/api/units/{unit_id}/task_definitions` -- Method: `POST` -- Parameter: - - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |------------------------------------|--------------------------------------------------------|----------------|-----------|-----------| - | task_def[tutorial_stream_abbr] | The abbreviation of tutorial stream | formData | string | No | - | task_def[name] | The name of this task def | formData | string | Yes | - | task_def[description] | The description of this task def | formData | string | Yes | - | task_def[weighting] | The weighting of this task | formData | integer | Yes | - | task_def[target_grade] | Minimum grade for task | formData | integer | Yes | - | task_def[group_set_id] | Related group set | formData | integer | No | - | task_def[start_date] | The date when the task should be started | formData | date | Yes | - | task_def[target_date] | The date when the task is due | formData | date | Yes | - | task_def[due_date] | The deadline date | formData | date | No | - | task_def[abbreviation] | The abbreviation of the task | formData | string | Yes | - | task_def[restrict_status_updates] | Restrict updating of the status to staff | formData | boolean | No | - | task_def[upload_requirements] | Task file upload requirements | formData | string | No | - | task_def[plagiarism_checks] | The list of checks to perform | formData | string | No | - | task_def[plagiarism_warn_pct] | The percent at which to record and warn about plagiarism | formData | integer | Yes | - | task_def[is_graded] | Whether or not this task definition is a graded task | formData | boolean | No | - | task_def[max_quality_pts] | A range for quality points when quality is assessed | formData | integer | Yes | - | task_def[assessment_enabled] | Enable or disable assessment | formData | boolean | No | - | task_def[overseer_image_id] | The id of the Docker image for overseer | formData | integer | No | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | unit_id | The id for the unit | path | integer | Yes | - - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: text/error' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' -d 'task_def%5Bname%5D=test_test123&task_def%5Bdescription%5D=test_test1234&task_def%5Bweighting%5D=55&task_def%5Btarget_grade%5D=0&task_def%5Bstart_date%5D=2024-06-09T00%3A00%3A00.000Z&task_def%5Btarget_date%5D=2024-09-20T00%3A00%3A00.000Z&task_def%5Babbreviation%5D=test_test123&task_def%5Brestrict_status_updates%5D=true&task_def%5Bplagiarism_warn_pct%5D=40&task_def%5Bis_graded%5D=true&task_def%5Bmax_quality_pts%5D=99' 'http://localhost:3000/api/units/1/task_definitions' - ``` -- Response Body: - ```json - { - "id": 1234, - "name": "Assignment 1", - "description": "This is the first assignment", - "weighting": 10, - "target_grade": 80, - "group_set_id": 5678, - "start_date": "2024-06-01", - "target_date": "2024-06-30", - "due_date": "2024-07-05", - "abbreviation": "ASS1", - "restrict_status_updates": true, - "upload_requirements": "PDF only", - "plagiarism_checks": "Turnitin", - "plagiarism_warn_pct": 20, - "is_graded": true, - "max_quality_pts": 5, - "assessment_enabled": true, - "overseer_image_id": 9876 - } - ``` - - - ----------------------------------------------------------------------- - -### GET: Return unit learning alignment values with median stats for each tutorial -GET /api/units/{unit_id}/learning_alignments/class_details - -- URL: `/api/units/{unit_id}/learning_alignments/class_details` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |------------|------------------------|----------------|-----------|-----------| - | unit_id | The id of the unit | path | integer | Yes | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - -- Response: `200 OK` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: H8jTVdiyWzBz28cqkgDe' 'http://localhost:3000/api/units/1/learning_alignments/class_details' - ``` -- Response Body: - ```json - { - "1": { - "1": { - "median": 10.5, - "lower": 8.4, - "upper": 29.4, - "min": 8.2, - "max": 33 - }, - "2": { - "median": 22.4, - "lower": 11.4, - "upper": 31.5, - "min": 7.8, - "max": 39.6 - }, - "3": { - "median": 14.6, - "lower": 11.6, - "upper": 31.4, - "min": 10.8, - "max": 41.2 - }, - "4": { - "median": 4.8, - "lower": 0.8, - "upper": 8.3, - "min": 0.8, - "max": 8.8 - } - }, - "3": { - "1": { - "median": 37.3, - "lower": 31, - "upper": 52, - "min": 0.7, - "max": 54.4 - }, - "2": { - "median": 41.5, - "lower": 38, - "upper": 64.5, - "min": 0.7, - "max": 70.5 - }, - "3": { - "median": 42.9, - "lower": 38.5, - "upper": 52.5, - "min": 0.7, - "max": 54.3 - }, - "4": { - "median": 10.4, - "lower": 5.1, - "upper": 15, - "min": 0, - "max": 16 - } - }, - } - ``` - ------------------------------------------------------------------------ - -### GET: Return unit learning alignment median values -GET /api/units/{unit_id}/learning_alignments/class_stats - -- URL: `/api/units/{unit_id}/learning_alignments/class_stats` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |------------|--------------------------------------|----------------|-----------|-----------| - | unit_id | The id of the unit | path | integer | Yes | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - - -- Response: `200` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 9v88UUcnEy1cN7jyvUTK' 'http://localhost:3000/api/units/1/learning_alignments/class_stats' - ``` -- Response Body: - ```json - { - "1": { - "median": 33.7, - "lower": 10.6, - "upper": 40, - "min": 0.7, - "max": 54.4 - }, - "2": { - "median": 39.6, - "lower": 22.4, - "upper": 46.3, - "min": 0.7, - "max": 70.5 - }, - "3": { - "median": 40.7, - "lower": 14.6, - "upper": 48.3, - "min": 0.7, - "max": 54.7 - }, - "4": { - "median": 7.7, - "lower": 3.7, - "upper": 13.2, - "min": 0, - "max": 16 - } - } - ``` - - ------------------------------------------------------------------------- - -### DELETE: Delete the alignment between a task and unit outcome -- **DELETE** /api/units/{unit_id}/learning_alignments/{id} - -- URL: `/api/units/{unit_id}/learning_alignments/{id}` -- Method: `DELETE` -- Parameter: - - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |--------------|--------------------------------------------------------|----------------|-----------|-----------| - | id | The id of the task alignment | path | integer | Yes | - | unit_id | The id of the unit | path | integer | Yes | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - - -- Response: `204` - -- Example Request: - ```bash - curl -X DELETE --header 'Accept: text/error' --header 'Username: aadmin' --header 'Auth_Token: 9v88UUcnEy1cN7jyvUTK' 'http://localhost:3000/api/units/5/learning_alignments/1' - ``` -- Response Body: - ``` - true - ``` - - ------------------------------------------------------------------------ - -### PUT: Update the alignment between a task and unit outcome -PUT /api/units/{unit_id}/learning_alignments/{id} - - -- URL: `/api/units/{unit_id}/learning_alignments/{id}` -- Method: `PUT` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |--------------|--------------------------------------------------------|----------------|-----------|-----------| - | id | The id of the task alignment | path | integer | Yes | - | unit_id | The id of the unit | path | integer | Yes | - | description | The description of the alignment | formData | string | No | - | rating | The rating for this link, indicating the strength of this alignment | formData | integer | No | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - - -- Response: `200` - -- Example Request: - ```bash - curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 9v88UUcnEy1cN7jyvUTK' -d 'description=aligntest&rating=5' 'http://localhost:3000/api/units/1/learning_alignments/1' - ``` -- Response Body: - ```json - { - "id": 1, - "description": "aligntest", - "rating": 5, - "learning_outcome_id": 2, - "task_definition_id": 1 - } - ``` - - ------------------------------------------------------------------------- -### GET: Get the task/outcome alignment details for a unit or a project -GET /api/units/{unit_id}/learning_alignments - -- URL: `/api/units/{unit_id}/learning_alignments` -- Method: `GET` -- Parameter: - - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |------------|-----------------------------------------------------|----------------|-----------|-----------| - | unit_id | The id of the unit | path | integer | Yes | - | project_id | The id of the student project to get the alignment from | query | integer | Yes | - | Username | User Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - - -- Response: `200` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: mRHxyNJYkdxiCushUmm_' 'http://localhost:3000/api/units/1/learning_alignments?project_id=1' - ``` -- Response Body: - ```json - [ - { - "id": 104, - "description": "Simulated rationale text...", - "rating": 5, - "learning_outcome_id": 1, - "task_definition_id": 1, - "task_id": 3 - }, - { - "id": 105, - "description": "Simulated rationale text...", - "rating": 5, - "learning_outcome_id": 1, - "task_definition_id": 2, - "task_id": 4 - }, - { - "id": 106, - "description": "Simulated rationale text...", - "rating": 3, - "learning_outcome_id": 3, - "task_definition_id": 2, - "task_id": 4 - }, - { - "id": 107, - "description": "Simulated rationale text...", - "rating": 3, - "learning_outcome_id": 4, - "task_definition_id": 2, - "task_id": 4 - }, - { - "id": 108, - "description": "Simulated rationale text...", - "rating": 4, - "learning_outcome_id": 3, - "task_definition_id": 3, - "task_id": 5 - }, - ] - ``` - ------------------------------------------------------------------------------------ - -### POST: Add an outcome to a unit's task definition -POST /api/units/{unit_id}/learning_alignments - -- URL: `/api/units/{unit_id}/learning_alignments` -- Method: `POST` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |--------------------|-----------------------------------------------------|----------------|-----------|-----------| - | unit_id | The id of the unit | path | integer | Yes | - | learning_outcome_id | The id of the learning outcome | formData | integer | Yes | - | task_definition_id | The id of the task definition | formData | integer | Yes | - | project_id | The id of the project if this is a self reflection | formData | integer | Yes | - | description | The ILOs description | formData | string | Yes | - | rating | The rating for this link, indicating the strength of this alignment | formData | integer | Yes | - | Username | User username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: mRHxyNJYkdxiCushUmm_' -d 'learning_outcome_id=2&task_definition_id=2&project_id=1&description=test_ILO&rating=5' 'http://localhost:3000/api/units/1/learning_alignments' - ``` -- Response Body: - ```json - { - "id": 684, - "description": "test_ILO", - "rating": 5, - "learning_outcome_id": 2, - "task_definition_id": 2, - "task_id": 4 - } - ``` - ------------------------------------------------------------------------------------------------------- - -### GET: Download CSV of task alignments in this unit - -GET /api/units/{unit_id}/learning_alignments/csv - -- URL: `/api/units/{unit_id}/learning_alignments/csv` -- Method: `GET` -- Parameter: - - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |------------|--------------------------------------------|----------------|-----------|-----------| - | unit_id | The id of the unit | path | integer | Yes | - | project_id | The id of the student project to get from | query | integer | No | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - - -- Response: `200` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/octet-stream' --header 'Username: atutor' --header 'Auth_Token: m5s8cJP38mzC85iQz7FM' 'http://localhost:3000/api/units/1/learning_alignments/csv?project_id=1' - ``` -- Response Body: - ``` - Download csv?project_id=1 - ``` -------------------------------------------------------------------------------------------------- - - -### POST: Upload CSV of task to outcome alignments -POST /api/units/{unit_id}/learning_alignments/csv - -- URL: `/api/units/{unit_id}/learning_alignments/csv` -- Method: `POST` -- Parameter: - - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|--------------------------------------------|----------------|-----------|-----------| - | file | CSV upload file. | formData | file | | - | project_id | The id of the student project to upload the alignment to | formData | integer | | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | unit_id | The id of the unit | path | integer | Yes | - - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: m5s8cJP38mzC85iQz7FM' -F file=@"Book2.xlsx" -F project_id=1 'http://localhost:3000/api/units/1/learning_alignments/csv' - ``` -- Response Body: - ```json - { - "success": [], - "ignored": [], - "errors": [] - } - ``` --------------------------------------------------------------------------- - -### GET: Download the outcomes for a unit to a csv -GET /api/units/{unit_id}/outcomes/csv - -- URL: `/api/units/{unit_id}/outcomes/csv` -- Method: `GET` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |-------------|------------------------|----------------|-----------|-----------| - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | unit_id | | path | integer | Yes | - - -- Response: `200 OK` - -- Example Request: - ```bash - curl -X GET --header 'Accept: application/octet-stream' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' 'http://localhost:3000/api/units/1/outcomes/csv' - ``` -- Response Body: - ``` - Download csv - ``` ----------------------------------------------------------------------- - -### POST: Upload the outcomes for a unit from a csv -POST /api/units/{unit_id}/outcomes/csv - -- URL: `/api/units/{unit_id}/outcomes/csv` -- Method: `POST` -- Parameter: - - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |------------|------------------------------|----------------|-----------|-----------| - | file | CSV upload file. | formData | file | | - | unit_id | The unit to upload tasks to | path | integer | Yes | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' -F file=@"Book2.xlsx" 'http://localhost:3000/api/units/1/outcomes/csv' - ``` -- Response Body: - ```json - { - "success": [], - "errors": [], - "ignored": [] - } - ``` ---------------------------------------------------------------------- - -### DELETE: Delete an outcome from a unit -DELETE /api/units/{unit_id}/outcomes/{id} - -- URL: `/api/units/{unit_id}/outcomes/{id}` -- Method: `DELETE` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |------------|----------------------------------|----------------|-----------|-----------| - | unit_id | The id for the unit | path | integer | Yes | - | id | The id for the outcome you wish to delete | path | integer | Yes | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - - -- Response: `204` - -- Example Request: - ```bash - curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' 'http://localhost:3000/api/units/1/outcomes/1' - ``` -- Response Body: - ``` - true - ``` ------------------------------------------------------------------------- - -### PUT: Update ILO -PUT /api/units/{unit_id}/outcomes/{id} - -- URL: `/api/units/{unit_id}/outcomes/{id}` -- Method: `PUT` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |--------------|--------------------------------------------|----------------|-----------|-----------| - | unit_id | The unit ID for which the ILO belongs to | path | integer | Yes | - | name | The ILOs new name | formData | string | No | - | description | The ILOs new description | formData | string | No | - | abbreviation | The ILOs new abbreviation | formData | string | No | - | ilo_number | The ILOs new sequence number | formData | integer | No | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - | id | The ID of the ILO to update | path | integer | Yes | - - -- Response: `200` - -- Example Request: - ```bash - curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' -d 'abbreviation=tettettetet' 'http://localhost:3000/api/units/1/outcomes/1' - ``` -- Response Body: - ```json - { - "id": 1, - "ilo_number": 4, - "abbreviation": "test_test", - "name": "Functional Decomposition", - "description": "Use modular and functional decomposition to break problems down functionally, represent the resulting structures diagrammatically, and implement these structures in code as functions and procedures.\r\n" - } - ``` - -------------------------------------------------------------------------- - -### POST: Add an outcome to a unit -POST /api/units/{unit_id}/outcomes - - -- URL: `/api/units/{unit_id}/outcomes` -- Method: `POST` -- Parameter: - - | Parameter | Description | Parameter Type | Data Type | Mandatory | - |--------------|--------------------------------------------|----------------|-----------|-----------| - | unit_id | The unit ID for which the ILO belongs to | path | integer | Yes | - | name | The ILOs name | formData | string | Yes | - | description | The ILOs description | formData | string | Yes | - | abbreviation | The ILOs new abbreviation | formData | string | No | - | Username | Username | header | string | Yes | - | Auth_Token | Authentication token | header | string | Yes | - -- Response: `201` - -- Example Request: - ```bash - curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' -d 'name=outcome_111_test&description=test_111&abbreviation=test_ILO1' 'http://localhost:3000/api/units/1/outcomes' - ``` -- Response Body: - ```json - { - "id": 12, - "ilo_number": 5, - "abbreviation": "test_ILO1", - "name": "outcome_111_test", - "description": "test_111" - } - - ``` diff --git a/src/content/docs/backend/API/units_id.md b/src/content/docs/backend/API/units_id.md new file mode 100644 index 0000000..0621d57 --- /dev/null +++ b/src/content/docs/backend/API/units_id.md @@ -0,0 +1,789 @@ +--- +title: Doubtfire API +--- + +# List of Doubtfire + +# API: Units + +units : Operations about units + +This markdown document provides detailed documentation for the "units" API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl. + +## This "units" API page has the following operations + +- **GET** /api/units/{unit_id}/outcomes/csv +- **POST** /api/units/{unit_id}/outcomes/csv +- **DELETE** /api/units/{unit_id}/outcomes/{id} +- **PUT** /api/units/{unit_id}/outcomes/{id} +- **POST** /api/units/{unit_id}/outcomes +- **GET** /api/units/{id}/grades +- **GET** /api/units/{id}/tasks/inbox +- **GET** /api/units/{id}/feedback +- **POST** /api/units/{id}/rollover +- **GET** /api/units +- **POST** /api/units +- **GET** /api/units/{id} +- **PUT** /api/units/{id} + +--- + +### GET: Download the outcomes for a unit to a csv + +GET /api/units/{unit_id}/outcomes/csv + +- URL: `/api/units/{unit_id}/outcomes/csv` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | -------------------- | -------------- | --------- | --------- | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | unit_id | | path | integer | Yes | + +- Response: `200 OK` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/octet-stream' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' 'http://localhost:3000/api/units/1/outcomes/csv' + ``` +- Response Body: + ``` + Download csv + ``` + +--- + +### POST: Upload the outcomes for a unit from a csv + +POST /api/units/{unit_id}/outcomes/csv + +- URL: `/api/units/{unit_id}/outcomes/csv` +- Method: `POST` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | --------------------------- | -------------- | --------- | --------- | + | file | CSV upload file. | formData | file | | + | unit_id | The unit to upload tasks to | path | integer | Yes | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' -F file=@"Book2.xlsx" 'http://localhost:3000/api/units/1/outcomes/csv' + ``` +- Response Body: + ```json + { + "success": [], + "errors": [], + "ignored": [] + } + ``` + +--- + +### DELETE: Delete an outcome from a unit + +DELETE /api/units/{unit_id}/outcomes/{id} + +- URL: `/api/units/{unit_id}/outcomes/{id}` +- Method: `DELETE` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | ----------------------------------------- | -------------- | --------- | --------- | + | unit_id | The id for the unit | path | integer | Yes | + | id | The id for the outcome you wish to delete | path | integer | Yes | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + +- Response: `204` + +- Example Request: + ```bash + curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' 'http://localhost:3000/api/units/1/outcomes/1' + ``` +- Response Body: + ``` + true + ``` + +--- + +### PUT: Update ILO + +PUT /api/units/{unit_id}/outcomes/{id} + +- URL: `/api/units/{unit_id}/outcomes/{id}` +- Method: `PUT` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ------------ | ---------------------------------------- | -------------- | --------- | --------- | + | unit_id | The unit ID for which the ILO belongs to | path | integer | Yes | + | name | The ILOs new name | formData | string | No | + | description | The ILOs new description | formData | string | No | + | abbreviation | The ILOs new abbreviation | formData | string | No | + | ilo_number | The ILOs new sequence number | formData | integer | No | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | id | The ID of the ILO to update | path | integer | Yes | + +- Response: `200` + +- Example Request: + ```bash + curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' -d 'abbreviation=tettettetet' 'http://localhost:3000/api/units/1/outcomes/1' + ``` +- Response Body: + ```json + { + "id": 1, + "ilo_number": 4, + "abbreviation": "test_test", + "name": "Functional Decomposition", + "description": "Use modular and functional decomposition to break problems down functionally, represent the resulting structures diagrammatically, and implement these structures in code as functions and procedures.\r\n" + } + ``` + +--- + +### POST: Add an outcome to a unit + +POST /api/units/{unit_id}/outcomes + +- URL: `/api/units/{unit_id}/outcomes` +- Method: `POST` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ------------ | ---------------------------------------- | -------------- | --------- | --------- | + | unit_id | The unit ID for which the ILO belongs to | path | integer | Yes | + | name | The ILOs name | formData | string | Yes | + | description | The ILOs description | formData | string | Yes | + | abbreviation | The ILOs new abbreviation | formData | string | No | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: EJbyGkogpxtnNjXcvisj' -d 'name=outcome_111_test&description=test_111&abbreviation=test_ILO1' 'http://localhost:3000/api/units/1/outcomes' + ``` +- Response Body: + + ```json + { + "id": 12, + "ilo_number": 5, + "abbreviation": "test_ILO1", + "name": "outcome_111_test", + "description": "test_111" + } + ``` + + *** + + ### GET: Download the grades for a unit + + GET /api/units/{id}/grades + +- URL: `/api/units/{id}/grades` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | -------------------- | -------------- | --------- | --------- | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | id | The project id | path | integer | Yes | + +- Response: `200 OK` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/octet-stream' --header 'Username: aadmin' --header 'Auth_Token: Say13yA497H8wSFFXZxh' 'http://localhost:3000/api/units/1/grades' + ``` +- Response Body: + ``` + Download grades + ``` + +--- + +### GET: Download the tasks that should be listed under the task inbox + +GET /api/units/{id}/tasks/inbox + +- URL: `/api/units/{id}/tasks/inbox` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | -------------------- | -------------- | --------- | --------- | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | id | The project id | path | integer | Yes | + +- Response: `200 OK` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: xpx2aQkGKtgDsX4r-LY1' 'http://localhost:3000/api/units/1/tasks/inbox' + ``` +- Response Body: + ```json + [ + { + "id": 7, + "project_id": 1, + "task_definition_id": 5, + "tutorial_id": null, + "status": "discuss", + "completion_date": "2024-03-25", + "submission_date": "2024-04-20T10:56:17.318Z", + "times_assessed": 1, + "grade": null, + "quality_pts": -1, + "num_new_comments": 1, + "similarity_flag": false, + "pinned": 0, + "has_extensions": 0 + }, + { + "id": 8, + "project_id": 1, + "task_definition_id": 6, + "tutorial_id": null, + "status": "ready_for_feedback", + "completion_date": "2024-03-26", + "submission_date": "2024-04-20T10:56:17.627Z", + "times_assessed": 1, + "grade": null, + "quality_pts": -1, + "num_new_comments": 0, + "similarity_flag": false, + "pinned": 0, + "has_extensions": 0 + }, + { + "id": 10, + "project_id": 1, + "task_definition_id": 8, + "tutorial_id": null, + "status": "ready_for_feedback", + "completion_date": "2024-03-28", + "submission_date": "2024-04-20T10:56:18.175Z", + "times_assessed": 1, + "grade": null, + "quality_pts": -1, + "num_new_comments": 1, + "similarity_flag": false, + "pinned": 0, + "has_extensions": 0 + }, + { + "id": 11, + "project_id": 1, + "task_definition_id": 9, + "tutorial_id": null, + "status": "ready_for_feedback", + "completion_date": "2024-03-31", + "submission_date": "2024-04-20T10:56:18.510Z", + "times_assessed": 1, + "grade": null, + "quality_pts": 0, + "num_new_comments": 1, + "similarity_flag": false, + "pinned": 0, + "has_extensions": 0 + }, + { + "id": 12, + "project_id": 2, + "task_definition_id": 1, + "tutorial_id": null, + "status": "complete", + "completion_date": "2024-03-22", + "submission_date": "2024-04-20T10:56:18.978Z", + "times_assessed": 1, + "grade": null, + "quality_pts": -1, + "num_new_comments": 1, + "similarity_flag": true, + "pinned": 0, + "has_extensions": 0 + } + ] + ``` + +--- + +### GET: Download the tasks that are awaiting feedback for a unit + +GET /api/units/{id}/feedback + +- URL: `/api/units/{id}/feedback` +- Method: `GET` +- Parameter: + | Parameter | Description | Parameter Type | Data Type | Mandatory | + |-------------|------------------------|----------------|-----------|-----------| + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | id | The project id | path | integer | Yes | + +- Response: `200 OK` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: atutor' --header 'Auth_Token: xpx2aQkGKtgDsX4r-LY1' 'http://localhost:3000/api/units/1/feedback' + ``` +- Response Body: + ```json + [ + { + "id": 77, + "project_id": 6, + "task_definition_id": 1, + "tutorial_id": null, + "status": "redo", + "completion_date": null, + "submission_date": "2024-04-20T10:58:04.345Z", + "times_assessed": 1, + "grade": null, + "quality_pts": -1, + "num_new_comments": 0, + "similarity_flag": false, + "pinned": 0, + "has_extensions": 0 + }, + { + "id": 3, + "project_id": 1, + "task_definition_id": 1, + "tutorial_id": null, + "status": "demonstrate", + "completion_date": "2024-03-18", + "submission_date": "2024-04-20T10:56:15.653Z", + "times_assessed": 1, + "grade": null, + "quality_pts": -1, + "num_new_comments": 0, + "similarity_flag": true, + "pinned": 0, + "has_extensions": 0 + }, + { + "id": 79, + "project_id": 6, + "task_definition_id": 3, + "tutorial_id": null, + "status": "discuss", + "completion_date": "2024-03-20", + "submission_date": "2024-04-20T10:58:04.866Z", + "times_assessed": 1, + "grade": null, + "quality_pts": -1, + "num_new_comments": 1, + "similarity_flag": false, + "pinned": 0, + "has_extensions": 0 + }, + { + "id": 5, + "project_id": 1, + "task_definition_id": 3, + "tutorial_id": null, + "status": "demonstrate", + "completion_date": "2024-03-25", + "submission_date": "2024-04-20T10:56:16.843Z", + "times_assessed": 1, + "grade": null, + "quality_pts": -1, + "num_new_comments": 0, + "similarity_flag": false, + "pinned": 0, + "has_extensions": 0 + } + ] + ``` + +--- + +### POST: Rollover unit + +POST /api/units/{id}/rollover + +- URL: `/api/units/{id}/rollover` +- Method: `POST` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ------------------ | ---------------------- | -------------- | --------- | --------- | + | teaching_period_id | The teaching period id | formData | string | Yes | + | start_date | The start date | formData | string | | + | end_date | The end date | formData | string | | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | id | The project id | path | integer | Yes | + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' -d 'teaching_period_id=1' 'http://localhost:3000/api/units/1/rollover' + ``` +- Response Body: + ```json + { + "code": "COS10001", + "id": 5, + "name": "Introduction to Programming", + "my_role": "Admin", + "main_convenor_id": 17, + "description": "illo quas voluptatem ea tempore aperiam sapiente cum harum tenetur vitae", + "teaching_period_id": 1, + "start_date": "2018-03-05", + "end_date": "2018-05-25", + "active": true, + "overseer_image_id": null, + "assessment_enabled": true, + "auto_apply_extension_before_deadline": true, + "send_notifications": true, + "enable_sync_enrolments": true, + "enable_sync_timetable": true, + "draft_task_definition_id": null, + "allow_student_extension_requests": true, + "extension_weeks_on_resubmit_request": 1, + "allow_student_change_tutorial": true, + "ilos": [ + { + "id": 8, + "ilo_number": 4, + "abbreviation": "DECOMP", + "name": "Functional Decomposition", + "description": "Use modular and functional decomposition to break problems down functionally, represent the resulting structures diagrammatically, and implement these structures in code as functions and procedures.\r\n" + }, + { + "id": 9, + "ilo_number": 3, + "abbreviation": "PROG", + "name": "Program", + "description": "Construct small programs, using the programming languages covered, that include the use of arrays, functions and procedures, parameter passing with call by value and call by reference, custom data types, and pointers.\r\n" + }, + { + "id": 10, + "ilo_number": 2, + "abbreviation": "PRIN", + "name": "Structured Programming", + "description": "Describe the principles of structured programming, and relate these to the syntactical elements of the programming language used and the way programs are developed.\r\n" + } + ] + } + ``` + +--- + +### GET: Get units related to the current user for admin purposes + +GET /api/units + +- URL: `/api/units` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ----------------- | --------------------------------- | -------------- | --------- | --------- | + | include_in_active | Include units that are not active | query | boolean | | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + +- Response: `200 OK` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' 'http://localhost:3000/api/units?include_in_active=true' + ``` +- Response Body: + ```json + [ + { + "code": "COS10001", + "id": 1, + "name": "Introduction to Programming", + "my_role": "Admin", + "main_convenor_user_id": 2, + "description": "illo quas voluptatem ea tempore aperiam sapiente cum harum tenetur vitae", + "start_date": "2024-03-09", + "end_date": "2024-06-08", + "active": true + }, + { + "code": "COS20007", + "id": 2, + "name": "Object Oriented Programming", + "my_role": "Admin", + "main_convenor_user_id": 2, + "description": "laudantium dolores rerum tenetur sint aut distinctio velit magni quasi", + "start_date": "2024-03-09", + "end_date": "2024-06-08", + "active": true + }, + { + "code": "COS30046", + "id": 3, + "name": "Artificial Intelligence for Games", + "my_role": "Admin", + "main_convenor_user_id": 3, + "description": "est laboriosam repellat eos numquam iusto cupiditate praesentium corporis et eligendi pariatur", + "start_date": "2024-03-09", + "end_date": "2024-06-08", + "active": true + }, + { + "code": "COS30243", + "id": 4, + "name": "Game Programming", + "my_role": "Admin", + "main_convenor_user_id": 3, + "description": "omnis delectus perferendis earum culpa voluptate nesciunt fugiat quam dicta et eius ut dignissimos", + "start_date": "2024-03-09", + "end_date": "2024-06-08", + "active": true + }, + { + "code": "COS10001", + "id": 5, + "name": "Introduction to Programming", + "my_role": "Admin", + "main_convenor_user_id": 2, + "description": "illo quas voluptatem ea tempore aperiam sapiente cum harum tenetur vitae", + "teaching_period_id": 1, + "start_date": "2018-03-05", + "end_date": "2018-05-25", + "active": true + } + ] + ``` + +--- + +### POST: Create Unit + +POST /api/units + +- URL: `/api/units` +- Method: `POST` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ------------------------------------------ | --------------------------------------------------------------------------- | -------------- | --------- | --------- | + | unit[name] | The name of the unit | formData | string | Yes | + | unit[code] | The code of the unit | formData | string | Yes | + | unit[description] | The description of the unit | formData | string | No | + | unit[active] | Indicates if the unit is active | formData | boolean | Yes | + | unit[teaching_period_id] | The ID of the teaching period | formData | integer | Yes | + | unit[start_date] | The start date of the unit | formData | date | No | + | unit[end_date] | The end date of the unit | formData | date | No | + | unit[main_convenor_user_id] | The user ID of the main convenor | formData | integer | Yes | + | unit[auto_apply_extension_before_deadline] | Indicates if extensions before the deadline should be automatically applied | formData | boolean | No | + | unit[send_notifications] | Indicates if emails should be sent on updates each week | formData | boolean | No | + | unit[enable_sync_timetable] | Sync to timetable automatically if supported by deployment | formData | boolean | No | + | unit[enable_sync_enrolments] | Sync student enrolments automatically if supported by deployment | formData | boolean | No | + | unit[allow_student_extension_requests] | Can turn on/off student extension requests | formData | boolean | No | + | unit[extension_weeks_on_resubmit_request] | Determines the number of weeks extension on a resubmit request | formData | integer | No | + | unit[portfolio_auto_generation_date] | Indicates a date where student portfolio will automatically compile | formData | date | No | + | unit[allow_student_change_tutorial] | Can turn on/off student ability to change tutorials | formData | boolean | No | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + +- Response: `201` + +- Example Request: + ```bash + curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' -d 'unit%5Bname%5D=Test%20unit&unit%5Bcode%5D=COS11115&unit%5Bactive%5D=true&unit%5Bteaching_period_id%5D=1&unit%5Bmain_convenor_user_id%5D=2&unit%5Bauto_apply_extension_before_deadline%5D=true&unit%5Bsend_notifications%5D=true&unit%5Benable_sync_timetable%5D=true&unit%5Benable_sync_enrolments%5D=true&unit%5Ballow_student_extension_requests%5D=true&unit%5Bextension_weeks_on_resubmit_request%5D=1&unit%5Ballow_student_change_tutorial%5D=true' 'http://localhost:3000/api/units' + ``` +- Response Body: + ```json + { + "code": "COS11115", + "id": 6, + "name": "Test unit", + "my_role": "Convenor", + "main_convenor_id": 18, + "description": "Test unit", + "teaching_period_id": 1, + "start_date": "2018-03-05", + "end_date": "2018-05-25", + "active": true, + "overseer_image_id": null, + "assessment_enabled": true, + "auto_apply_extension_before_deadline": true, + "send_notifications": true, + "enable_sync_enrolments": true, + "enable_sync_timetable": true, + "draft_task_definition_id": null, + "allow_student_extension_requests": true, + "extension_weeks_on_resubmit_request": 1, + "allow_student_change_tutorial": true, + "ilos": [], + "tutorial_streams": [], + "staff": [ + { + "id": 18, + "role": "Convenor", + "user": { + "id": 1, + "email": "aadmin@doubtfire.com", + "first_name": "Admin", + "last_name": "Admin", + "username": "aadmin", + "nickname": "Admin" + } + } + ], + "tutorials": [], + "task_definitions": [], + "task_outcome_alignments": [], + "group_sets": [], + "groups": [] + } + ``` + +--- + +### GET: Get a unit's details + +GET /api/units/{id} + +- URL: `/api/units/{id}` +- Method: `GET` +- Parameter: + + | Parameter | Description | Parameter Type | Data Type | Mandatory | + | ---------- | -------------------- | -------------- | --------- | --------- | + | Username | Username | header | string | Yes | + | Auth_Token | Authentication token | header | string | Yes | + | id | The project id | path | integer | Yes | + +- Response: `200 OK` + +- Example Request: + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' 'http://localhost:3000/api/units/1' + ``` +- Response Body: + ```json + { + "code": "COS10001", + "id": 1, + "name": "Introduction to Programming", + "my_role": "Admin", + "main_convenor_id": 1, + "description": "illo quas voluptatem ea tempore aperiam sapiente cum harum tenetur vitae", + "start_date": "2024-03-09", + "end_date": "2024-06-08", + "active": true, + "overseer_image_id": null, + "assessment_enabled": true, + "auto_apply_extension_before_deadline": true, + "send_notifications": true, + "enable_sync_enrolments": true, + "enable_sync_timetable": true, + "draft_task_definition_id": null, + "allow_student_extension_requests": true, + "extension_weeks_on_resubmit_request": 1, + "allow_student_change_tutorial": true, + "ilos": [ + { + "id": 1, + "ilo_number": 4, + "abbreviation": "DECOMP", + "name": "Functional Decomposition", + "description": "Use modular and functional decomposition to break problems down functionally, represent the resulting structures diagrammatically, and implement these structures in code as functions and procedures.\r\n" + },] + "tutorial_streams": [ + { + "id": 1, + "name": "Workshop-1", + "abbreviation": "wrkshop-1", + "activity_type": "wrkshop" + },] + "task_definitions": [ + { + "id": 1, + "abbreviation": "1.1P", + "name": "Pass Task 1.1 - Hello World", + "description": "As a first step, create the classic 'Hello World' program. This will help ensure that you have all of the software installed correctly, and are ready to move on with creating other,,, programs.", + "weighting": 1, + "target_grade": 0, + "target_date": "2024-03-19", + "due_date": "2024-04-08", + "start_date": "2024-03-12", + "upload_requirements": [ + { + "key": "file0", + "name": "HelloWorld.pas", + "type": "code" + },] + }] + } + + ``` + +--- + +### PUT: Update unit + +PUT /api/units/{id} + +- URL: `/api/units/{id}` +- Method: `PUT` +- Parameter: + +| Parameter | Description | Parameter Type | Data Type | Mandatory | +| ------------------------------------------ | --------------------------------------------------------------------------------- | -------------- | --------- | --------- | +| id | The unit id to update | path | integer | Yes | +| unit[name] | Test unit\_ Introduction to Programming | formData | string | Yes | +| unit[code] | | formData | string | No | +| unit[description] | | formData | string | No | +| unit[active] | | formData | boolean | No | +| unit[teaching_period_id] | | formData | integer | No | +| unit[start_date] | | formData | date | No | +| unit[end_date] | | formData | date | No | +| unit[main_convenor_id] | | formData | integer | No | +| unit[auto_apply_extension_before_deadline] | Indicates if extensions before the deadline should be automatically applied | formData | boolean | No | +| unit[send_notifications] | Indicates if emails should be sent on updates each week | formData | boolean | No | +| unit[enable_sync_timetable] | Sync to timetable automatically if supported by deployment | formData | boolean | No | +| unit[enable_sync_enrolments] | Sync student enrolments automatically if supported by deployment | formData | boolean | No | +| unit[draft_task_definition_id] | Indicates the ID of the task definition used as the "draft learning summary task" | formData | integer | No | +| unit[portfolio_auto_generation_date] | Indicates a date where student portfolio will automatically compile | formData | date | No | +| unit[allow_student_extension_requests] | Can turn on/off student extension requests | formData | boolean | No | +| unit[allow_student_change_tutorial] | Can turn on/off student ability to change tutorials | formData | boolean | No | +| unit[extension_weeks_on_resubmit_request] | Determines the number of weeks extension on a resubmit request | formData | integer | No | +| unit[overseer_image_id] | The id of the docker image used with | formData | integer | No | +| unit [assessment_enabled] | | formData | boolean | No | +| Username | User username | header | string | Yes | +| Auth_token | Authentication token | header | string | Yes | + +- Response: `200` + +- Example Request: + ```bash + curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: DCj-W7zLU3RX6qazApjQ' -d 'unit%5Bname%5D=Test%20unit_%20Introduction%20to%20Programming&unit%5Bassessment_enabled%5D=true' 'http://localhost:3000/api/units/1' + ``` +- Response Body: + ```json + { + "name": "Test unit_ Introduction to Programming", + "assessment_enabled": true + } + ``` + +---