Skip to main content

Body Type

This section covers the API endpoints for managing body types in the admin panel.

List Body Types

GET /v1/admin/body-types

Returns a paginated list of all body types.

Query Parameters

ParameterTypeDescription
search_textstringSearch body types by name
filter[active]booleanFilter by active status
filter[name]stringFilter by exact name match
filter[trashed]booleanInclude trashed body types
sortstringSort by field (prefix with - for descending)
per_pageintegerNumber of items per page. Defaults to 10
listbooleanReturn simplified list format

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://testing-api.sumaya369.net/v1/admin/body-types?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://testing-api.sumaya369.net/v1/admin/body-types?page=1",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/admin/body-types?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "التالي »",
"active": false
}
],
"next_page_url": null,
"path": "http://testing-api.sumaya369.net/v1/admin/body-types",
"per_page": 10,
"prev_page_url": null,
"to": 2,
"total": 2,
"bodyTypes": [
{
"id": "03cc1030-ef59-11ef-aa3c-ef2f037a7eb5",
"name": "الجسد المشاعري",
"active": true,
"created_at": "2025-02-20 10:05:06",
"updated_at": "2025-02-20 10:05:06"
},
{
"id": "fe74f650-ef58-11ef-9d8f-134dba7d30a2",
"name": "الجسد الروحي",
"active": true,
"created_at": "2025-02-20 10:04:57",
"updated_at": "2025-02-20 10:04:57"
}
]
},
"status_code": 200
}

Create Body Type

POST /v1/admin/body-types

Create a new body type.

Request Body

ParameterTypeDescription
namestringRequired. Body type name (3-255 characters)
activebooleanRequired. Body type active status

Response

{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "5a548630-07ea-11f0-8603-8dd6818faa74",
"name": "الجسد المتجسد",
"active": true,
"created_at": "2025-03-23 16:25:56",
"updated_at": "2025-03-23 16:25:56"
},
"status_code": 200
}

Get Body Type

GET /v1/admin/body-types/{id}

Retrieve details of a specific body type.

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"id": "03cc1030-ef59-11ef-aa3c-ef2f037a7eb5",
"name": "الجسد المشاعري",
"active": true,
"created_at": "2025-02-20 10:05:06",
"updated_at": "2025-02-20 10:05:06"
},
"status_code": 200
}

Update Body Type

PATCH /v1/admin/body-types/{id}

Update an existing body type.

Request Body

ParameterTypeDescription
namestringOptional. Body type name (3-255 characters)
activebooleanOptional. Body type active status

Response

{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": {
"id": "5191f140-07ea-11f0-b856-e95b81af804b",
"name": "الجسد 2",
"active": true,
"created_at": "2025-03-23 16:25:42",
"updated_at": "2025-03-23 16:26:24"
},
"status_code": 200
}

Delete Body Types

DELETE /v1/admin/body-types

Delete one or more body types.

Request Body

ParameterTypeDescription
idsarrayRequired. Array of body type UUIDs to delete
ids.*stringRequired. UUID format

Response

{
"success": true,
"message": "تم حذف البيانات بنجاح.",
"data": null,
"status_code": 200
}

Authorization

All body type endpoints require admin authorization. The user must have the appropriate permissions to perform these operations.

Notes

  • Body types with existing courses cannot be deleted
  • Name must be unique across all body types