Skip to main content

Update Endpoints in SolidX

This section provides details about the Update Endpoints of the REST API, including usage patterns, headers, request/response formats, and examples of both partial and full updates.

Types of Updates

1 Partial Update

  • Method: PATCH
  • Purpose: Update specific fields of a record without affecting the rest.

Example: Update feeType Field

Headers

Content-Type: application/json
Authorization: Bearer <token>

Request

PATCH /api/fee-type/1

Body

{
"feeType": "tuition"
}

Response

{
"statusCode": 200,
"message": [],
"error": "",
"data": {
"feeType": "tuition",
"partPaymentAllowed": true,
"id": 3,
"updatedBy": {
"fullName": "Default Admin",
"email": "admin@example.service.com",
"active": true,
"id": 1
},
"updatedAt": "2025-08-06T23:30:10.185Z"
}
}

2 Full Update

  • Method: PUT
  • Purpose: Replace the entire model with a new object.
  • Idempotent: Yes (repeated calls with the same payload have the same effect).

Example: Full Update of Fee Type

Headers

Content-Type: application/json
Authorization: Bearer <token>

Request

PUT /api/fee-type/1

Body

{
"feeType": "tuition",
"instituteUserKey": "Don Bosco",
"partPaymentAllowed": true
}

Response

{
"statusCode": 200,
"message": [],
"error": "",
"data": {
"feeType": "tuition",
"partPaymentAllowed": true,
"institute": {
"instituteName": "Don Bosco",
"id": 3
},
"updatedBy": {
"fullName": "Default Admin",
"email": "admin@example.service.com",
"id": 1
},
"updatedAt": "2025-08-06T23:30:10.185Z"
}
}

Update Without Media

Used when no files (like images or documents) are uploaded.

Example: JSON-only Update

PATCH /api/institute-user/1
Content-Type: application/json
Authorization: Bearer <token>
{
"userType": "Institute Admin",
"email": "admin@institute.com"
}

Update With Media

Used when the request includes file uploads (e.g., profile pictures, attachments).

Example: Update with Multipart Form Data

PATCH /api/institute-user/1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary
Authorization: Bearer <token>

Form Fields

  • updateDto (as JSON string)
  • files (actual file(s))

Example Payload

updateDto: {
"userType": "Institute Admin",
"email": "admin@institute.com"
}
files: profile-picture.jpg