|
| 1 | +# OpenAPI Specification |
| 2 | + |
| 3 | +This directory contains the OpenAPI 3.0 specification for the Classeviva API. |
| 4 | + |
| 5 | +## What is this? |
| 6 | + |
| 7 | +The `openapi.yaml` file is a machine-readable API specification that describes all the endpoints, request/response formats, and data models for the Classeviva school portal API. |
| 8 | + |
| 9 | +**Note**: This is an unofficial specification created by reverse engineering and community documentation. The official Classeviva API is not publicly documented by Spaggiari. |
| 10 | + |
| 11 | +## What can I do with it? |
| 12 | + |
| 13 | +### 1. View Interactive Documentation |
| 14 | + |
| 15 | +#### Online (GitHub Pages) |
| 16 | +The API documentation is automatically published to GitHub Pages: |
| 17 | + |
| 18 | +🔗 **https://zmoog.github.io/classeviva/** |
| 19 | + |
| 20 | +This is updated automatically whenever the `openapi.yaml` file is changed on the `main` branch. |
| 21 | + |
| 22 | +#### Using Swagger UI Online |
| 23 | +1. Go to https://editor.swagger.io/ |
| 24 | +2. Click "File" → "Import File" |
| 25 | +3. Upload the `openapi.yaml` file |
| 26 | +4. Browse the interactive documentation |
| 27 | + |
| 28 | +#### Using Redoc Locally |
| 29 | +```bash |
| 30 | +npx @redocly/cli preview-docs openapi.yaml |
| 31 | +``` |
| 32 | + |
| 33 | +Then open http://localhost:8080 in your browser. |
| 34 | + |
| 35 | +### 2. Generate API Clients |
| 36 | + |
| 37 | +Generate a client library in your preferred programming language: |
| 38 | + |
| 39 | +#### Python |
| 40 | +```bash |
| 41 | +npx @openapitools/openapi-generator-cli generate \ |
| 42 | + -i openapi.yaml \ |
| 43 | + -g python \ |
| 44 | + -o ./generated/python-client |
| 45 | +``` |
| 46 | + |
| 47 | +#### JavaScript/TypeScript |
| 48 | +```bash |
| 49 | +npx @openapitools/openapi-generator-cli generate \ |
| 50 | + -i openapi.yaml \ |
| 51 | + -g typescript-axios \ |
| 52 | + -o ./generated/typescript-client |
| 53 | +``` |
| 54 | + |
| 55 | +#### Java |
| 56 | +```bash |
| 57 | +npx @openapitools/openapi-generator-cli generate \ |
| 58 | + -i openapi.yaml \ |
| 59 | + -g java \ |
| 60 | + -o ./generated/java-client |
| 61 | +``` |
| 62 | + |
| 63 | +#### Other Languages |
| 64 | +OpenAPI Generator supports [50+ languages](https://openapi-generator.tech/docs/generators). Replace the `-g` flag with your target language. |
| 65 | + |
| 66 | +### 3. Validate API Requests |
| 67 | + |
| 68 | +Use the specification to validate API requests and responses in your tests: |
| 69 | + |
| 70 | +```bash |
| 71 | +npm install -g @redocly/cli |
| 72 | +redocly lint openapi.yaml |
| 73 | +``` |
| 74 | + |
| 75 | +### 4. Mock API Server |
| 76 | + |
| 77 | +Create a mock server for testing without hitting the real API: |
| 78 | + |
| 79 | +```bash |
| 80 | +npx @stoplight/prism-cli mock openapi.yaml |
| 81 | +``` |
| 82 | + |
| 83 | +## API Overview |
| 84 | + |
| 85 | +The Classeviva API provides access to: |
| 86 | + |
| 87 | +- **Authentication**: Login and session management |
| 88 | +- **Grades**: Student grades and evaluations |
| 89 | +- **Agenda**: Homework, events, and assignments |
| 90 | +- **Noticeboard**: School announcements and circulars |
| 91 | +- **Absences**: Student absences and late arrivals |
| 92 | +- **Lessons**: Lesson records and topics |
| 93 | +- **Calendar**: School calendar |
| 94 | +- **Student Profile**: Personal information |
| 95 | +- **Subjects**: Course subjects and teachers |
| 96 | +- **Academic Periods**: Trimesters, semesters |
| 97 | +- **Notes**: Teacher notes and warnings |
| 98 | +- **Didactics**: Teaching materials |
| 99 | +- **Schoolbooks**: Required textbooks |
| 100 | + |
| 101 | +## Authentication |
| 102 | + |
| 103 | +All API requests require these headers: |
| 104 | + |
| 105 | +``` |
| 106 | +Z-Dev-Apikey: Tg1NWEwNGIgIC0K |
| 107 | +User-Agent: CVVS/std/4.2.3 Android/12 |
| 108 | +Content-Type: application/json |
| 109 | +``` |
| 110 | + |
| 111 | +For authenticated endpoints, you also need: |
| 112 | + |
| 113 | +``` |
| 114 | +Z-Auth-Token: <token from login response> |
| 115 | +``` |
| 116 | + |
| 117 | +### Login Flow |
| 118 | + |
| 119 | +1. Call `POST /auth/login` with credentials: |
| 120 | + ```json |
| 121 | + { |
| 122 | + "uid": "username", |
| 123 | + "pass": "password", |
| 124 | + "ident": null |
| 125 | + } |
| 126 | + ``` |
| 127 | + |
| 128 | +2. Extract the `token` and student `ident` from the response |
| 129 | + |
| 130 | +3. Extract the numeric student ID from `ident` (e.g., "G9123456R" → "9123456") |
| 131 | + |
| 132 | +4. Use the token in subsequent requests with the `Z-Auth-Token` header |
| 133 | + |
| 134 | +5. Use the student ID in endpoint paths (e.g., `/students/{studentId}/grades`) |
| 135 | + |
| 136 | +## Contributing |
| 137 | + |
| 138 | +If you find any issues or want to add missing endpoints, please: |
| 139 | + |
| 140 | +1. Check the unofficial documentation at [Classeviva-Official-Endpoints](https://github.com/Lioydiano/Classeviva-Official-Endpoints) |
| 141 | +2. Open an issue or pull request |
| 142 | + |
| 143 | +## Resources |
| 144 | + |
| 145 | +- [OpenAPI Specification](https://spec.openapis.org/oas/v3.0.3) |
| 146 | +- [OpenAPI Generator](https://openapi-generator.tech/) |
| 147 | +- [Swagger Editor](https://editor.swagger.io/) |
| 148 | +- [Redocly CLI](https://redocly.com/docs/cli/) |
| 149 | +- [Unofficial API Documentation](https://github.com/Lioydiano/Classeviva-Official-Endpoints) |
0 commit comments