Skip to main content

Material Type

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

List Material Types

GET /v1/admin/material-types

Returns a paginated list of all material types.

Query Parameters

ParameterTypeDescription
search_textstringSearch material types by name
filter[active]booleanFilter by active status
filter[name]stringFilter by exact name match
filter[trashed]booleanInclude trashed material 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/material-types?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://testing-api.sumaya369.net/v1/admin/material-types?page=1",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/admin/material-types?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "التالي »",
"active": false
}
],
"next_page_url": null,
"path": "http://testing-api.sumaya369.net/v1/admin/material-types",
"per_page": 10,
"prev_page_url": null,
"to": 4,
"total": 4,
"materialTypes": [
{
"id": "dbc06390-f947-11ef-b7aa-e15363579174",
"name": "معالجة1",
"active": true,
"created_at": "2025-03-05 01:27:29",
"updated_at": "2025-03-23 16:41:45"
},
{
"id": "d04d8f80-f947-11ef-9b1d-61e0434e7b48",
"name": "تطوير1",
"active": true,
"created_at": "2025-03-05 01:27:10",
"updated_at": "2025-03-23 16:38:06"
},
{
"id": "bf96d4d0-f947-11ef-a61e-fdae86193dc6",
"name": "تنظيف",
"active": true,
"created_at": "2025-03-05 01:26:42",
"updated_at": "2025-03-23 13:17:10"
},
{
"id": "0a2f87c0-ef59-11ef-b8fb-673a57d850d4",
"name": "مادة بسيطة",
"active": true,
"created_at": "2025-02-20 10:05:17",
"updated_at": "2025-02-20 10:05:17"
}
]
},
"status_code": 200
}

Create Material Type

POST /v1/admin/material-types

Create a new material type.

Request Body

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

Response

{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "d97fbbc0-07ec-11f0-a07f-692cfe50d79a",
"name": "النوع المتنوع",
"active": true,
"created_at": "2025-03-23 16:43:49",
"updated_at": "2025-03-23 16:43:49"
},
"status_code": 200
}

Get Material Type

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

Retrieve details of a specific material type.

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"id": "dbc06390-f947-11ef-b7aa-e15363579174",
"name": "معالجة1",
"active": true,
"created_at": "2025-03-05 01:27:29",
"updated_at": "2025-03-23 16:41:45"
},
"status_code": 200
}

Update Material Type

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

Update an existing material type.

Request Body

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

Response

{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": {
"id": "d97fbbc0-07ec-11f0-a07f-692cfe50d79a",
"name": "النوع المتنوع",
"active": false,
"created_at": "2025-03-23 16:43:49",
"updated_at": "2025-03-23 16:44:10"
},
"status_code": 200
}

Delete Material Types

DELETE /v1/admin/material-types

Delete one or more material types.

Request Body

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

Response

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

Authorization

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

Notes

  • Material types with existing courses cannot be deleted
  • Name must be unique across all material types