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

Added detailed pages for each backend API and completed documentatio… #3

Merged
merged 2 commits into from
May 27, 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
78 changes: 76 additions & 2 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,87 @@ export default defineConfig({
},
items: [
{
label: 'Doubtfire API Documentation',
label: 'Doubtfire API Documentation List',
link: '/backend/api/api_list',
},
{
label: 'Activity Types',
label: 'activity types',
link: '/backend/api/activity_types',
},

{
label: 'admin',
link: '/backend/api/admin',
},
{
label: 'auth',
link: '/backend/api/auth',
},
{
label: 'campuses',
link: '/backend/api/campuses',
},
{
label: 'csv',
link: '/backend/api/csv',
},
{
label: 'projects',
link: '/backend/api/projects',
},
{
label: 'setting',
link: '/backend/api/setting',
},
{
label: 'students',
link: '/backend/api/students',
},
{
label: 'submission',
link: '/backend/api/submission',
},
{
label: 'tasks',
link: '/backend/api/tasks',
},
{
label: 'teaching periods',
link: '/backend/api/teaching_periods',
},
{
label: 'tii_actions',
link: '/backend/api/tii_actions',
},
{
label: 'tii_eula',
link: '/backend/api/tii_eula',
},
{
label: 'tii_hook',
link: '/backend/api/tii_hook',
},
{
label: 'tutorials',
link: '/backend/api/tutorials',
},
{
label: 'unit_roles',
link: '/backend/api/unit_roles',
},

{
label: 'units',
link: '/backend/api/units',
},
{
label: 'users',
link: '/backend/api/users',
},
{
label: 'webcal',
link: '/backend/api/webcal',
},
{
label: 'Error codes',
link: '/backend/api/error_codes',
Expand Down
147 changes: 132 additions & 15 deletions src/content/docs/backend/API/activity_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,34 @@
title: Doubtfire API Documentation
---

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

This "activity_types" API has the following operations.

- **GET**: /api/activity types
- **POST**: /api/activity types
- **DELETE**: /api/activity types/{id}
- **GET**: /api/activity types/{id}
- **PUT**: /api/activity types/{id}
- **GET**: /api/activity_types
- **POST**: /api/activity_types
- **DELETE**: /api/activity_types/{id}
- **GET**: /api/activity_types/{id}
- **PUT**: /api/activity_types/{id}

## Detail of Operations related to activity types.

### GET activity_types: gets a list of all activity types.
GET /api/activity_types

- **URL**: `http://localhost:3000/api/activity_types`
- **Method**: `GET`
- **Parameters**: None
- **Response**:
- URL: `api/activity_types`
- Method: `GET`
- Parameters: None
- Response: `200 OK`

- `200 OK`:
- Example Request:
```bash
curl -X GET --header 'Accept: application/json' 'http://localhost:3000/api/activity_types'
```

- Response body:
```json
[
{
Expand All @@ -37,13 +45,122 @@ This "activity_types" API has the following operations.
{
"id": 3,
"name": "Class",
"abb
"abbreviation": "cls"
},
...
]

```

- **Example Request**:

### POST activity_types: creates or adds a new activity type
POST/api/activity_types

- URL: `api/activity_types`
- Method: `POST`
- Parameters:

| Parameter | Description |Parameter Type| Data Type|Mandatory|
|---------------------|-----------------|------------|------------|---|
| name | The name of the activity type | formData| string|Yes|
|abbreviation | The abbreviation for the activity type | formData| string|Yes|
|Username | enter the username | header | string |Yes|
|Auth_Token | Authentication token | header | string |Yes|

- Response:
`201 Created`

- Example Request:
```bash
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 9zV37yx2jQ3j8Nsy4MP_' -d 'activity_type%5Bname%5D=Practical1&activity_type%5Babbreviation%5D=prac1' 'http://localhost:3000/api/activity_types'
```

- Response Body
```json
{
"id": 4,
"name": "Practical1",
"abbreviation": "prac1"
}
```

### DELETE activity_types: delete an activity type
DELETE /api/activity_types/{id}

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

| Parameter | Description |Parameter Type| Data Type|Mandatory|
|---------------------|-----------------|------------|------------|-----|
|Username | enter the username | header | string |Yes|
|Auth_Token | Authentication token | header | string |Yes|
|id | | path | integer|Yes|

- Response:
`204` No Content

- Example request
```bash
curl -X GET --header 'Accept: application/json' 'http://localhost:3000/api/activity_types'
curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: 5zR37VDdBV6FZvJzABPS' 'http://localhost:3000/api/activity_types/4'
```

### GET: Get an activity type details
GET /api/activity_types/{id}

- URL: `api/activity_types/{id}`
- Method: `GET`
- Parameters:

| Parameter | Description |Parameter Type| Data Type|Mandatory|
|---------------------|-----------------|------------|------------|---|
|id | | path | integer|Yes|

- Response:
`200 OK`

- Example request
```bash
curl -X GET --header 'Accept: application/json' 'http://localhost:3000/api/activity_types/3'
```

- Response Body:
```json
{
"id": 3,
"name": "Class",
"abbreviation": "cls"
}
```


### PUT: Update an activity type
PUT /api/activity_types/{id}

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

| Parameter | Description |Parameter Type| Data Type|Mandatory|
|---------------------|-----------------|------------|------------|-----|
| activity_type [name] | The name of the activity type | formData| string| |
|activity_type [abbreviation] | The abbreviation for the activity type | formData| string||
|Username | enter the username | header | string |Yes|
|Auth_Token | Authentication token | header | string | Yes|
|id | | path | integer| 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: nHyAVEAsSp25snxiLomP' -d 'activity_type%5Bname%5D=Practical1&activity_type%5Babbreviation%5D=prac1' 'http://localhost:3000/api/activity_types/5'
```

- Response Body
```json
{
"id": 5,
"name": "Practical1",
"abbreviation": "prac1"
}
```

16 changes: 16 additions & 0 deletions src/content/docs/backend/API/admin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Doubtfire API Documentation
---

# 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.
Loading
Loading