Complete REST API reference for scholarnest Student Platform
https://scholarnest.codessol.com/api
application/json
{
"message": "scholarnest API",
"version": "1.0",
"features": [
"email_registration",
"social_login",
"otp_verification",
"password_reset"
],
"social_providers": ["google", "facebook"],
"docs": "http://scholarnest.codessol.com/docs"
}
Authorization: Bearer {access_token}
{
"id": 1,
"name": "Atta Ullah",
"email": "attaullahmk099@gmail.com",
"email_verified_at": "2024-01-15T10:30:00.000000Z",
"created_at": "2024-01-15T10:25:00.000000Z",
"updated_at": "2024-01-15T10:25:00.000000Z"
}
Endpoints for user registration, login, OTP verification, and password management.
{
"f_name": "Atta",
"l_name": "ullah",
"email": "attaullahmk099@gmail.com",
"password": "password123",
"password_confirmation": "password123"
}
{
"status": "success",
"message": "User registered successfully. Please verify your email.",
"user": {
"id": 1,
"f_name": "Atta",
"l_name": "ullah",
"email": "attaullahmk099@gmail.com",
"role": "student",
"has_password": true,
"provider": null
},
"access_token": "1|abc123def456...",
"token_type": "Bearer"
}
After registration, an OTP will be sent to the user's email for verification.
{
"email": "attaullahmk099@gmail.com",
"otp_code": "123456"
}
{
"status": "success",
"message": "Email verified successfully"
}
{
"email": "attaullahmk099@gmail.com"
}
{
"status": "success",
"message": "OTP resent successfully"
}
{
"email": "attaullahmk099@gmail.com",
"password": "password123"
}
{
"status": "success",
"message": "Login successful",
"user": {
"id": 1,
"name": "Atta Ullah",
"email": "attaullahmk099@gmail.com",
"avatar": null,
"role": "student",
"has_password": true,
"provider": null
},
"access_token": "2|def456ghi789...",
"token_type": "Bearer"
}
{
"email": "attaullahmk099@gmail.com"
}
{
"status": "success",
"message": "Password reset OTP sent to your email"
}
{
"email": "attaullahmk099@gmail.com",
"otp_code": "123456",
"password": "newpassword123",
"password_confirmation": "newpassword123"
}
{
"status": "success",
"message": "Password reset successfully"
}
Authorization: Bearer {refresh_token}
{
"status": "success",
"access_token": "3|hij789klm012...",
"token_type": "Bearer",
"expires_in": 3600
}
Authorization: Bearer {access_token}
{
"status": "success",
"message": "Logged out successfully"
}
Authorization: Bearer {access_token}
{
"status": "success",
"message": "Logged out from all devices successfully"
}
Endpoints for managing user profile information. All endpoints require authentication.
Authorization: Bearer {access_token}
{
"status": "success",
"user": {
"id": 1,
"name": "Atta Ullah",
"email": "attaullahmk099@gmail.com",
"avatar": null,
"role": "student",
"provider": null,
"has_password": true,
"email_verified_at": "2024-01-15T10:30:00.000000Z",
"created_at": "2024-01-15T10:25:00.000000Z"
}
}
Authorization: Bearer {access_token}Content-Type: application/json
{
"name": "Atta Ullah Updated",
"avatar": "https://example.com/avatar.jpg"
}
{
"status": "success",
"message": "Profile updated successfully",
"user": {
"id": 1,
"name": "Atta Ullah Updated",
"email": "attaullahmk099@gmail.com",
"avatar": "https://example.com/avatar.jpg",
"role": "student",
"provider": null
}
}
Authorization: Bearer {access_token}Content-Type: application/json
{
"current_password": "oldpassword123",
"password": "newpassword123",
"password_confirmation": "newpassword123"
}
{
"status": "success",
"message": "Password changed successfully"
}
Authorization: Bearer {access_token}Content-Type: application/json
{
"password": "newpassword123",
"password_confirmation": "newpassword123"
}
{
"status": "success",
"message": "Password set successfully"
}
This endpoint is primarily for users who registered via social login and want to set a password for email/password login.
Social Authentication
Endpoints for social login with Google and Facebook.
Social Login Redirect
Parameters
{provider}- Social provider (google or facebook)This endpoint redirects users to the social provider's authentication page.
Social Login Callback
Parameters
{provider}- Social provider (google or facebook)Note: This endpoint handles the OAuth callback from social providers. It will return a JSON response with user data and access token.
Response (Success - 200)
Link Social Account
Headers
Authorization: Bearer {access_token}Parameters
{provider}- Social provider (google or facebook)Response (Success - 200)
Users can link multiple social accounts to their primary email account.
Unlink Social Account
Headers
Authorization: Bearer {access_token}Request Body
Response (Success - 200)
Users cannot unlink their last authentication method. They must have at least one authentication method (email/password or social).