Shopify API – SmartCollection

top

Receive a list of all SmartCollections

Get a list of all smart collections that contain a given product

Available URL Query parameters:

  • limit — Amount of results (default: 50) (maximum: 250)
  • page — Page to show (default: 1)
  • title — Show custom collections with given title
  • product_id — Show custom collections that includes given product
  • updated_at_min — Show custom collections last updated after date (format: 2008-01-01 03:00)
  • updated_at_max — Show custom collections last updated before date (format: 2008-01-01 03:00)
GET /admin/smart_collections.xml

List all collections

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<smart-collections type="array">
  <smart-collection>
    <body>The best selling ipod ever</body>
    <body-html>&lt;p&gt;The best selling ipod ever&lt;/p&gt;</body-html>
    <conditions>--- 
- - type
  - :equals
  - Cult Products
</conditions>
    <handle>smart-ipods</handle>
    <id type="integer">482865238</id>
    <published-at type="datetime">2008-02-01T19:00:00-05:00</published-at>
    <sort-order>manual</sort-order>
    <template-suffix nil="true"></template-suffix>
    <title>Smart iPods</title>
    <updated-at type="datetime">2008-02-01T19:00:00-05:00</updated-at>
  </smart-collection>
</smart-collections>
GET /admin/smart_collections.xml?product_id=1706652214

List all smart collections for a certain product_id

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<nil-classes type="array"/>
top

Receive a count of all SmartCollections

Get a count of all smart collections that contain a given product

Available URL Query parameters:

  • title — Show custom collections with given title
  • product_id — Show custom collections that includes given product
  • updated_at_min — Show custom collections last updated after date (format: 2008-01-01 03:00)
  • updated_at_max — Show custom collections last updated before date (format: 2008-01-01 03:00)
GET /admin/smart_collections/count.xml

Count all collections

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<count type="integer">1</count>
GET /admin/smart_collections/count.xml?product_id=1706652214

Count all smart collections for a certain product_id

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<count type="integer">0</count>
top

Receive a single SmartCollection

Get a single smart collection

GET /admin/smart_collections/#{id}.xml

Get a specific collection by ID

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<smart-collection>
  <body>The best selling ipod ever</body>
  <body-html>&lt;p&gt;The best selling ipod ever&lt;/p&gt;</body-html>
  <conditions>--- 
- - type
  - :equals
  - Cult Products
</conditions>
  <handle>smart-ipods</handle>
  <id type="integer">482865238</id>
  <published-at type="datetime">2008-02-01T19:00:00-05:00</published-at>
  <sort-order>manual</sort-order>
  <template-suffix nil="true"></template-suffix>
  <title>Smart iPods</title>
  <updated-at type="datetime">2008-02-01T19:00:00-05:00</updated-at>
</smart-collection>
top

Create a new SmartCollection

Create a new smart collection

POST /admin/smart_collections.xml

Create a collection with title Macbooks

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<smart-collection>
  <title>Macbooks</title>
</smart-collection>      

Response

           
HTTP/1.1 201 Created
<?xml version="1.0" encoding="UTF-8"?>
<smart-collection>
  <body nil="true"></body>
  <body-html nil="true"></body-html>
  <conditions>--- []

</conditions>
  <handle>macbooks</handle>
  <id type="integer">1692861632</id>
  <published-at type="datetime">2009-10-20T07:30:38-04:00</published-at>
  <sort-order>alpha-asc</sort-order>
  <template-suffix nil="true"></template-suffix>
  <title>Macbooks</title>
  <updated-at type="datetime">2009-10-20T07:30:38-04:00</updated-at>
</smart-collection>
top

Modify an existing SmartCollection

Update an existing smart collection

PUT /admin/smart_collections/#{id}.xml

Change the description of the Smart iPods collection

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<smart-collection>
  <body-html>&lt;p&gt;The best selling ipod ever&lt;/p&gt;</body-html>
  <handle>smart-ipods</handle>
  <title>Smart iPods</title>
  <conditions>--- 
- - type
  - :equals
  - Cult Products
</conditions>
  <body>5000 songs in your pocket</body>
  <template-suffix nil="true"></template-suffix>
  <updated-at type="datetime">2008-02-02T00:00:00Z</updated-at>
  <sort-order>manual</sort-order>
  <id type="integer">482865238</id>
  <published-at type="datetime">2008-02-02T00:00:00Z</published-at>
</smart-collection>      

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<smart-collection>
  <body>5000 songs in your pocket</body>
  <body-html>&lt;p&gt;5000 songs in your pocket&lt;/p&gt;</body-html>
  <conditions>--- 
- - type
  - :equals
  - Cult Products
</conditions>
  <handle>smart-ipods</handle>
  <id type="integer">482865238</id>
  <published-at type="datetime">2008-02-01T19:00:00-05:00</published-at>
  <sort-order>manual</sort-order>
  <template-suffix nil="true"></template-suffix>
  <title>Smart iPods</title>
  <updated-at type="datetime">2009-10-20T07:30:54-04:00</updated-at>
</smart-collection>
PUT /admin/smart_collections/#{id}.xml

Hide a published collection by changing the published attribute to false

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<smart-collection>
  <published type="boolean">false</published>
  <id type="integer">482865238</id>
</smart-collection>      

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<smart-collection>
  <body>The best selling ipod ever</body>
  <body-html>&lt;p&gt;The best selling ipod ever&lt;/p&gt;</body-html>
  <conditions>--- 
- - type
  - :equals
  - Cult Products
</conditions>
  <handle>smart-ipods</handle>
  <id type="integer">482865238</id>
  <published-at type="datetime" nil="true"></published-at>
  <sort-order>manual</sort-order>
  <template-suffix nil="true"></template-suffix>
  <title>Smart iPods</title>
  <updated-at type="datetime">2009-10-20T07:30:56-04:00</updated-at>
</smart-collection>
top

Remove a SmartCollection from the database

DELETE /admin/smart_collections/#{id}.xml

Remove Smart iPods smart collection

Response

           
HTTP/1.1 200 OK
Last updated at Oct 2009 Oct:10 AM.