Skip to main content

Overview

The Registrations API allows students to register for events, view their registrations, cancel registrations, and allows organizers/admins to view participant lists.

Register for Event

curl -X POST https://api.example.com/api/registrations/event/1 \
  -H "Authorization: Bearer YOUR_TOKEN"
POST /api/registrations/event/{eventID}
Authorization: Bearer YOUR_TOKEN
Register the authenticated student for an event.

Authentication

Required Role: STUDENT (enforced by @PreAuthorize("hasRole('STUDENT')"))

Path Parameters

eventID
integer
required
ID of the event to register for

Response

statusCode
integer
HTTP status code (201 for successful registration)
message
string
Success message: “Registration successful”
data
null
No data returned for this endpoint
{
  "statusCode": 201,
  "message": "Registration successful",
  "data": null,
  "timestamp": "2024-03-07T10:30:00"
}

Error Responses

{
  "statusCode": 400,
  "message": "Event is at full capacity",
  "timestamp": "2024-03-07T10:30:00"
}

Get My Registrations

curl -X GET https://api.example.com/api/registrations/me \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/registrations/me
Authorization: Bearer YOUR_TOKEN
Retrieve all registrations for the authenticated student.

Authentication

Required Role: STUDENT (enforced by @PreAuthorize("hasRole('STUDENT')"))

Response

statusCode
integer
HTTP status code (200)
message
string
Success message: “Registrations retrieved successfully”
data
array
Array of registration objects
data[].registrationID
integer
Unique registration identifier
data[].eventID
integer
ID of the event
data[].eventTitle
string
Title of the event
data[].eventDate
string
Date of the event (formatted string)
data[].venue
string
Event venue/location
data[].status
string
Registration status: REGISTERED, ATTENDED, CANCELLED
data[].registeredAt
string
ISO 8601 timestamp when registration was created
{
  "statusCode": 200,
  "message": "Registrations retrieved successfully",
  "data": [
    {
      "registrationID": 1,
      "eventID": 5,
      "eventTitle": "Spring Career Fair 2024",
      "eventDate": "2024-04-15",
      "venue": "University Hall A",
      "status": "REGISTERED",
      "registeredAt": "2024-03-01T14:30:00"
    },
    {
      "registrationID": 2,
      "eventID": 7,
      "eventTitle": "Tech Workshop Series",
      "eventDate": "2024-04-20",
      "venue": "Lab Building 201",
      "status": "REGISTERED",
      "registeredAt": "2024-03-05T09:15:00"
    },
    {
      "registrationID": 3,
      "eventID": 3,
      "eventTitle": "Alumni Networking Night",
      "eventDate": "2024-02-15",
      "venue": "Student Center",
      "status": "ATTENDED",
      "registeredAt": "2024-02-01T10:00:00"
    }
  ],
  "timestamp": "2024-03-07T10:30:00"
}

Cancel Registration

curl -X DELETE https://api.example.com/api/registrations/1 \
  -H "Authorization: Bearer YOUR_TOKEN"
DELETE /api/registrations/{registrationID}
Authorization: Bearer YOUR_TOKEN
Cancel an existing registration. Students can only cancel their own registrations.

Authentication

Required Role: STUDENT (enforced by @PreAuthorize("hasRole('STUDENT')"))

Path Parameters

registrationID
integer
required
ID of the registration to cancel

Response

statusCode
integer
HTTP status code (200)
message
string
Success message: “Registration cancelled”
data
null
No data returned for this endpoint
{
  "statusCode": 200,
  "message": "Registration cancelled",
  "data": null,
  "timestamp": "2024-03-07T10:30:00"
}

Error Responses

{
  "statusCode": 404,
  "message": "Registration not found",
  "timestamp": "2024-03-07T10:30:00"
}

Get Event Participants

curl -X GET https://api.example.com/api/registrations/event/1/participants \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/registrations/event/{eventID}/participants
Authorization: Bearer YOUR_TOKEN
Retrieve the list of participants for a specific event. Only accessible to admins and the event organizer.

Authentication

Required Roles: ADMIN or ORGANIZER (enforced by @PreAuthorize("hasAnyRole('ADMIN','ORGANIZER')"))

Path Parameters

eventID
integer
required
ID of the event

Response

statusCode
integer
HTTP status code (200)
message
string
Success message: “Participants fetched”
data
array
Array of participant objects (Map of String to String)
{
  "statusCode": 200,
  "message": "Participants fetched",
  "data": [
    {
      "studentID": "S123456",
      "firstName": "John",
      "lastName": "Doe",
      "email": "[email protected]",
      "major": "Computer Science",
      "yearOfStudy": "3",
      "registeredAt": "2024-03-01T14:30:00",
      "status": "REGISTERED"
    },
    {
      "studentID": "S789012",
      "firstName": "Jane",
      "lastName": "Smith",
      "email": "[email protected]",
      "major": "Business Administration",
      "yearOfStudy": "2",
      "registeredAt": "2024-03-02T10:15:00",
      "status": "REGISTERED"
    }
  ],
  "timestamp": "2024-03-07T10:30:00"
}

Error Responses

{
  "statusCode": 403,
  "message": "You can only view participants for your own events",
  "timestamp": "2024-03-07T10:30:00"
}

Registration Status Enum

Registrations can have the following statuses:
  • REGISTERED - Student is registered and confirmed
  • ATTENDED - Student attended the event
  • CANCELLED - Registration was cancelled

Implementation Note

From RegistrationController.java:69-72:
List<Map<String, String>> participants =
    registrationService.getParticipantDetails(eventID, userDetails.getUser());
The service layer handles authorization checks to ensure organizers can only view participants for their own events.

Build docs developers (and LLMs) love