Storefront API
- Authentication
- Account
- Account / Address
- Account / Credit Cards
- Account / Orders
- Order Status
- Cart
- Cart / Line Items
- Cart / Other
- Cart / Coupons
- Checkout
- Checkout / State
- Checkout / Shipments
- Checkout / Payments
- Checkout / Store Credit
- Products
- Stores
- Taxons
- Countries
- CMS Pages
- Menus
- Wishlists
- Wishlists / Wished Items
- Digital Downloads
Platform API
- Authentication
- Addresses
- Adjustments
- Classifications
- CMS Pages
- CMS Sections
- Countries
- Data Feeds
- Digital Links
- Digital Assets
- Line Items
- Menu Items
- Menus
- Option Types
- Option Values
- Orders
- Payment Methods
- Payments
- Products
- Promotion Actions
- Promotion Categories
- Promotion Rules
- Promotions
- Roles
- Shipments
- Shipping Categories
- Shipping Methods
- States
- Stock Items
- Stock Locations
- Store Credit Categories
- Store Credit Types
- Store Credits
- Tax Categories
- Tax Rates
- Taxonomies
- Taxons
- Users
- Variants
- Webhook Events
- Webhook Subscribers
- Wished Items
- Wishlists
- Zones
Create a CMS Section
Creates a CMS Section
curl --request POST \
--url http://{defaultHost}/api/v2/platform/cms_sections \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"cms_section": {
"name": "<string>",
"cms_page_id": "<string>",
"type": "Spree::Cms::Sections::HeroImage",
"linked_resource_type": "Spree::Taxon",
"linked_resource_id": "1",
"fit": "Screen",
"position": 2,
"gutters": "No Gutters",
"button_text": "Click Here",
"title": "Shop Today"
}
}'
{
"data": {
"id": "13",
"type": "cms_section",
"attributes": {
"name": "Hic iste cupiditate corrupti esse minima.",
"content": {},
"settings": {
"gutters": "No Gutters"
},
"fit": "Screen",
"destination": null,
"type": "Spree::Cms::Sections::HeroImage",
"position": 3,
"linked_resource_type": "Spree::Product",
"created_at": "2022-11-08T19:34:04.185Z",
"updated_at": "2022-11-08T19:34:04.185Z"
},
"relationships": {
"cms_page": {
"data": {
"id": "15",
"type": "cms_page"
}
},
"linked_resource": {
"data": {
"id": "23",
"type": "product"
}
}
}
}
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Query Parameters
Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>
Body
Give this section a name.
Set the cms_page
ID that this section belongs to.
Set the section type.
Spree::Cms::Sections::HeroImage
Set the resource type that this section links to.
Spree::Taxon
, Spree::Product
, Spree::CmsPage
Set the ID of the resource that you would like this section to link to.
This value is used by front end developers to set CSS classes for content that fits the screen edge-to-edge, or stays within the boundaries of the central container.
Screen
, Container
Pass the position that you want this section to appear in. (The list is not zero indexed, so the first item is position: 1
)
This value is used by front end developers for styling the section padding.
Gutters
, No Gutters
Set the text value of the button used in this section.
Create a title for the Hero Section.
Use a multipart/form-data
request to upload assets.
Was this page helpful?
curl --request POST \
--url http://{defaultHost}/api/v2/platform/cms_sections \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"cms_section": {
"name": "<string>",
"cms_page_id": "<string>",
"type": "Spree::Cms::Sections::HeroImage",
"linked_resource_type": "Spree::Taxon",
"linked_resource_id": "1",
"fit": "Screen",
"position": 2,
"gutters": "No Gutters",
"button_text": "Click Here",
"title": "Shop Today"
}
}'
{
"data": {
"id": "13",
"type": "cms_section",
"attributes": {
"name": "Hic iste cupiditate corrupti esse minima.",
"content": {},
"settings": {
"gutters": "No Gutters"
},
"fit": "Screen",
"destination": null,
"type": "Spree::Cms::Sections::HeroImage",
"position": 3,
"linked_resource_type": "Spree::Product",
"created_at": "2022-11-08T19:34:04.185Z",
"updated_at": "2022-11-08T19:34:04.185Z"
},
"relationships": {
"cms_page": {
"data": {
"id": "15",
"type": "cms_page"
}
},
"linked_resource": {
"data": {
"id": "23",
"type": "product"
}
}
}
}
}