hosted on : https://osaagos-api-alumni-website.onrender.com/
/api/users/register
{
"name": "John Doe",
"email": "john@example.com",
"password": "password123",
"role": "alumni"
}
{
"_id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"role": "alumni",
"token": "jwt_token"
}
/api/users/login
{
"email": "john@example.com",
"password": "password123"
}
{
"_id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"role": "alumni",
"token": "jwt_token"
}
/api/users/profile
Authorization: Bearer <jwt_token>
{
"_id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"role": "alumni"
}
/api/users/allUsers
Authorization: Bearer <jwt_token>
Response:
{
"All users"
}
/api/users/profile
Authorization: Bearer <jwt_token>
{
"name": "John Doe",
"email": "john@example.com",
"password": "newpassword123"
}
{
"_id": "66c039670212e06657714945",
"name": "John Doe",
"email": "johndoe@example.com",
"role": "Admin",
"address": "123 Main St",
"company": "ABC Corp",
"education": "XYZ University",
"fieldOfStudy": "Physics",
"graduationYear": "2022",
"profilePicture": "uploads/profilePicture-1723883773055.png",
"id": "66c039670212e06657714945"
}
/api/alumni/profile
Authorization: Bearer <jwt_token>
multipart/form-data
profilePicture
: Filedata
: JSON
{
"personalDetails": {
"address": "123 Main St",
"phone": "555-555-5555"
},
"educationalDetails": {
"degree": "B.Sc. in Computer Science",
"graduationYear": "2020"
},
"professionalDetails": {
"jobTitle": "Software Engineer",
"company": "Tech Corp"
}
}
{
"_id": "user_id",
"personalDetails": {
"address": "123 Main St",
"phone": "555-555-5555"
},
"educationalDetails": {
"degree": "B.Sc. in Computer Science",
"graduationYear": "2020"
},
"professionalDetails": {
"jobTitle": "Software Engineer",
"company": "Tech Corp"
},
"profilePicture": "path_to_uploaded_file"
}
/api/alumni/search
name
: String (optional)graduationYear
: String (optional)fieldOfStudy
: String (optional)Response:
[
{
"_id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"role": "alumni",
"graduationYear": "2020",
"fieldOfStudy": "Computer Science"
},
]
/api/messages/send
Authorization: Bearer <jwt_token>
{
"to": "recipient_user_id",
"content": "Hello, how are you?"
}
{
"_id": "message_id",
"from": "user_id",
"to": "recipient_user_id",
"content": "Hello, how are you?",
"timestamp": "2024-07-27T12:34:56Z"
}
/api/messages
Authorization: Bearer <jwt_token>
contactId
: String (required)[
{
"_id": "message_id",
"from": "user_id",
"to": "contact_user_id",
"content": "Hello, how are you?",
"timestamp": "2024-07-27T12:34:56Z"
},
]
/api/groups
Authorization: Bearer <jwt_token>
{
"name": "Tech Enthusiasts",
"description": "A group for tech lovers"
}
{
"_id": "group_id",
"name": "Tech Enthusiasts",
"description": "A group for tech lovers",
"createdBy": "user_id"
}
/api/groups
Response:
[
{
"_id": "group_id",
"name": "Tech Enthusiasts",
"description": "A group for tech lovers",
"createdBy": "user_id"
},
]
/api/groups/join/groupId
Authorization: Bearer <jwt_token>
{
"groupId": "group_id"
}
{
"message": "Joined group successfully"
}
/api/groups/leave/:groupId
Authorization: Bearer <jwt_token>
{
"groupId": "group_id"
}
{
"message": "left group successfully"
}
/api/groups/:groupId/posts
{
"_id": "forum_post_id",
"title": "How to improve coding skills?",
"content": "Can someone share tips on improving coding skills?",
"createdBy": "user_id",
"createdAt": "2024-07-27T12:34:56Z"
}
/api/groups/:groupId/posts
Response:
[
{
"_id": "forum_post_id",
"title": "How to improve coding skills?",
"content": "Can someone share tips on improving coding skills?",
"createdBy": "user_id",
"createdAt": "2024-07-27T12:34:56Z"
},
]
/api/groups/posts/:postId
Authorization: Bearer <jwt_token>
{
"title": "Updated title",
"content": "Updated content"
}
Response:
{
"_id": "forum_post_id",
"title": "Updated title",
"content": "Updated content",
"createdBy": "user_id",
"updatedAt": "2024-07-27T12:34:56Z"
}
/api/groups/posts/:postId
Authorization: Bearer <jwt_token>
{
"message": " post deleted successfully"
}
/api/groups/posts/:postId/replies
Authorization: Bearer <jwt_token>
/api/groups//posts/:postId/replies
Authorization: Bearer <jwt_token>
/api/groups/replies/:replyId
Authorization: Bearer <jwt_token>
/api/groups/replies/:replyId
Authorization: Bearer <jwt_token>
/api/forums/create
Authorization: Bearer <jwt_token>
{
"title": "How to improve coding skills?",
"content": "Can someone share tips on improving coding skills?"
}
{
"_id": "forum_post_id",
"title": "How to improve coding skills?",
"content": "Can someone share tips on improving coding skills?",
"createdBy": "user_id",
"createdAt": "2024-07-27T12:34:56Z"
}
/api/forums
Response:
[
{
"_id": "forum_post_id",
"title": "How to improve coding skills?",
"content": "Can someone share tips on improving coding skills?",
"createdBy": "user_id",
"createdAt": "2024-07-27T12:34:56Z"
},
]
/api/forums/:forumId/post
{
"_id": "forum_post_id",
"title": "How to improve coding skills?",
"content": "Can someone share tips on improving coding skills?",
"createdBy": "user_id",
"createdAt": "2024-07-27T12:34:56Z"
}
/api/forums/:forumId/posts
Response:
[
{
"_id": "forum_post_id",
"title": "How to improve coding skills?",
"content": "Can someone share tips on improving coding skills?",
"createdBy": "user_id",
"createdAt": "2024-07-27T12:34:56Z"
},
]
api/forums/posts/:postId
Authorization: Bearer <jwt_token>
{
"title": "Updated title",
"content": "Updated content"
}
Response:
{
"_id": "forum_post_id",
"title": "Updated title",
"content": "Updated content",
"createdBy": "user_id",
"updatedAt": "2024-07-27T12:34:56Z"
}
api/forums/posts/:postId
Authorization: Bearer <jwt_token>
{
"message": "Forum post deleted successfully"
}
/api/forums/posts/:postId/replies
Authorization: Bearer <jwt_token>
/api/forums/posts/:postId/replies
Authorization: Bearer <jwt_token>
/api/forums/posts/replies/:replyId
Authorization: Bearer <jwt_token>
/api/forums/posts/replies/:replyId
Authorization: Bearer <jwt_token>
/api/events
Authorization: Bearer <jwt_token>
{
"title": "Alumni Meetup",
"description": "A meetup for all alumni members.",
"date": "2024-09-01T18:00:00Z",
"location": "123 Main St, City"
}
{
"_id": "event_id",
"title": "Alumni Meetup",
"description": "A meetup for all alumni members.",
"date": "2024-09-01T18:00:00Z",
"location": "123 Main St, City",
"createdBy": "user_id"
}
/api/events
Response:
[
{
"_id": "event_id",
"title": "Alumni Meetup",
"description": "A meetup for all alumni members.",
"date": "2024-09-01T18:00:00Z",
"location": "123 Main St, City",
"createdBy": "user_id"
},
]
/api/events/:id
{
"_id": "event_id",
"title": "Alumni Meetup",
"description": "A meetup for all alumni members.",
"date": "2024-09-01T18:00:00Z",
"location": "123 Main St, City",
"createdBy": "user_id"
}
/api/events/:id
Authorization: Bearer <jwt_token>
{
"title": "Updated Event Title",
"description": "Updated description",
"date": "2024-09-02T18:00:00Z",
"location": "456 Main St, City"
}
{
"_id": "event_id",
"title": "Updated Event Title",
"description": "Updated description",
"date": "2024-09-02T18:00:00Z",
"location": "456 Main St, City",
"createdBy": "user_id",
"updatedAt": "2024-07-27T12:34:56Z"
}
/api/events/:id
Authorization: Bearer <jwt_token>
{
"message": "Event deleted successfully"
}
/api/news
Authorization: Bearer <jwt_token>
{
"title": "New Alumni Event",
"content": "We are excited to announce a new event for our alumni."
}
{
"_id": "news_id",
"title": "New Alumni Event",
"content": "We are excited to announce a new event for our alumni.",
"createdBy": "user_id",
"createdAt": "2024-07-27T12:34:56Z"
}
/api/news
Response:
[
{
"_id": "news_id",
"title": "New Alumni Event",
"content": "We are excited to announce a new event for our alumni.",
"createdBy": "user_id",
"createdAt": "2024-07-27T12:34:56Z"
},
]
/api/news/:id
{
"_id": "news_id",
"title": "New Alumni Event",
"content": "We are excited to announce a new event for our alumni.",
"createdBy": "user_id",
"createdAt": "2024-07-27T12:34:56Z"
}
/api/news/subscribe
{
"email": "john@example.com"
}
{
"message": "Subscribed to newsletter successfully"
}
/api/campaigns
Authorization: Bearer <jwt_token>
{
"title": "Scholarship Fund",
"description": "Raising funds for student scholarships.",
"targetAmount": 10000,
"startDate": "2024-08-01",
"endDate": "2024-12-31"
}
{
"_id": "campaign_id",
"title": "Scholarship Fund",
"description": "Raising funds for student scholarships.",
"targetAmount": 10000,
"startDate": "2024-08-01",
"endDate": "2024-12-31",
"createdBy": "user_id"
}
/api/campaigns
Response:
[
{
"_id": "campaign_id",
"title": "Scholarship Fund",
"description": "Raising funds for student scholarships.",
"targetAmount": 10000,
"startDate": "2024-08-01",
"endDate": "2024-12-31",
"createdBy": "user_id"
},
]
/api/campaigns/donate
Authorization: Bearer <jwt_token>
{
"campaignId": "campaign_id",
"amount": 100,
"message": "Keep up the good work!"
}
{
"_id": "donation_id",
"campaignId": "campaign_id",
"userId": "user_id",
"amount": 100,
"message": "Keep up the good work!",
"timestamp": "2024-07-27T12:34:56Z"
}
/api/media/upload
Authorization: Bearer <jwt_token>
multipart/form-data
media
: Filedata
: JSON
{
"title": "Event Photo",
"description": "Photo from the alumni event",
"fileType": "image"
}
{
"_id": "media_id",
"title": "Event Photo",
"description": "Photo from the alumni event",
"fileType": "image",
"path": "path_to_uploaded_file",
"uploadedBy": "user_id",
"uploadedAt": "2024-07-27T12:34:56Z"
}
/api/media
Response:
[
{
"_id": "media_id",
"title": "Event Photo",
"description": "Photo from the alumni event",
"fileType": "image",
"path": "path_to_uploaded_file",
"uploadedBy": "user_id",
"uploadedAt": "2024-07-27T12:34:56Z"
},
]
/api/media/:id
Authorization: Bearer <jwt_token>
{
"message": "Media deleted successfully"
}
Sure! Here is a revised version of the CRUD operations for the API endpoints:
/api/admin/login
{
"email": "admin@example.com",
"password": "adminpassword"
}
{
"token": "jwt_token"
}
/api/admin/alumni
Authorization: Bearer <jwt_token>
{
"name": "Jane Doe",
"email": "jane@example.com",
"graduationYear": "2021",
"fieldOfStudy": "Business Administration"
}
{
"_id": "user_id",
"name": "Jane Doe",
"email": "jane@example.com",
"role": "alumni",
"graduationYear": "2021",
"fieldOfStudy": "Business Administration"
}
/api/alumni
{
"success": true,
"data": [
{
"id": "1",
"name": "John Doe",
"graduationYear": "2020",
"degree": "BSc Computer Science",
"email": "john.doe@example.com",
"phone": "123-456-7890"
}
]
}
/api/alumni/:id
:id
- The ID of the alumni profile to update.{
"name": "Johnathan Doe",
"graduationYear": "2021",
"degree": "MSc Computer Science",
"email": "johnathan.doe@example.com",
"phone": "098-765-4321"
}
{
"success": true,
"data": {
"id": "1",
"name": "Johnathan Doe",
"graduationYear": "2021",
"degree": "MSc Computer Science",
"email": "johnathan.doe@example.com",
"phone": "098-765-4321"
}
}
/api/alumni/:id
:id
- The ID of the alumni profile to delete.{
"success": true,
"message": "Profile deleted successfully"
}
/api/admin/analytics
Authorization: Bearer <jwt_token>
{
"totalAlumni": 100,
"totalEvents": 10,
"totalDonations": 5000,
"totalMediaUploads": 50
}
/api/events/create
Authorization: Bearer <jwt_token>
{
"title": "Alumni Meetup",
"description": "A meetup for all alumni members.",
"date": "2024-09-01T18:00:00Z",
"location": "123 Main St, City"
}
{
"_id": "event_id",
"title": "Alumni Meetup",
"description": "A meetup for all alumni members.",
"date": "2024-09-01T18:00:00Z",
"location": "123 Main St, City",
"createdBy": "admin_id"
}
/api/events
Authorization: Bearer <jwt_token>
[
{
"_id": "event_id",
"title": "Alumni Meetup",
"description": "A meetup for all alumni members.",
"date": "2024-09-01T18:00:00Z",
"location": "123 Main St, City",
"createdBy": "admin_id"
}
]
/api/events/:id
Authorization: Bearer <jwt_token>
{
"_id": "event_id",
"title": "Alumni Meetup",
"description": "A meetup for all alumni members.",
"date": "2024-09-01T18:00:00Z",
"location": "123 Main St, City",
"createdBy": "admin_id"
}
/api/events/:id
Authorization: Bearer <jwt_token>
{
"title": "Updated Event Title",
"description": "Updated description",
"date": "2024-09-02T18:00:00Z",
"location": "456 Main St, City"
}
{
"_id": "event_id",
"title": "Updated Event Title",
"description": "Updated description",
"date": "2024-09-02T18:00:00Z",
"location": "456 Main St, City",
"createdBy": "admin_id",
"updatedAt": "2024-07-27T12:34:56Z"
}
/api/events/:id
Authorization: Bearer <jwt_token>
{
"title": "Updated Event Title",
"description": "Updated description",
"date": "2024-09-02T18:00:00Z",
"location": "456 Main St, City"
}
{
"_id": "event_id",
"title": "Updated Event Title",
"description": "Updated description",
"date": "2024-09-02T18:00:00Z",
"location": "456 Main St, City",
"createdBy": "admin_id",
"updatedAt": "2024-07-27T12:34:56Z"
}
/api/admin/events/:id
Authorization: Bearer <jwt_token>
{
"message": "Event deleted successfully"
}
/api/admin/news
Authorization: Bearer <jwt_token>
{
"title": "New Alumni Event",
"content": "We are excited to announce a new event for our alumni."
}
{
"_id": "news_id",
"title": "New Alumni Event",
"content": "We are excited to announce a new event for our alumni.",
"createdBy": "admin_id",
"createdAt": "2024-07-27T12:34:56Z"
}
/api/admin/news
Authorization: Bearer <jwt_token>
[
{
"_id": "news_id",
"title": "New Alumni Event",
"content": "We are excited to announce a new event for our alumni.",
"createdBy": "admin_id",
"createdAt": "2024-07-27T12:34:56Z"
}
]
/api/admin/news/:id
Authorization: Bearer <jwt_token>
{
"_id": "news_id",
"title": "New Alumni Event",
"content": "We are excited to announce a new event for our alumni.",
"createdBy": "admin_id",
"createdAt": "2024-07-27T12:34:56Z"
}
/api/admin/news/:id
Authorization: Bearer <jwt_token>
{
"title": "Updated News Title",
"content": "Updated content"
}
{
"_id": "news_id",
"title": "Updated News Title",
"content": "Updated content",
"createdBy": "admin_id",
"updatedAt": "2024-07-27T12:34:56Z"
}
/api/admin/news/:id
Authorization: Bearer <jwt_token>
{
"message": "News article deleted successfully"
}
/api/admin/media
Authorization: Bearer <jwt_token>
multipart/form-data
media
: Filedata
: JSON
{
"title": "Event Photo",
"description": "Photo from the alumni event",
"fileType": "image"
}
{
"_id": "media_id",
"title": "Event Photo",
"description": "Photo from the alumni event",
"fileType": "image",
"path": "path_to_uploaded_file",
"uploadedBy": "admin_id",
"uploadedAt": "2024-07-27T12:34:56Z"
}
/api/admin/media
Authorization: Bearer <jwt_token>
[
{
"_id": "media_id",
"title": "Event Photo",
"description": "Photo from the alumni event",
"fileType": "image",
"path": "path_to_uploaded_file",
"uploadedBy": "admin_id",
"uploadedAt": "2024-07-27T12:34:56Z"
}
]
/api/admin/media/:id
Authorization: Bearer <jwt_token>
{
"message": "Media deleted successfully"
}
JOB CRUD OPERATION
/api/jobs/
GET
Response:
[
{
"title": "Software Engineer",
"description": "Develop and maintain software applications.",
"companyName": "Tech Corp",
"location": "San Francisco, CA",
"salaryRange": "$100,000 - $120,000",
"employmentType": "full-time",
"postedBy": "60d5f8b2c5f8b3d1a5f6e3a4",
"postedDate": "2024-08-15T00:00:00.000Z",
"applicationDeadline": "2024-09-15T00:00:00.000Z",
"createdAt": "2024-08-15T00:00:00.000Z",
"updatedAt": "2024-08-15T00:00:00.000Z",
"_id": "60d5f8b2c5f8b3d1a5f6e3a4"
},
]
- **Error (500 Internal Server Error):**
```json
{
"error": "Unable to fetch jobs."
}
/api/jobs/create
POST
{
"title": "Software Engineer",
"description": "Develop and maintain software applications.",
"companyName": "Tech Corp",
"location": "San Francisco, CA",
"salaryRange": "$100,000 - $120,000",
"employmentType": "full-time",
"applicationDeadline": "2024-09-15T00:00:00.000Z"
}
{
"message": "Job created successfully.",
"job": {
"title": "Junior Web Developer",
"description": "Assist in the development of web applications.",
"companyName": "Tech Innovators",
"location": "Remote",
"salaryRange": "$50,000 - $60,000",
"employmentType": "full-time",
"postedBy": "66bd559973a57ef3549a2412",
"applicationDeadline": "2024-09-30T00:00:00.000Z",
"_id": "66bf4376613bf2b766050187",
"postedDate": "2024-08-16T12:17:58.930Z",
"createdAt": "2024-08-16T12:17:58.931Z",
"updatedAt": "2024-08-16T12:17:58.931Z",
"_id": "60d5f8b2c5f8b3d1a5f6e3a4"
}
}
{
"error": "Validation error. Please check your input."
}
/api/jobs/:id
PUT
{
"title": "Senior Software Engineer",
"description": "Lead software development projects.",
"salaryRange": "$120,000 - $140,000",
"applicationDeadline": "2024-09-30T00:00:00.000Z"
}
{
"message": "Job updated successfully.",
"job": {
"title": "Senior Software Engineer",
"description": "Lead software development projects.",
"companyName": "Tech Corp",
"location": "San Francisco, CA",
"salaryRange": "$120,000 - $140,000",
"employmentType": "full-time",
"postedBy": "60d5f8b2c5f8b3d1a5f6e3a4",
"postedDate": "2024-08-15T00:00:00.000Z",
"applicationDeadline": "2024-09-30T00:00:00.000Z",
"createdAt": "2024-08-15T00:00:00.000Z",
"updatedAt": "2024-08-16T00:00:00.000Z",
"_id": "60d5f8b2c5f8b3d1a5f6e3a4"
}
}
{
"error": "Validation error. Please check your input."
}
/api/jobs/:id
DELETE
{
"message": "Job deleted successfully."
}
{
"error": "Job not found."
}
POST /api/donations
campaignId
(String, required)amount
(Number, required)Response:
201 Created
: Returns the created donation.404 Not Found
: Campaign not found.500 Internal Server Error
: Server error.GET /api/campaigns/:campaignId/donations
Response:
200 OK
: Returns totalAmountRaised
and donation list.500 Internal Server Error
: Server error.GET /api/users/donations
Response:
200 OK
: Returns totalAmountDonated
and donation list.500 Internal Server Error
: Server error.GET /api/donations/paystack/initialize
Response:
authorization url will be returned
.GET /api/donations/verify-payment/:campaignId
verification response will be reeturened
.