Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API documentation for admin,tasks,submission,tii_actions #9

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 177 additions & 2 deletions src/content/docs/backend/API/admin.md
DudeUnleashed marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,190 @@
title: Doubtfire API Documentation
---

# API: Admin
# API: Admin

admin : Operations about admin
This markdown document provides detailed documentation for the "admin" API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl

This "admin" API has the following operations.

- **PUT**: /api/admin/overseer_images/{id}/pull_image
- **GET**: /api/admin/overseer_images
- **POST**: /api/admin/overseer_images
- **DELETE**: /api/admin/overseer_images/{id}
- **PUT**: /api/admin/overseer_images/{id}

## Detail of Operations related to admin.
## Detail of Operations related to admin.

### PUT: Pull Overseer Image

PUT /api/admin/overseer_images/{id}/pull_image

- URL: `/api/admin/overseer_images/{id}/pull_image`
- Method: `PUT`
- Parameters:
| Parameter | Description |Parameter Type| Data Type|Mandatory|
|---------------------|-----------------|------------|------------|---|
|id |Overseer image ID| path | integer|Yes|
|Username | User username | header | string | Yes |
|Auth_Token | Authentication token | header | string |Yes|

- Response:
`200 OK`

- Example Request:
```bash
curl -X PUT --header 'Accept: application/json' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n' 'http://localhost:3000/api/admin/overseer_images/1/pull_image'
```
- Response body:
```json
{
"id": 1,
"name": "Example Image",
"tag": "example/tag",
"status": "pulled"
}
```

---

### GET: Retrieve All Overseer Images

GET /api/admin/overseer_images

- URL: `/api/admin/overseer_images`
- Method: `GET`
- Parameters:
| Parameter | Description |Parameter Type| Data Type|Mandatory|
|---------------------|-----------------|------------|------------|---|
|Username | User 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: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n' 'http://localhost:3000/api/admin/overseer_images'
```
- Response Body:
```json
[
{
"id": 1,
"name": "Example Image",
"tag": "example/tag"
},
{
"id": 2,
"name": "Another Image",
"tag": "another/tag"
}
]
```

---

### POST: Add an Overseer Image

POST /api/admin/overseer_images

- URL: `/api/admin/overseer_images`
- Method: `POST`
- Parameters:
| Parameter | Description | Parameter Type | Data Type | Mandatory |
|-----------------------|-------------------------------------------|----------------|-----------|-----------|
| overseer_image | The overseer image object | body | hash | Yes |
| overseer_image.name | The name to display for this image | body | string | Yes |
| overseer_image.tag | The tag used to retrieve from container repo | body | string | 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/json' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n'-d '{
"overseer_image": {
"name": "Example Image",
"tag": "example/tag"
}
}' 'http://localhost:3000/api/admin/overseer_images'
```
- Response Body:
```json
{
"id": 1,
"name": "Example Image",
"tag": "example/tag"
}
```

---

### DELETE: Delete an Overseer Image

DELETE /api/admin/overseer_images/{id}

- URL: `/api/admin/overseer_images/{id}`
- Method: `DELETE`
- Parameters:

| Parameter | Description | Parameter Type | Data Type | Mandatory |
| ---------- | -------------------- | -------------- | --------- | --------- |
| id | Overseer image ID | path | integer | Yes |
| Username | User username | header | string | Yes |
| Auth_Token | Authentication token | header | string | Yes |

- Response:

- `204`

- Example Request:
```bash
curl -X DELETE --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n' 'http://localhost:3000/api/admin/overseer_images/1'
```
- Response Body:
`Overseer image deleted `

---

### PUT: Update an Overseer Image

PUT /api/admin/overseer_images/{id}

- URL: `/api/admin/overseer_images/{id}`
- Method: `PUT`
- Parameters:

