Collect
Version: 1.0
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
What you can do with Collect
The Haravan API lets you do the following with the Collect resource.
- GET
https://apis.haravan.com/com/collects.json
- GET
https://apis.haravan.com/com/collects/count.json
- GET
https://apis.haravan.com/com/collects/{collect_id}.json
- POST
https://apis.haravan.com/com/collects.json
- DELETE
https://apis.haravan.com/com/collects/{collect_id}.json
Properties
collection_id
: number
"collection_id": 841564295
The id of the custom collection containing the product.
created_at
: string
"created_at": "2021-05-13T07:29:20.1Z"
The date and time (ISO 8601 format) when the collect was created.
featured
: boolean
"featured": false
States whether or not the collect is featured. Valid values are "true" or "false".
id
: number
"id": 841564295
A unique numeric identifier for the collect.
carrier_code
: string
"carrier_code": "haravanexpress"
The code for the carrier.
position
: string
"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
: number
"product_id":632910392
The unique numeric identifier for the product in the custom collection.
sort_value
: string
"sort_value":"0000000002"
This is the same value as but padded with leading zeroes to make it alphanumeric-sortable.
created_at
: string
"updated_at": "2021-05-13T07:29:20.1Z"
The date and time (ISO 8601 format) when the collect was updated.
Retrieves a list of collects
Parameters
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
Details
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
Details
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
Details
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"
}
]
}
Retrieves a count of all collects
Count all collects for your shop.
- GET
https://apis.haravan.com/com/collects/count.json
Details
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
Details
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
Details
HTTP/1.1 200 OK
{
"count": 2
}
Retrieves detail a collect
Retrieves detail a collect with id.
- GET
https://apis.haravan.com/com/collects/841564295.json
Details
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"
}
}
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 new collect.
- POST
https://apis.haravan.com/com/collects.json
{
"collect": {
"product_id": 921728736,
"collection_id": 841564295
}
}
Details
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 a collect.
- DELETE
https://apis.haravan.com/com/collects/841564295.json
{}
Details
HTTP/1.1 200 OK
[]