Skip to main content

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

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes

Path Parameters

ParameterTypeDescriptionRequired
keystringUnique identifier for the pageYes

Success 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>",
"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

  1. Page Retrieval

    • Application sends request to /v1/customer/pages/{key}
    • Check authentication status if required
    • Display page content if accessible
    • Handle error cases appropriately
  2. Access Control

    • Verify page active status
    • Check user authentication when logged_in_only is 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_only flag set to true
  • 404 error is returned for inactive or non-existent pages
  • Server-side caching may be implemented for public pages