Pages API
This guide explains how to interact with the Pages API in the Sumaya369 web application. The API provides endpoints for retrieving custom pages that have been configured by administrators, including features like authentication-based access and page status management.
Get Page by Key
Retrieve a specific page by its unique key identifier. This endpoint returns the page content along with metadata about its accessibility and status.
Endpoint
- Method: GET
- URL:
/v1/customer/pages/{key}
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| key | string | Unique identifier for the page | Yes |
Success Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"id": "d75c1c50-b5aa-11ed-8740-3b6fbf0f3645",
"title": "الوظائف",
"description": "<p><br></p><p><div class=\"powr-form-builder\" id=\"282c8003_1677396973\"></div><script src=\"https://www.powr.io/powr.js?platform=html\"></script></p>",
"key": "jobs",
"logged_in_only": false,
"is_active": true
},
"status_code": 200
}
Error Responses
Page Not Found (404)
{
"success": false,
"message": "لم يتم العثور على السجل",
"data": [],
"status_code": 404
}
Example Implementation Flow
-
Page Retrieval
- Application sends request to
/v1/customer/pages/{key} - Check authentication status if required
- Display page content if accessible
- Handle error cases appropriately
- Application sends request to
-
Access Control
- Verify page active status
- Check user authentication when
logged_in_onlyis true - Display appropriate error messages for unauthorized access
Key Considerations
- Only active pages can be retrieved (
is_active = true) - Authentication is required for pages with
logged_in_onlyflag set to true - 404 error is returned for inactive or non-existent pages
- Server-side caching may be implemented for public pages