Get Pages

The "Get Pages" endpoint allows you to retrieve pages for a specific project within the JustCMS Public API. This endpoint supports optional filtering and pagination, enabling efficient access to project content.

The "Get Pages" endpoint allows you to retrieve pages for a specific project within the JustCMS Public API. This endpoint supports optional filtering and pagination, enabling efficient access to project content.

Endpoint Details

GET https://api.justcms.co/public/{projectId}/pages

Replace {projectId} with the unique identifier of the project whose pages you wish to retrieve.

Required Headers

Include the following header to authenticate your request:

Authorization: Bearer YOUR_TOKEN

Query Parameters

This endpoint supports the following optional query parameters:

  • filter.category.slug (string): Filter pages by a specific category slug (e.g., ?filter.category.slug=news).

  • start (number): Pagination start index (0-based).

  • offset (number): Number of items to return from the start index.

Possible Responses

  • 200 OK: Returns a list of pages for the project, optionally filtered or paginated.

  • 403 Forbidden: The request was made without a valid or missing authentication token.

  • 404 Not Found: The specified project could not be found.

Example Request

Here is an example of a request to retrieve pages:

GET https://api.justcms.co/public/66d26d17-635e-4206-a1f2-560ae244e9f0/pages?filter.category.slug=news&start=0&offset=10
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5...

Example Response

A successful response (200 OK) will return the following JSON:

{
  "items": [
    {
      "title": "Title 1",
      "subtitle": "Subtitle 1",
      "coverImage": {
        "alt": "Hello",
        "variants": [
          {
            "url": "https://cdn.justcms.co/example-image-1.webp",
            "width": 1280,
            "height": 720
          },
          {
            "url": "https://cdn.justcms.co/example-image-2.webp",
            "width": 512,
            "height": 297
          }
        ]
      },
      "slug": "main",
      "categories": [
        {
          "name": "News",
          "slug": "news"
        }
      ],
      "createdAt": "2025-01-01T14:10:02.316Z",
      "updatedAt": "2025-01-02T10:03:07.142Z"
    }
  ],
  "total": 1
}

Each page object contains:

  • id: The unique identifier of the page.

  • title: The title of the page.

  • subtitle: The subtitle of the page.

  • coverImage: An object containing image metadata and multiple resolution variants.

  • slug: A URL-friendly identifier for the page.

  • categories: An array of categories associated with the page.

  • createdAt: The creation timestamp.

  • updatedAt: The last update timestamp.

Common Use Cases

  • Content Display: Use this endpoint to retrieve pages dynamically for display on your website or app.

  • Category-Based Filtering: Filter pages by category slug to display relevant content.

  • Pagination: Implement pagination for large datasets to improve performance and user experience.

Error Handling

  • 403 Forbidden: Ensure that your authentication token is included and valid.

  • 404 Not Found: Verify that the projectId exists and matches the resources in your account.