The "Get Page by Slug" endpoint allows you to retrieve detailed information about a specific page, including its content blocks, metadata, and other associated information. This endpoint is essential for dynamically displaying a single page in your application.
The "Get Page by Slug" endpoint allows you to retrieve detailed information about a specific page, including its content blocks, metadata, and other associated information. This endpoint is essential for dynamically displaying a single page in your application.
GET https://api.justcms.co/public/{projectId}/pages/{slug}
Replace {projectId}
with the unique identifier of your project and {slug}
with the slug of the page you wish to retrieve.
Include the following header to authenticate your request:
Authorization: Bearer YOUR_TOKEN
slug (string): The unique slug of the page to retrieve.
200 OK: Returns detailed information about the requested page.
403 Forbidden: The request was made without a valid or missing authentication token.
404 Not Found: The specified project or page could not be found.
Here is an example of a request to retrieve a single page by its slug:
GET https://api.justcms.co/public/66d26d17-635e-4206-a1f2-560ae244e9f0/pages/main
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5...
A successful response (200 OK) will return the following JSON:
{
"title": "Title",
"subtitle": "Accusantium architec",
"coverImage": {
"alt": "Qui non facilis veni",
"variants": [
{
"url": "https://cdn.justcms.co/example-image.webp",
"width": 1280,
"height": 720
},
{
"url": "https://cdn.justcms.co/example-image-small.webp",
"width": 512,
"height": 288
}
]
},
"slug": "main",
"categories": [
{
"id": "6772702a0907ed319c4c0d3a",
"name": "Documentation",
"slug": "docs"
}
],
"content": [
{
"type": "header",
"header": "Header Text",
"size": "large"
},
{
"type": "text",
"text": "<p>Accusamus doloremque.</p>"
},
{
"type": "image",
"images": [
{
"alt": "Example Image",
"url": "https://cdn.justcms.co/example-image.webp",
"width": 1280,
"height": 720
}
]
},
{
"type": "cta",
"text": "Get It!",
"url": "/main"
}
],
"createdAt": "2025-01-02T13:01:20.384Z",
"updatedAt": "2025-01-02T13:20:48.963Z"
}
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 resolution variants.
slug: The unique slug of the page.
categories: An array of categories associated with the page.
content: An array of content blocks, including headers, text, images, and call-to-action (CTA) elements.
createdAt: The creation timestamp.
updatedAt: The last update timestamp.
Dynamic Page Display: Retrieve page data dynamically based on the slug to display detailed content.
Content Editing: Use the endpoint to preview content changes before publishing.
403 Forbidden: Verify that your authentication token is valid and included in the request header.
404 Not Found: Ensure that the projectId
and slug
are correct and exist in your account.