A collect is an object that connects a product to a custom collection.

For every product in a custom collection, there exists a collect that tracks the ids of both the product and the custom collection it's a member of. A product can be a member of more than one collection and will have more than one collect connecting the product to each collection. Unlike many haravan resources, collects aren't apparent to shop owners; they're objects for managing the relationship between products and custom collections.

Authenticated access scopes: com.read_products, com.write_products

Collect properties

collection_id

"collection_id": 841564295

The id of the custom collection containing the product.

created_at

"created_at": "2021-05-13T07:29:20.1Z"

The date and time (ISO 8601 format) when the collect was created.

featured

"featured": false

States whether or not the collect is featured. Valid values are "true" or "false".

id

"id ": 841564295

A unique numeric identifier for the collect..

carrier_code

"carrier_code": "haravanexpress"

The code for the carrier.

position

"position":"2"

A number specifying the manually sorted position of this product in a custom collection. The first position is 1. This value only applies when the custom collection is viewed using the Manual sort order.

product_id

"product_id":632910392 

The unique numeric identifier for the product in the custom collection.

sort_value

"sort_value":"0000000002"

This is the same value as but padded with leading zeroes to make it alphanumeric-sortable..

created_at

"updated_at": "2021-05-13T07:29:20.1Z"

The date and time (ISO 8601 format) when the collect was updated.

Endpoints

GET https://apis.haravan.com/com/collects.json

Retrieves a list of collects.

limit

Limit of the result (Max: 500).

page

Page to show the result.

collection_id

Filter result by the collection id.

product_id

Filter result by the product id.

fields

Comma-separated list of fields to include in the response.

Retrieve all collects by page number. By default, the number of resources on the page is 50. (Max: 500)

GET https://apis.haravan.com/com/collects.json?page=1&limit=50

View response

HTTP/1.1 200 OK

{ "collects": [ { "collection_id": 395646240, "created_at": null, "featured": false, "id": 395646240, "position": 1, "product_id": 632910392, "updated_at": null, "sort_value": "0000000001" }, { "collection_id": 841564295, "created_at": null, "featured": false, "id": 841564295, "position": 1, "product_id": 632910392, "updated_at": null, "sort_value": "0000000001" } ] }

Retrieve all collects by collection id.

GET https://apis.haravan.com/com/collects.json?colection_id=1002507494

View response

HTTP/1.1 200 OK

{ "collects": [ { "collection_id": 1002507494, "created_at": "2021-01-13T12:28:01.614Z", "featured": false, "id": 1059375051, "position": 0, "product_id": 1028183633, "sort_value": "0000000000", "updated_at": "2021-01-13T12:28:02.614Z" } ] }

Retrieve all collects by product id.

GET https://apis.haravan.com/com/collects.json?product_id=1028183633

View response

HTTP/1.1 200 OK

{ "collects": [ { "collection_id": 1002507492, "created_at": "2021-01-13T12:28:01.248Z", "featured": false, "id": 1059375049, "position": 0, "product_id": 1028183633, "sort_value": "0000000000", "updated_at": "2021-01-13T12:28:02.248Z" }, { "collection_id": 1002507493, "created_at": "2021-01-13T12:28:01.431Z", "featured": false, "id": 1059375050, "position": 0, "product_id": 1028183633, "sort_value": "0000000000", "updated_at": "2021-01-13T12:28:02.431Z" } ] }
GET https://apis.haravan.com/com/collects/count.json 

Retrieves a count of all collects.

Count all collects for your shop.

GET /com/collects/count.json

View response

HTTP/1.1 200 OK

{ "count": 2 }

Count only collects for a certain collection.

GET https://apis.haravan.com/com/collects/count.json?collection_id=841564295

View response

HTTP/1.1 200 OK

{ "count": 1 }

Count only collects for a certain product.

GET https://apis.haravan.com/com/collects/count.json?product_id=632910392

View response

HTTP/1.1 200 OK

{ "count": 2 }

Retrieves detail a collect with id.

GET https://apis.haravan.com/com/collects/841564295.json

View response

HTTP/1.1 200 OK

{ "collect": { "collection_id": 841564295, "created_at": null, "featured": false, "id": 841564295, "position": 1, "product_id": 632910392, "updated_at": null, "sort_value": "0000000001" } }
POST https://apis.haravan.com/com/collects.json

Create a collect.

Note: Collects are for specifying the membership of products in custom collections only; smart collections use rules to determine which products are their members. Creating a collect that links a product to a smart collection results in a 403 Forbidden error.

Create a collect.

POST https://apis.haravan.com/com/collects.json

{
  "collect": {
    "product_id": 921728736,
    "collection_id": 841564295
  }
}
          

View response

HTTP/1.1 201 Created

{ "collect": { "collection_id": 841564295, "created_at": "2015-03-28T13:27:21-04:00", "featured": false, "id": 1071559574, "position": 2, "product_id": 921728736, "updated_at": "2015-03-28T13:27:21-04:00", "sort_value": "0000000002" } }

Delete a collect.

DELETE https://apis.haravan.com/com/collects/841564295.json

{}

View response

HTTP/1.1 200 OK

[]