Collections
· Revision #2
Update Collection Endpoint
Structure
Collection
Name
|
Type
|
Description
|
Required
|
name |
string |
The name of the collection |
No |
slug |
string |
The slug of the collection, if not present it is auto-generated from name |
No |
reference |
string |
The reference of the collection |
No |
logic |
string |
The logic of the rules for the collection, and/or (defaults to or if not provided) |
No |
published_at |
timestamp |
The published at of the collection |
No |
rules |
array |
An array of Listing Page Rule objects |
No |
content |
object |
The Listing Page Content of the collection |
No |
options |
object |
The Listing Page Options of the collection |
No |
seo |
object |
The SEO of the collection |
No |
additional_attributes |
array |
An array of Additional Attribute objects |
No |
settings |
object |
A Settings object with grouped key-value pairs |
No |
Image
Name
|
Type
|
Description
|
Required
|
src |
string |
The source url of the image |
Yes |
Rule
Name
|
Type
|
Description
|
Required
|
type |
string |
Rule type. Allowed values: in_category, in_price_list, have_manufacturers, have_tags, price_between, reduced, published_within_days, published_within |
Yes |
requirement |
string |
Requirement for the rule. Allowed values: must, must_not. Defaults to must |
No |
logic |
string |
How this rule combines with others. Allowed values: and, or. Defaults to or |
No |
data |
object |
Rule-specific data (see below). Keys vary depending on type |
Yes |
data.tags |
array |
An array of Tag ids (or names formatted as group|name). Required if type = have_tags |
Conditional |
data.manufacturers |
array |
An array of manufacturer ids (or names). Required if type = have_manufacturers |
Conditional |
data.price_list |
string |
Price list id (or name). Required if type = in_price_list |
Conditional |
data.category |
string |
Category id (or name/breadcrumb, e.g., Mens > Coats). Required if type = in_category |
Conditional |
data.days |
int |
Number of days. Required if type = published_within_days |
Conditional |
data.start_at |
timestamp |
The start date. Required if type = published_within |
Conditional |
data.end_at |
timestamp |
The end date. Optional if type = published_within |
Conditional |
data.min_price |
float |
Minimum price (including tax) in store’s default currency, whole units only (e.g. pounds, not pence). Required if type = price_between |
Conditional |
data.max_price |
float |
Maximum price (including tax) in store’s default currency, whole units only. Required if type = price_between |
Conditional |
The rules are nested within arrays to achieve grouping, see rules in Example Request for clarity
Content
Name
|
Type
|
Description
|
Required
|
summary |
string |
The summary content |
No |
description |
string |
The description content |
No |
small_image |
object |
The Small Image |
No |
medium_image |
object |
The Medium Image |
No |
large_image |
object |
The Large Image |
No |
Options
Name
|
Type
|
Description
|
Required
|
categories.mode |
string |
Categories filter display mode. Allowed values: show_all, hide_all, show_some. Default: show_all |
No |
categories.values |
array |
An array of category ids (or names/breadcrumbs, e.g. Mens > Coats) to show. Required if categories.mode = show_some |
Conditional |
filters.mode |
int |
Facet filters display mode. Allowed values: show_all, hide_all, show_some. Default: show_all |
No |
filters.values |
array |
The options for facet filters on the listings page. Required if filters.mode = show_some |
Conditional |
filters.values.*.name |
string |
The name of the facet filter, e.g. Category, Price, etc... |
Yes |
filters.values.*.collapsed |
boolean |
Whether to collapse the facet filter or not |
Yes |
sort_bys |
array |
An array of the applied sorts on the listings page (e.g., name-az, name-za, price-low, price-high, etc...) |
No |
per_page |
int |
The per page of the listings page (defaults to 24) |
No |
SEO
Name
|
Type
|
Description
|
Required
|
heading |
string |
The SEO Heading |
No |
page_title |
string |
The SEO Page Title |
No |
meta_description |
string |
The SEO Meta Description |
No |
canonical |
string |
The SEO Canonical |
No |
noindex |
boolean |
The SEO No Index |
No |
nofollow |
boolean |
The SEO No Follow |
No |
Additional Attribute
Name
|
Type
|
Description
|
Required
|
key |
string |
The key of the additional attribute |
Yes |
value |
string |
The value of the additional attribute |
Yes |
Settings
Settings are grouped as key-value pairs.
- Use "_" for ungrouped settings.
- Each group contains its own object of key-value pairs.
{
"settings": {
"_": {
"no_group": "value"
},
"group": {
"key": "value"
}
}
}
Example Request
PUT /api/collections/{id|name}
{
"name": "Updated Sale",
"slug": "big-sale",
"content": {
"description": "Updated Sale"
},
"seo": {
"heading": "Updated Sale"
}
}
Example Response
{
"collection": {
"id": 1
}
}