Update a CMS Page
Updates a CMS Page
PATCH
/
api
/
v2
/
platform
/
cms_pages
/
{id}
Update a CMS Page
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cms_page: {
title: 'About Us',
meta_title: 'Learn More About Super-Shop',
content: 'Lot\'s of text..',
meta_description: 'Learn more about us on this page here...',
slug: 'about-us',
locale: 'en-US'
}
})
};
fetch('http://{defaultHost}/api/v2/platform/cms_pages/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url http://{defaultHost}/api/v2/platform/cms_pages/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"cms_page": {
"title": "About Us",
"meta_title": "Learn More About Super-Shop",
"content": "Lot's of text..",
"meta_description": "Learn more about us on this page here...",
"slug": "about-us",
"locale": "en-US"
}
}
EOF{
"data": {
"id": "8",
"type": "cms_page",
"attributes": {
"title": "My Super Page",
"meta_title": null,
"content": null,
"meta_description": null,
"visible": true,
"slug": "cumque-excepturi-nisi-cupiditate-dolore",
"type": "Spree::Cms::Pages::StandardPage",
"locale": "en",
"deleted_at": null,
"created_at": "2022-11-08T19:34:02.188Z",
"updated_at": "2022-11-08T19:34:02.420Z"
},
"relationships": {
"cms_sections": {
"data": []
}
}
}
}{
"error": "The access token is invalid"
}{
"error": "The resource you were looking for could not be found."
}{
"error": "Title can't be blank",
"errors": {
"title": [
"can't be blank"
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
Select which associated resources you would like to fetch, see: https://jsonapi.org/format/#fetching-includes
Body
application/json
- Update a Standard Page
- Update a Homepage
- Update a Feature Page
Show child attributes
Show child attributes
Response
Record updated
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Update a CMS Page
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cms_page: {
title: 'About Us',
meta_title: 'Learn More About Super-Shop',
content: 'Lot\'s of text..',
meta_description: 'Learn more about us on this page here...',
slug: 'about-us',
locale: 'en-US'
}
})
};
fetch('http://{defaultHost}/api/v2/platform/cms_pages/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url http://{defaultHost}/api/v2/platform/cms_pages/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"cms_page": {
"title": "About Us",
"meta_title": "Learn More About Super-Shop",
"content": "Lot's of text..",
"meta_description": "Learn more about us on this page here...",
"slug": "about-us",
"locale": "en-US"
}
}
EOF{
"data": {
"id": "8",
"type": "cms_page",
"attributes": {
"title": "My Super Page",
"meta_title": null,
"content": null,
"meta_description": null,
"visible": true,
"slug": "cumque-excepturi-nisi-cupiditate-dolore",
"type": "Spree::Cms::Pages::StandardPage",
"locale": "en",
"deleted_at": null,
"created_at": "2022-11-08T19:34:02.188Z",
"updated_at": "2022-11-08T19:34:02.420Z"
},
"relationships": {
"cms_sections": {
"data": []
}
}
}
}{
"error": "The access token is invalid"
}{
"error": "The resource you were looking for could not be found."
}{
"error": "Title can't be blank",
"errors": {
"title": [
"can't be blank"
]
}
}
