User
Register

User Registration API

Register New User

Register a new user based on their roll number, password, and name.

Request

  • Method: POST
  • Can be accessed by: STUDENT, STAFF, ADMIN, SUPERADMIN
  • URL: /api/user/register
  • Body:
    {
      "rollNumber": "123456",
      "password": "password",
      "name": "John Doe"
    }

Response

  • Status: 201 Created
  • Body:
    {
      "success": true,
      "data": {
        "user": {
          "rollNumber": "123456",
          "email": "user.email@example.com",
          "role": ["USER_ROLE"]
        },
        "token": {
          "accessToken": "<access_token>",
          "refreshToken": null
        }
      },
      "error": null
    }

Error Responses

  • Invalid Request Body

    • Status: 400 Bad Request
    • Body:
      {
        "success": false,
        "data": null,
        "error": "Invalid Request Body."
      }
  • User Not Found

    • Status: 404 Bad Request
    • Body:
      {
        "success": false,
        "data": null,
        "error": "User does not exist"
      }
  • User Already Exists

    • Status: 409 Bad Request
    • Body:
      {
        "success": false,
        "data": null,
        "error": "User already exists"
      }
  • Server Error

    • Status: 500 Internal Server Error
    • Body:
      {
        "success": false,
        "data": null,
        "error": "<error_message>"
      }

    where <error_message> contains the details of the server error.