Skip to content

Commit

Permalink
Added detailed pages for each backend API and completed documentatio…
Browse files Browse the repository at this point in the history
…n for API_Set1
  • Loading branch information
HarshitaShroff committed May 13, 2024
1 parent 9621805 commit 762b9cc
Show file tree
Hide file tree
Showing 20 changed files with 2,397 additions and 12 deletions.
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
137 changes: 127 additions & 10 deletions src/content/docs/backend/API/activity_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
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.

Expand All @@ -15,13 +17,19 @@ This "activity_types" API has the following operations.
## 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

0 comments on commit 762b9cc

Please sign in to comment.