Skip to main content

Pages

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

List Pages

GET /v1/admin/pages

Returns a list of pages with pagination support.

Query Parameters

ParameterTypeDescriptionValidation Rules
search_textstringSearch in page titles and keysOptional
per_pageintegerNumber of items per pageOptional, default: 10

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://192.168.0.139:8080/v1/admin/pages?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://192.168.0.139:8080/v1/admin/pages?page=1",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/pages?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "التالي »",
"active": false
}
],
"next_page_url": null,
"path": "http://192.168.0.139:8080/v1/admin/pages",
"per_page": 10,
"prev_page_url": null,
"to": 6,
"total": 6,
"pages": [
{
"id": "d75c1c50-b5aa-11ed-8740-3b6fbf0f3645",
"title": "الوظائف",
"link": "/pages/jobs",
"can_modified": false
},
{
"id": "c1355030-7463-11ed-a0e4-95352d757486",
"title": "أهداف 2023",
"link": "/pages/2023Goals",
"can_modified": false
},
{
"id": "ef93c3c0-2db1-11ed-bb79-cf4ac7d754e4",
"title": "عن الدكتورة سمية",
"link": "/pages/about",
"can_modified": true
},
{
"id": "06622f80-198b-11ed-a194-ef0f852701eb",
"title": "الشروط والأحكام و سياسة الخصوصية",
"link": "/pages/terms-and-conditions-with-privacy-policy",
"can_modified": true
},
{
"id": "44be7620-fc64-11ec-ac0a-25b84d224296",
"title": "أحداث ألشهر",
"link": "/pages/privacy-policy",
"can_modified": true
},
{
"id": "44ba88e0-fc64-11ec-bef3-07e57efefd48",
"title": "قاموس الوعي",
"link": "/pages/awareness-dictionary",
"can_modified": false
}
]
},
"status_code": 200
}

Get Page Details

GET /v1/admin/pages/{id}

Returns details of a specific page.

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"id": "d75c1c50-b5aa-11ed-8740-3b6fbf0f3645",
"title": "الوظائف",
"description": "<p><br></p><p>&lt;div class=\"powr-form-builder\" id=\"282c8003_1677396973\"&gt;&lt;/div&gt;&lt;script src=\"https://www.powr.io/powr.js?platform=html\"&gt;&lt;/script&gt;</p>",
"type": "editor",
"key": "jobs",
"link": "/pages/jobs",
"priority": 1,
"can_modified": false,
"logged_in_only": false,
"is_active": false
},
"status_code": 200
}

Create Page

POST /v1/admin/pages

Creates a new page.

Request Body

ParameterTypeDescriptionValidation Rules
titlestringPage titleRequired, min: 3, max: 255
typestringPage typeRequired, values: editor,code
descriptionstringPage descriptionRequired with type, min: 3
keystringUnique identifierRequired, min: 3, max: 255, unique
metaobjectAdditional metadataOptional
priorityintegerDisplay priorityOptional, greater than 0
can_modifiedbooleanAllow modificationsRequired, values: true/false
logged_in_onlybooleanRestrict to logged in usersRequired, values: true/false
is_activebooleanPage active statusRequired, values: true/false

Response

{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "ec08ee40-058c-11f0-a2be-b7740d702c50",
"title": "show-page123",
"description": "<p class=\"ql-align-right\"><div class=\"powr-form-builder\" id=\"282c8003_1677396973\"></div><script src=\"https://www.powr.io/powr.js?platform=html\"></script></p>",
"type": "code",
"key": "omar123456789",
"link": "/pages/omar123456789",
"priority": "25",
"can_modified": false,
"logged_in_only": true,
"is_active": true
},
"status_code": 200
}

Update Page

PATCH /v1/admin/pages/{id}

Updates an existing page.

Request Body

ParameterTypeDescriptionValidation Rules
titlestringPage titlemin: 3, max: 255
typestringPage typevalues: editor,code
descriptionstringPage descriptionRequired with type, min: 3
keystringUnique identifiermin: 3, max: 255, unique
metaobjectAdditional metadataOptional
priorityintegerDisplay prioritygreater than 0
can_modifiedbooleanAllow modificationsvalues: true/false
logged_in_onlybooleanRestrict to logged in usersvalues: true/false
is_activebooleanPage active statusvalues: true/false

Response

{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": {
"id": "010b9d70-058d-11f0-85a6-5df62c816d76",
"title": "show-page1",
"description": "<p class=\"ql-align-right\"><div class=\"powr-form-builder\" id=\"282c8003_1677396973\"></div><script src=\"https://www.powr.io/powr.js?platform=html\"></script></p>",
"type": "code",
"key": "omar1234567892",
"link": "/pages/omar1234567892",
"priority": 25,
"can_modified": true,
"logged_in_only": true,
"is_active": true
},
"status_code": 200
}

Delete Pages

DELETE /v1/admin/pages

Deletes multiple pages by their IDs.

Request Body

ParameterTypeDescriptionValidation Rules
idsarrayArray of page IDs to deleteRequired
ids.*stringPage UUIDRequired, UUID format

Response

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

Duplicate Pages

POST /v1/admin/pages/duplicate

Creates copies of existing pages.

Request Body

ParameterTypeDescriptionValidation Rules
idsarrayArray of page IDs to duplicateRequired
ids.*stringPage UUIDRequired, UUID format

Response

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

Notes

  • The list endpoint excludes pages with key 'monthly-events'
  • Results are sorted by creation date in descending order by default
  • Pages marked with can_modified: false cannot be deleted
  • When duplicating a page:
    • Title is prefixed with "نسخة من"
    • Key is prefixed with "old-" and suffixed with "-copy"
    • The copy is set to inactive by default
    • The copy is always modifiable (can_modified: true)
    • Priority is set to 100