Update a CMS Section
Updates a CMS Section
PATCH
/
api
/
v2
/
platform
/
cms_sections
/
{id}
Update a CMS Section
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cms_section: {
name: '<string>',
type: 'Spree::Cms::Sections::ProductCarousel',
linked_resource_type: 'Spree::Taxon',
linked_resource_id: '1',
fit: 'Screen',
position: 2,
gutters: 'No Gutters',
button_text: 'Click Here',
title: 'Shop Today',
'cms_section[image_one]': '<string>'
}
})
};
fetch('http://{defaultHost}/api/v2/platform/cms_sections/{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_sections/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cms_section": {
"name": "<string>",
"type": "Spree::Cms::Sections::ProductCarousel",
"linked_resource_type": "Spree::Taxon",
"linked_resource_id": "1",
"fit": "Screen",
"position": 2,
"gutters": "No Gutters",
"button_text": "Click Here",
"title": "Shop Today",
"cms_section[image_one]": "<string>"
}
}
'{
"data": {
"id": "29",
"type": "cms_section",
"attributes": {
"name": "Super Hero",
"content": {},
"settings": {
"gutters": "No Gutters"
},
"fit": "Screen",
"destination": null,
"type": "Spree::Cms::Sections::HeroImage",
"position": 1,
"linked_resource_type": "Spree::Product",
"created_at": "2022-11-08T19:34:05.290Z",
"updated_at": "2022-11-08T19:34:05.525Z"
},
"relationships": {
"cms_page": {
"data": {
"id": "20",
"type": "cms_page"
}
},
"linked_resource": {
"data": {
"id": "28",
"type": "product"
}
}
}
}
}{
"error": "The access token is invalid"
}{
"error": "The resource you were looking for could not be found."
}{
"error": "Name can't be blank",
"errors": {
"name": [
"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 Hero Image Section
- Update a Product Carousel Section
- Update a Side-by-Side Image Section
- Update a Featured Article Section
- Update an Image Gallery Section
- Update a Rich Text Section
Show child attributes
Show child attributes
Response
Record updated
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Update a CMS Section
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cms_section: {
name: '<string>',
type: 'Spree::Cms::Sections::ProductCarousel',
linked_resource_type: 'Spree::Taxon',
linked_resource_id: '1',
fit: 'Screen',
position: 2,
gutters: 'No Gutters',
button_text: 'Click Here',
title: 'Shop Today',
'cms_section[image_one]': '<string>'
}
})
};
fetch('http://{defaultHost}/api/v2/platform/cms_sections/{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_sections/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cms_section": {
"name": "<string>",
"type": "Spree::Cms::Sections::ProductCarousel",
"linked_resource_type": "Spree::Taxon",
"linked_resource_id": "1",
"fit": "Screen",
"position": 2,
"gutters": "No Gutters",
"button_text": "Click Here",
"title": "Shop Today",
"cms_section[image_one]": "<string>"
}
}
'{
"data": {
"id": "29",
"type": "cms_section",
"attributes": {
"name": "Super Hero",
"content": {},
"settings": {
"gutters": "No Gutters"
},
"fit": "Screen",
"destination": null,
"type": "Spree::Cms::Sections::HeroImage",
"position": 1,
"linked_resource_type": "Spree::Product",
"created_at": "2022-11-08T19:34:05.290Z",
"updated_at": "2022-11-08T19:34:05.525Z"
},
"relationships": {
"cms_page": {
"data": {
"id": "20",
"type": "cms_page"
}
},
"linked_resource": {
"data": {
"id": "28",
"type": "product"
}
}
}
}
}{
"error": "The access token is invalid"
}{
"error": "The resource you were looking for could not be found."
}{
"error": "Name can't be blank",
"errors": {
"name": [
"can't be blank"
]
}
}
