Pages
In the SCAYLE Panel
Refer to the User Guide.
Storefront API
Use the Storefront API to receive your page information in a fast & efficient way to render them on your mobile app or storefront application.
Get all Pages and their Data
You can retrieve a list of all Pages and their data by using this method.
const pages = await client.pages.get();
console.log(pages.entities);
Response
{
"pagination":
{
"current": 1,
"total": 2,
"perPage": 100,
"page": 1,
"first": 1,
"prev": 1,
"next": 1,
"last": 1
},
"entities":
[
{
"id": 1,
"name": "Men's Cotton T-Shirt",
"slug": "mens-cotton-t-shirt",
"isActive": true,
"headline": "Men's Cotton T-Shirt",
"text": "A comfortable and stylish cotton t-shirt for men, available in black color and large size.",
"meta": {
"robots": "index, nofollow",
"title": "Men's Cotton T-Shirt",
"description": "A comfortable and stylish cotton t-shirt for men, available in black color and large size."
}
},
{
"id": 2,
"name": "Women's Skinny Jeans",
"slug": "womens-skinny-jeans",
"isActive": true,
"headline": "Women's Skinny Jeans",
"text": "Classic blue skinny jeans for women, perfect for casual and everyday wear.",
"meta": {
"robots": "index, nofollow",
"title": "Women's Skinny Jeans",
"description": "Classic blue skinny jeans for women, perfect for casual and everyday wear."
}
}
]
}
Retrieve Pages by filter ID
Retrieve pages with id
matching the specified ids
, for example, filters[id]=1,2,...
.
$pages = $client->pages->get([
'filters[id]' => '1,2'
]);
var_dump($pages['entities']);
Response
{
"pagination":
{
"current": 2,
"total": 2,
"perPage": 2,
"page": 1,
"first": 1,
"prev": 1,
"next": 1,
"last": 1
},
"entities":
[
{
"id": 1,
"name": "Men's Cotton T-Shirt",
"slug": "mens-cotton-t-shirt",
"isActive": true,
"headline": "Men's Cotton T-Shirt",
"text": "A comfortable and stylish cotton t-shirt for men, available in black color and large size.",
"meta": {
"robots": "index, nofollow",
"title": "Men's Cotton T-Shirt",
"description": "A comfortable and stylish cotton t-shirt for men, available in black color and large size."
}
},
{
"id": 2,
"name": "Women's Skinny Jeans",
"slug": "womens-skinny-jeans",
"isActive": true,
"headline": "Women's Skinny Jeans",
"text": "Classic blue skinny jeans for women, perfect for casual and everyday wear.",
"meta": {
"robots": "index, nofollow",
"title": "Women's Skinny Jeans",
"description": "Classic blue skinny jeans for women, perfect for casual and everyday wear."
}
}
]
}
Retrieve Pages by filter Slug
Retrieve pages with id
matching the specified ids
, for example, filters[slug]=mens-cotton-t-shirt,womens-skinny-jeans,...
$pages = $client->pages->get([
'filters[id]' => 'mens-cotton-t-shirt,womens-skinny-jeans'
]);
var_dump($pages['entities']);
Response
{
"pagination":
{
"current": 2,
"total": 2,
"perPage": 2,
"page": 1,
"first": 1,
"prev": 1,
"next": 1,
"last": 1
},
"entities":
[
{
"id": 1,
"name": "Men's Cotton T-Shirt",
"slug": "mens-cotton-t-shirt",
"isActive": true,
"headline": "Men's Cotton T-Shirt",
"text": "A comfortable and stylish cotton t-shirt for men, available in black color and large size.",
"meta": {
"robots": "index, nofollow",
"title": "Men's Cotton T-Shirt",
"description": "A comfortable and stylish cotton t-shirt for men, available in black color and large size."
}
},
{
"id": 2,
"name": "Women's Skinny Jeans",
"slug": "womens-skinny-jeans",
"isActive": true,
"headline": "Women's Skinny Jeans",
"text": "Classic blue skinny jeans for women, perfect for casual and everyday wear.",
"meta": {
"robots": "index, nofollow",
"title": "Women's Skinny Jeans",
"description": "Classic blue skinny jeans for women, perfect for casual and everyday wear."
}
}
]
}
Get Page results with Pagination
Retrieve pages with pagination, setting the limit by specifying the number of results per page using the perPage
parameter. Pagination is determined by the page
parameter, with each page displaying a specified number of results (e.g., ?page=1&perPage=25
).
$pages = $client->pages->get([
'page' => 5,
'perPage' => 2,
]);
var_dump($pages['entities']);
Response
{
"pagination":
{
"current": 2,
"total": 10,
"perPage": 2,
"page": 5,
"first": 1,
"prev": 4,
"next": 5,
"last": 5
},
"entities":
[
{
"id": 9,
"name": "Men's Cotton T-Shirt",
"slug": "mens-cotton-t-shirt",
"isActive": true,
"headline": "Men's Cotton T-Shirt",
"text": "A comfortable and stylish cotton t-shirt for men, available in black color and large size.",
"meta": {
"robots": "index, nofollow",
"title": "Men's Cotton T-Shirt",
"description": "A comfortable and stylish cotton t-shirt for men, available in black color and large size."
}
},
{
"id": 10,
"name": "Women's Skinny Jeans",
"slug": "womens-skinny-jeans",
"isActive": true,
"headline": "Women's Skinny Jeans",
"text": "Classic blue skinny jeans for women, perfect for casual and everyday wear.",
"meta": {
"robots": "index, nofollow",
"title": "Women's Skinny Jeans",
"description": "Classic blue skinny jeans for women, perfect for casual and everyday wear."
}
}
]
}
Get Data of a Specific Page
// Get a single page
const page = await client.page.getById(1);
console.log(page)
Response
{
"id": 1,
"name": "Men's Cotton T-Shirt",
"slug": "mens-cotton-t-shirt",
"isActive": true,
"headline": "Men's Cotton T-Shirt",
"text": "A comfortable and stylish cotton t-shirt for men, available in black color and large size.",
"meta": {
"robots": "index, nofollow",
"title": "Men's Cotton T-Shirt",
"description": "A comfortable and stylish cotton t-shirt for men, available in black color and large size."
}
}