Cms Page API
Use the REST API to interact with EverShop cms pages.
Create a page
Use this endpoint to create a category.
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
status | string or integer ('0', '1', 0, 1) | Yes |
layout | string (oneColumn, twoColumnsLeft, twoColumnsRight, threeColumns) | Yes |
name | string | Yes |
content | string | Yes |
url_key | string | Yes |
meta_title | string | Yes |
meta_description | string | Yes |
meta_keywords | string | Yes |
POST/api/pages
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/pages
fetch('https://<your domain>/api/pages', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
Sample Of Response
{
"data": {
"cms_page_id": 14,
"uuid": "e15da567a66c11edb46b60d819134f39",
"layout": "oneColumn",
"status": 1,
"created_at": null,
"updated_at": null,
"cms_page_description_id": 15,
"cms_page_description_cms_page_id": 14,
"url_key": "OSbIajIBDgJMem2VtiF4",
"name": "OSbIajIBDgJMem2VtiF4",
"content": "OSbIajIBDgJMem2VtiF4",
"meta_title": "fixed_discount_to_entire_order",
"meta_keywords": "fixed_discount_to_entire_order",
"meta_description": "fixed_discount_to_entire_order",
"links": [
{
"rel": "cmsPageGrid",
"href": "/admin/pages",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "edit",
"href": "/admin/pages/edit/e15da567a66c11edb46b60d819134f39",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "view",
"href": "/page/OSbIajIBDgJMem2VtiF4",
"action": "GET",
"types": [
"text/xml"
]
}
]
}
}
Update a page
Use this endpoint to update a page.
Request Schema (application/json)
Field Name | Field Type | Required |
---|---|---|
status | string or integer ('0', '1', 0, 1) | No |
layout | string (oneColumn, twoColumnsLeft, twoColumnsRight, threeColumns) | No |
name | string | Yes |
content | string | No |
url_key | string | No |
meta_title | string | No |
meta_description | string | No |
meta_keywords | string | No |
PATCH/api/pages/{id}
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/pages/{id}
fetch('https://<your domain>/api/pages/{id}', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
Sample Of Response
{
"data": {
"cms_page_id": 14,
"uuid": "e15da567a66c11edb46b60d819134f39",
"layout": "oneColumn",
"status": 1,
"created_at": null,
"updated_at": null,
"cms_page_description_id": 15,
"cms_page_description_cms_page_id": 14,
"url_key": "contact-us",
"name": "Contact us",
"content": "Page content",
"meta_title": "Contact us",
"meta_keywords": "Contact us",
"meta_description": "Contact us",
"links": [
{
"rel": "cmsPageGrid",
"href": "/admin/pages",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "edit",
"href": "/admin/pages/edit/e15da567a66c11edb46b60d819134f39",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "view",
"href": "/page/OSbIajIBDgJMem2VtiF4",
"action": "GET",
"types": [
"text/xml"
]
}
]
}
}
Delete a page
Use this endpoint to delete a page.
Request Schema (application/json)
No request body requiredDELETE/api/pages/{id}
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/pages/{id}
fetch('https://<your domain>/api/pages/{id}', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
Sample Of Response
{
"data": {
"cms_page_id": 14,
"uuid": "e15da567a66c11edb46b60d819134f39",
"layout": "twoColumnsLeft",
"status": 1,
"created_at": null,
"updated_at": "2023-02-07 14:18:05",
"cms_page_description_id": 15,
"cms_page_description_cms_page_id": 14,
"url_key": "OSbIajIBDgJMem2VtiF4",
"url_key": "contact-us",
"name": "Contact us",
"content": "Page content",
"meta_title": "Contact us",
"meta_keywords": "Contact us",
"meta_description": "Contact us"
}
}