PagesApi Class Interface
The PagesApi class is a resource-specific controller within the GeniXCMS RESTful API framework. It handles standard CRUD (Create, Read, Update, Delete) operations for Page resources via HTTP endpoints.
Endpoint Mapping
The following HTTP methods are mapped to the class methods when accessing /api/v1/pages/:
| Method |
Endpoint |
Action |
| GET |
/ |
List all active pages. |
| GET |
/{id} |
Retrieve details of a specific page. |
| POST |
/ |
Create a new page. |
| PUT |
/{id} |
Update an existing page. |
| DELETE |
/{id} |
Permanently remove a page. |
Method Overview
index()
Handles retrieval of one or multiple page records.
Syntax:
public function index($id = null)
- If
$id is null: Returns a list of all pages with status 1 and type page.
- If
$id is provided: Returns the specific page record or a 404 error if not found.
submit()
Processes a POST request to create a new page. Expects a JSON payload in the request body.
update()
Processes a PUT request to update specific fields of a page identified by its ID.
delete()
Processes a DELETE request to remove a page from the database.
Usage in Modules
Modules can interact with this class internally if they need to bypass the standard Pages model logic or to extend the API behavior.
Example: Internal Execution
$api = new PagesApi();
$result = $api->index(10); // Fetch page ID 10 via the API controller logic
See Also