Your IP : 216.73.217.79


Current Path : /var/www/v3.cesa.co.za/documentation/
Upload File :
Current File : /var/www/v3.cesa.co.za/documentation/SCHOOL_ATTENDEES_API.md

# School Attendees API Documentation

## Overview

This API provides access to SchoolAttendee data in CSV-style JSON format. The endpoint allows you to retrieve school attendees for a specific event with filtering by attendee ID.

## Endpoint

- **URL**: `/api/school-attendees`
- **Method**: `GET`
- **Authentication**: OAuth2 Bearer Token required (currently disabled for testing)

## Query Parameters

### Required Parameters

- **eventId** (integer): The ID of the school event to filter attendees by

### Optional Parameters

- **lastAttendeeId** (integer, default: 0): Only return attendees with ID greater than this value

## Example Usage

### Get all attendees for event ID 123

```bash
curl -X GET "http://your-domain.com/api/school-attendees?eventId=123" \
  -H "Authorization: Bearer YOUR_OAUTH_TOKEN"
```

### Get attendees for event ID 123 with attendee ID greater than 1000

```bash
curl -X GET "http://your-domain.com/api/school-attendees?eventId=123&lastAttendeeId=1000" \
  -H "Authorization: Bearer YOUR_OAUTH_TOKEN"
```

## Response Format

The API returns data in CSV-style JSON format with headers and data rows:

```json
{
  "headers": [
    "id",
    "contact_title",
    "contact_first_name",
    "contact_last_name",
    "company_name",
    "address_line_1",
    "address_line_2",
    "address_line_3",
    "city",
    "postal_code",
    "phone_number",
    "mobile_number",
    "fax_number",
    "email_address",
    "dietary_req",
    "attended",
    "order_num",
    "org_vat_num",
    "id_number",
    "saace_mem_number",
    "ecsa_number",
    "designation",
    "cancelled",
    "date_cancelled",
    "booking_name",
    "booking_tel",
    "booking_email",
    "booking_fax",
    "date_booked",
    "known_as",
    "comments",
    "certificate_sent",
    "company_type",
    "saice_member",
    "saice_mem_number",
    "cesa_staff",
    "booking_form",
    "responsible_payment",
    "marketing_source",
    "package_chosen",
    "event_id"
  ],
  "data": [
    [
      "1",
      "Mr",
      "John",
      "Doe",
      "Test Company",
      "123 Test Street",
      "",
      "",
      "Test City",
      "1234",
      "0123456789",
      "0821234567",
      "",
      "john.doe@example.com",
      "",
      "y",
      "ORD001",
      "VAT123",
      "8001015009087",
      "",
      "",
      "Engineer",
      "0",
      "",
      "John Doe",
      "0123456789",
      "john.doe@example.com",
      "",
      "2024-01-01 00:00:00",
      "John",
      "",
      "",
      "Consulting",
      "0",
      "",
      "0",
      "",
      "John Doe",
      "Website",
      "Standard",
      "1"
    ]
  ]
}
```

## Field Descriptions

- **id**: Attendee ID (primary key)
- **contact_title**: Contact title (Mr, Mrs, Dr, etc.)
- **contact_first_name**: Contact's first name
- **contact_last_name**: Contact's last name
- **company_name**: Company name
- **address_line_1**: Address line 1
- **address_line_2**: Address line 2
- **address_line_3**: Address line 3
- **city**: City
- **postal_code**: Postal code
- **phone_number**: Phone number
- **mobile_number**: Mobile number
- **fax_number**: Fax number
- **email_address**: Email address
- **dietary_req**: Dietary requirements
- **attended**: Attendance status (y/n/u)
- **order_num**: Order number
- **org_vat_num**: Organization VAT number
- **id_number**: ID number
- **saace_mem_number**: SAACE membership number
- **ecsa_number**: ECSA number
- **designation**: Professional designation
- **cancelled**: Cancellation status (0/1)
- **date_cancelled**: Date cancelled (YYYY-MM-DD HH:MM:SS)
- **booking_name**: Booking contact name
- **booking_tel**: Booking contact telephone
- **booking_email**: Booking contact email
- **booking_fax**: Booking contact fax
- **date_booked**: Date booked (YYYY-MM-DD HH:MM:SS)
- **known_as**: Known as name
- **comments**: Comments
- **certificate_sent**: Certificate sent date (YYYY-MM-DD HH:MM:SS)
- **company_type**: Company type
- **saice_member**: SAICE member status (0/1)
- **saice_mem_number**: SAICE membership number
- **cesa_staff**: CESA staff status (0/1)
- **booking_form**: Booking form data
- **responsible_payment**: Person responsible for payment
- **marketing_source**: Marketing source
- **package_chosen**: Package chosen
- **event_id**: Associated event ID

## Error Responses

- **400 Bad Request**: Missing or invalid parameters

  ```json
  {
    "error": "eventId parameter is required"
  }
  ```

  ```json
  {
    "error": "eventId must be a valid number"
  }
  ```

  ```json
  {
    "error": "lastAttendeeId must be a valid number"
  }
  ```

- **401 Unauthorized**: Invalid or missing OAuth2 token (when authentication is enabled)
- **500 Internal Server Error**: Server error

## Database Query

This endpoint implements the equivalent of the following SQL query:

```sql
SELECT *
FROM SchoolAttendees
WHERE EventID = {eventId}
AND AttendeeID > {lastAttendeeId}
ORDER BY AttendeeID
```

## Rate Limiting

Currently, no rate limiting is implemented. Please use the API responsibly.

## Support

For technical support, please contact the development team.