| Parameter | Description | Parameter Type | Data Type | Mandatory |
| ------------------- | -------------------------------------------- | -------------- | --------- | --------- |
| id | Overseer image ID | path | integer | Yes |
| overseer_image | The overseer image object | body | hash | Yes |
| overseer_image.name | The name to display for this image | body | string | No |
| overseer_image.tag | The tag used to retrieve from container repo | body | string | No |
| 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/json' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n'
-d '{
"overseer_image": {
"name": "Updated Example Image",
"tag": "updated/tag"
}
}' 'http://localhost:3000/api/admin/overseer_images/1'
```
- Response Body:
```json
{
"id": 1,
"name": "Updated Example Image",
"tag": "updated/tag"
}
```
161 changes: 155 additions & 6 deletions src/content/docs/backend/API/submission.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,169 @@
---
title: Doubtfire API
title: Doubtfire API
---

# List of Doubtfire

# API: Submission

submission : Operations about submission
This markdown document provides detailed documentation for the "submission" API endpoints including their URLs, methods, parameters, responses, and example requests using curl.
This markdown document provides detailed documentation for the "submission" API endpoints including their URLs, methods, parameters, responses, and example requests using curl.

This "submission" API has the following operations.

- **GET**: /api/submission/assess
- **POST**: /api/submission/assess
- **DELETE**: /api/submission/project/{id}/portfolio
- **GET**: /api/submission/project/{id}/portfolio
- **PUT**: /api/submission/project/{id}/portfolio
- **POST**: /api/submission/project/{id}/portfolio

## Detail of Operations related to submission.

### GET: Retrieve Submissions Ready to Mark

GET /api/submission/assess

- URL: `/api/submission/assess`
- Method: `GET`
- Parameters:

| Parameter | Description | Parameter Type | Data Type | Mandatory |
| ---------- | ---------------------------------------------- | -------------- | --------- | --------- |
| unit_id | Unit ID to retrieve submissions for | query | integer | Yes |
| user_id | User ID to retrieve submissions for (optional) | query | integer | No |
| Username | User 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: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n' 'http://localhost:3000/api/submission/assess?unit_id=1&user_id=2'
```
- Response Body:
This endpoint returns a zip file containing the tasks ready for marking. The response does not have a JSON body.

---

### POST: Upload Submission Documents

POST /api/submission/assess

- URL: `/api/submission/assess`
- Method: `POST`
- Parameters:

| Parameter | Description | Parameter Type | Data Type | Mandatory |
| ---------- | -------------------------------------------------- | -------------- | --------- | --------- |
| file | Batch file upload | body | file | Yes |
| unit_id | Unit ID to upload marked submissions to | body | integer | Yes |
| user_id | User ID to upload marked submissions to (optional) | body | 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: multipart/form-data' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n' -F 'file=@path_to_your_file' -F 'unit_id=1' -F 'user_id=2' 'http://localhost:3000/api/submission/assess'
```
- Response Body:
```json
{
"message": "Batch upload successful"
}
```

---

### POST: Upload Portfolio Document

POST /api/submission/project/{id}/portfolio

- URL: `/api/submission/project/{id}/portfolio`
- Method: `POST`
- Parameters:

| Parameter | Description | Parameter Type | Data Type | Mandatory |
| ---------- | --------------------------------------------------------- | -------------- | --------- | --------- |
| name | Name of the part being uploaded | body | string | Yes |
| kind | The kind of file being uploaded: document, code, or image | body | string | Yes |
| file0 | The file being uploaded | body | file | 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: multipart/form-data' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n' -F 'name=Part 1' -F 'kind=document' -F 'file0=@path_to_your_file' 'http://localhost:3000/api/submission/project/1/portfolio'
```

- Response Body:
```json
{
"file_name": "Part 1",
"file_kind": "document",
"file_path": "path_to_file"
}
```

---

### DELETE: Remove Portfolio Document

DELETE /api/submission/project/{id}/portfolio

- URL: `/api/submission/project/{id}/portfolio`
- Method: `DELETE`
- Parameters:

| Parameter | Description | Parameter Type | Data Type | Mandatory |
| ---------- | ------------------------------------------------------------------- | -------------- | --------- | --------- |
| id | Project ID | path | integer | Yes |
| idx | The index of the file (optional) | query | integer | No |
| kind | The kind of file being removed: document, code, or image (optional) | query | string | No |
| name | Name of file to remove (optional) | query | string | No |
| Username | User username | header | string | Yes |
| Auth_Token | Authentication token | header | string | Yes |

- Response:
`204`

- Example Request:
```bash
curl -X DELETE --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n' 'http://localhost:3000/api/submission/project/1/portfolio?idx=0&kind=document&name=Part 1'
```
- Response Body:
`Portfolio deleted `

---

### GET: Retrieve Portfolio

GET /api/submission/project/{id}/portfolio

- URL: `/api/submission/project/{id}/portfolio`
- Method: `GET`
- Parameters:

| Parameter | Description | Parameter Type | Data Type | Mandatory |
| ------------- | -------------------------------------------------------- | -------------- | --------- | --------- |
| id | Project ID | path | integer | Yes |
| as_attachment | Whether or not to download file as attachment (optional) | query | boolean | No |
| Username | User 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: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n' 'http://localhost:3000/api/submission/project/1/portfolio?as_attachment=true'
```

## Detail of Operations related to submission.
- Response Body:
This endpoint returns a PDF file of the portfolio. The response does not have a JSON body.
Loading
Loading