/collections
Creates a new collection.
Request body attributes
Parameters that you can send in the request body in JSON format, for example:
{"id": 1,"title": "Campaign"}
Title | Type | Description | Required? |
---|---|---|---|
title | string | Title | Yes |
is_draft | bool | Defines whether collection is draft or published | No |
description | string | Collection description | No |
images | array of integers | Array of uploaded images | No |
type | integer | Type of collection: 0 - manually added products 1 - rules based | Yes |
seo_title | string | SEO title | Yes |
seo_url | string | SEO url (e.g. collections/<:value>) | Yes |
seo_meta | string | SEO meta description | No |
match_products | array of integers | Array of products that were manually added to this collection | Yes, when collection is manual, otherwise NO |
rules_match_condition | integer | Defines the way of matching product rules: 0 - match at least one 1 - match all | Yes, when collection is rules-based, otherwise NO |
rules | array of objects | Contains array of object defining rules | Yes, when collection is rules-based, otherwise NO |
rules.type | integer | Field name 0 - product title 1 - product vendor 2 - product type 3 - product price 4 - product tag 5 - weight 6 - variant title | Yes, when collection is rules-based, otherwise NO |
rules.condition | integer | Condition 0 - is exactly 1 - starts with 2 - ends with 3 - contains 4 - does not contain 5 - is equal to 6 - not equal to 7 - greater than 8 - less than | Yes, when collection is rules-based, otherwise NO |
rules.value | string|integer | Value | Yes, when collection is rules-based, otherwise NO |
Response attributes
Attributes that you will receive in response from the endpoint in JSON format, for example:
{"id": 1,"title": "Campaign"}
Title | Type | Description | Required? |
---|---|---|---|
title | string | Title | Yes |
is_draft | bool | Defines whether collection is draft or published | No |
description | string | Collection description | No |
images | array of integers | Array of uploaded images | No |
type | integer | Type of collection: 0 - manually added products 1 - rules based | Yes |
seo_title | string | SEO title | Yes |
seo_url | string | SEO url (e.g. collections/<:value>) | Yes |
seo_meta | string | SEO meta description | No |
match_products | array of integers | Array of products that were manually added to this collection | Yes, when collection is manual, otherwise NO |
rules_match_condition | integer | Defines the way of matching product rules: 0 - match at least one 1 - match all | Yes, when collection is rules-based, otherwise NO |
rules | array of objects | Contains array of object defining rules | Yes, when collection is rules-based, otherwise NO |
rules.type | integer | Field name 0 - product title 1 - product vendor 2 - product type 3 - product price 4 - product tag 5 - weight 6 - variant title | Yes, when collection is rules-based, otherwise NO |
rules.condition | integer | Condition 0 - is exactly 1 - starts with 2 - ends with 3 - contains 4 - does not contain 5 - is equal to 6 - not equal to 7 - greater than 8 - less than | Yes, when collection is rules-based, otherwise NO |
rules.value | string|integer | Value | Yes, when collection is rules-based, otherwise NO |
POST https://mystore.commercehq.com/api/v1/collections/
{
"type": 1,
"seo_url": "rules-based",
"seo_title": "rules based",
"title": "rules based",
"description": "whatever",
"rules_match_condition": 0,
"rules": [
{
"type": 0,
"condition": 3,
"value": "cat"
}
],
"is_draft": false
}
{
"id": 10,
"type": 1,
"seo_url": "rules-based",
"seo_title": "rules based",
"title": "rules based",
"description": "whatever",
"rules_match_condition": 0,
"rules": [
{
"type": 0,
"condition": 3,
"value": "cat"
}
],
"is_draft": false
}