| Current Path : /var/www/v3.cesa.co.za/documentation/ |
| Current File : /var/www/v3.cesa.co.za/documentation/API_DOCUMENTATION.md |
# School Events API Documentation
## Overview
This API provides access to SchoolEvent data in CSV-style JSON format with OAuth2 authentication.
## Endpoint
- **URL**: `/api/school-events`
- **Method**: `GET`
- **Authentication**: OAuth2 Bearer Token required
## Authentication
The API uses OAuth2 authentication. You need to:
1. Create an OAuth2 client using the command:
```bash
php8.4 bin/console league:oauth2-server:create-client "SAICE" --redirect-uri="https://v3.cesa.co.za" --grant-type="client_credentials"
```
2. Get an access token using the client credentials:
```bash
curl -X POST "https://v3.cesa.co.za/token" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=client_credentials&client_id= c277b219863acf24ad19300c88393460&client_secret=2620c0a600e78a4492a46d5d411656fc44eda51ad64a4732b317c0ef6f691e88721dfb8b5bbc46bb4d7326bb54f0bcf642c0cec638cf5fcd10c7bc92dc30a232"
```
3. Use the access token in your API requests:
```bash
curl -X GET "https://v3.cesa.co.za/api/school-courses?training_provider_id=45" \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJjMjc3YjIxOTg2M2FjZjI0YWQxOTMwMGM4ODM5MzQ2MCIsImp0aSI6IjVlN2QxZDM3NDhlZDU2Mjg1NDIzZDE4ZTk1NDBkNjZlYzQ0ZmMzYjA1Y2IxODVjNjkyYWNmYzNiZDlmYjc1M2U1MWNkZDg3ZDUwMTc1ZTk5IiwiaWF0IjoxNzYwNjA4ODY2LjA4MTIyMywibmJmIjoxNzYwNjA4ODY2LjA4MTIyNywiZXhwIjoxNzYwNjEyNDY2LjA3NTAyNSwic3ViIjoiYzI3N2IyMTk4NjNhY2YyNGFkMTkzMDBjODgzOTM0NjAiLCJzY29wZXMiOlsiZW1haWwiXX0.K26tNuOAejzQvPrM2RHlICPm1_DI32Ve3w9EuMlAra3o71DVrqiQp7QcFyprp0ZtfkP1OTd8Xs8rowjeWV8vlX5uZ45T3ibiNwFF5j5tW0OfQKdUVL3uhJc5iLPYbu4DKBWEP9LQrAGeWXi90nUr5F__WI9fK8GJbMCmH-9knIGD6rDh-FXixLGWfLeQh4MSjrKWJvk1aR1TgGKAZ1PB3xlJYs8itPUFyJQTxviujiBf_24uQ6WEcXUM2TJbqqI3ZXZ1W8YW4QefKAhhee0zEjofmACXJvFkRIVmy9cPjFhFxQtmJ75e64S1-RJwd9UEbbyXhb51ypAvk3HF-ExRyQ"
```
## Response Format
The API returns data in CSV-style JSON format with headers and data rows:
```json
{
"headers": [
"id",
"event_name",
"level",
"city",
"venue",
"start_date",
"end_date",
"start_time",
"end_time",
"available_spaces",
"cost_per_person",
"event_description",
"hours",
"cpd",
"code",
"accred_num",
"province",
"reg_deadline",
"member_discount",
"early_bird_discount",
"early_bird_date",
"cancelled",
"bank_acc_name",
"external_link",
"file_attachment",
"candidate_academy",
"booking_confirmed",
"attendance_register",
"sacpcmp_num"
],
"data": [
[
"1",
"Sample Event",
"Beginner",
"Johannesburg",
"Conference Center",
"2024-01-15 00:00:00",
"2024-01-16 00:00:00",
"09:00:00",
"17:00:00",
"50",
"1500.00",
"Sample event description",
"8",
"Yes",
"EVT001",
"ACC123",
"Gauteng",
"2024-01-10 00:00:00",
"100.00",
"200.00",
"2024-01-05 00:00:00",
"0",
"Sample Bank Account",
"https://example.com",
"attachment.pdf",
"Y",
"Y",
"register.pdf",
"SAC123"
]
]
}
```
## Data Fields
- **id**: Event ID
- **event_name**: Name of the event
- **level**: Event level (Beginner, Intermediate, Advanced, etc.)
- **city**: City where the event takes place
- **venue**: Venue name
- **start_date**: Event start date (YYYY-MM-DD HH:MM:SS)
- **end_date**: Event end date (YYYY-MM-DD HH:MM:SS)
- **start_time**: Event start time (HH:MM:SS)
- **end_time**: Event end time (HH:MM:SS)
- **available_spaces**: Number of available spaces
- **cost_per_person**: Cost per person
- **event_description**: Event description
- **hours**: Duration in hours
- **cpd**: CPD (Continuing Professional Development) status
- **code**: Event code
- **accred_num**: Accreditation number
- **province**: Province
- **reg_deadline**: Registration deadline (YYYY-MM-DD HH:MM:SS)
- **member_discount**: Member discount amount
- **early_bird_discount**: Early bird discount amount
- **early_bird_date**: Early bird deadline (YYYY-MM-DD HH:MM:SS)
- **cancelled**: Cancellation status (0 = No, 1 = Yes)
- **bank_acc_name**: Bank account name
- **external_link**: External link
- **file_attachment**: File attachment name
- **candidate_academy**: Candidate academy status (Y/N)
- **booking_confirmed**: Booking confirmation status (Y/N)
- **attendance_register**: Attendance register file name
- **sacpcmp_num**: SACPCMP number
## Error Responses
- **401 Unauthorized**: Invalid or missing OAuth2 token
- **403 Forbidden**: Insufficient permissions
- **500 Internal Server Error**: Server error
## Rate Limiting
Currently, no rate limiting is implemented. Please use the API responsibly.
## Support
For technical support, please contact the development team.