Feedback

Feedback API

Get Feedback

Retrieve feedback for the authenticated user.

Request

  • Method: GET
  • Can be accessed by: Users with roles: ADMIN, SUPERADMIN, STUDENT, STAFF
  • URL: /api/feedback
  • Headers:
    • Authorization: Bearer <access_token>

Response

  • Status: 200 OK
  • Body:
    {
      "success": true,
      "data": [
        {
          "id": "feedback_id",
          "rollNumber": "123456",
          "name": "John Doe",
          "subject": "Feedback Subject",
          "body": "Feedback Body",
          "status": "NOT_STARTED",                    // NOT_STARTED, PENDING, COMPLETED
          "imgUrl": "https://example.com/image.jpg",
          "createdAt": "2024-08-03T12:34:56Z"
        },
        ...
      ],
      "error": null
    }

Error Responses

  • Unauthorized Access

    • Status: 401 Unauthorized
    • Body:
      {
        "success": false,
        "data": null,
        "error": "Unauthorized"
      }
  • Server Error

    • Status: 500 Internal Server Error
    • Body:
      {
        "success": false,
        "data": null,
        "error": "An error occurred while processing your request"
      }

Add Feedback

Add a new feedback entry.

Request

  • Method: POST
  • Can be accessed by: Users with roles: ADMIN, SUPERADMIN, STUDENT, STAFF
  • URL: /api/feedback
  • Headers:
    • Authorization: Bearer <token>
  • Body:
    {
      "subject": "Feedback Subject",
      "body": "Feedback Body",
      "imgUrl": "https://example.com/image.jpg" // Optional
    }

Response

  • Status: 200 OK
  • Body:
    {
      "success": true,
      "data": {
        "_id": "feedback_id",
        "rollNumber": "123456",
        "name": "John Doe",
        "subject": "Feedback Subject",
        "body": "Feedback Body",
        "status": "NOT_STARTED",
        "imgUrl": "https://example.com/image.jpg",
        "createdAt": "2024-08-03T12:34:56Z"
      },
      "error": null
    }

Error Responses

  • Unauthorized Access

    • Status: 401 Unauthorized
    • Body:
      {
        "success": false,
        "data": null,
        "error": "Unauthorized"
      }
  • Invalid Request Body

    • Status: 400 Bad Request
    • Body:
      {
        "success": false,
        "data": null,
        "error": "Invalid Request Body. Required fields: subject, body"
      }
  • Server Error

    • Status: 500 Internal Server Error
    • Body:
      {
        "success": false,
        "data": null,
        "error": "An error occurred while processing your request"
      }