Requires
read_collection
access scope. More access scope
The Get Collections API retrieves a list of collections based on various filter criteria, such as product_id, title, or update timestamps. It allows users to paginate results and specify query limits for efficient retrieval.This API is especially useful for:
1.Fetch all collections for specific product association.
2.Filter collections by title or update timestamps.
Note: The operation is scoped to a specific shop, identified by its unique domain prefix (shopdomain), ensuring all updates are applied to the correct store.
Public Request Parameters
Parameter Name | Type | Required | Parameter Location | Parameter Value | Description |
---|---|---|---|---|---|
Access-Token | String | Yes | Header | Bx-_5aV eXNwl-4AB98s5xLV yg0fNzGf MuTpqtlBA | Used to authenticate API requests. Obtain an access token from the Access Token Guide. Pass it in the Authorization header for every request. |
Content-Type | String | Yes | Header | application /json | Indicates the media type of the request body. It tells the server how to parse the request and the client how to interpret the response. For more details, visit Content-Type. |
Public Response Parameters
Parameter Name | Type | Mandatory | Parameter Location | Example Value | Description |
---|---|---|---|---|---|
error | String | No | Response Body | { "error": "store is not active" } | Indicates an error encountered during the process. This field typically appears when the Access Token is missing or invalid. Example: { "error": "store is not active" } . |
errors | Array | No | Response Body | { "errors"["No Context"] } | A list of errors that occurred during the request processing. Example: { "errors": [ "No Context" ] } . |
Request-Id | String | Yes | Header | Bx-_5aV eXNwl-4AB98s5xLV yg0fNzGf MuTpqtlBA | A unique identifier for each request. It helps in identifying and debugging specific requests. |
Error and Errors Clarification:
Added explanation that the error and errors fields are currently dependent on the API implementation, with plans for future unification.
Request Parameters
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
ids | string | No | Comma-separated list of collection IDs to retrieve specific collections. |
title | string | No | Filter collections by their title (supports partial matching). |
updated_at_min | string | No | Minimum timestamp for filtering collections by their last updated date. Format: YYYY-MM-DDTHH:mm:ssZ . |
updated_at_max | string | No | Maximum timestamp for filtering collections by their last updated date. Format: YYYY-MM-DDTHH:mm:ssZ . |
product_id | string | No | UUID of a product to filter collections that include the product. |
page | integer | No | Page number for pagination (default: 1). |
limit | integer | No | Number of collections to retrieve per page (default: 10, max: 100). |
Response Explanation
Successful Response
Field | Type | Example | Description |
---|---|---|---|
collections | Array | An array of collection objects. Each collection contains details about a specific product collection. | |
collections.id | String | "a60fe556-43ad-4e07-9125-507ac1bf71f7" | The unique identifier of the collection (UUID). |
collections.title | String | "Test-Collection" | The title of the collection. |
collections.description | String | "Desc" | A description of the collection. |
collections.handle | String | "test-collection" | The URL-friendly handle for the collection. |
collections.smart | Boolean | false | Indicates whether the collection is a smart collection (true ) or a manual collection (false ). |
collections.image | Object | Image Object | An object containing details of the collection image. |
collections.image.src | String | "//cdn.shoplazza.com/cb.jpeg" | The URL of the image. |
collections.image.width | Integer | 1920 | The width of the image in pixels. |
collections.image.height | Integer | 1080 | The height of the image in pixels. |
collections.image.alt | String | "" | The alternative text for the image. |
collections.image.path | String | "cb.jpeg" | The file path of the image. |
collections.seo_title | String | "seo_title" | The SEO title for the collection. |
collections.seo_description | String | "Desc" | The SEO description for the collection. |
collections.seo_keywords | String | "test" | Comma-separated keywords for SEO optimization. |
collections.sort_order | String | "title-asc" | Merchandise sorting rules. Options include: manual (default), sales-desc , price-asc , price-desc , views-desc , vendor-asc , vendor-desc , created-desc , and more. (See order options ). |
collections.created_at | String | "2024-04-16T10:31:13Z" | The timestamp when the collection was created, in ISO 8601 format. |
collections.updated_at | String | "2024-04-16T10:31:13Z" | The timestamp when the collection was last updated, in ISO 8601 format. |
Error Response
Error responses in the API can be represented using two different fields: errors
and error
. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.
Field | Type | Example | Description |
---|---|---|---|
errors | Array | [ "UpdatedAtMin time format error"] | A list of errors encountered during the request processing. |
Field | Type | Example | Description |
---|---|---|---|
error | Array | "store is not active" | Indicates an error encountered during the process. |
Request Examples
curl --request GET \
--url https://<shopdomain>.myshoplazza.com/openapi/2022-01/collections \
--header 'accept: application/json' \
--header 'access-token: <your-access-token>'
Success Response Example
{
"collections": [
{
"id": "a60fe556-43ad-4e07-9125-507ac1bf71f7",
"title": "Test-Collection",
"description": "Desc",
"handle": "test-collection",
"smart": false,
"image": {
"src": "//cdn.shoplazza.com/9de53f9726576696b318a8d95c0946cb.jpeg",
"width": 1920,
"height": 1080,
"alt": "",
"path": "9de53f9726576696b318a8d95c0946cb.jpeg"
},
"seo_title": "seo_title",
"seo_description": "Desc",
"seo_keywords": "test",
"sort_order": "title-asc",
"created_at": "2024-04-16T10:31:13Z",
"updated_at": "2024-04-16T10:31:13Z"
}
]
}
Error Response Example
{
"errors": [
"UpdatedAtMin time format error"
]
}
{
"error": "store is not active"
}
Error Details
Status Code | Message | Possible Reason | Example Response |
---|---|---|---|
400 | Bad Request | Invalid input format or request structure (e.g., missing required fields or incorrect data types). | Bad Request |
Unauthorized | The request is missing valid authentication credentials or the credentials provided are invalid. | Unauthorized | |
422 | update_at_min time format error | The update_at_min field is not in a valid time format.(e.g., not ISO8601). | {"errors": ["update_at_min time format error"]} |
update_at_max time format error | The update_at_max field is not in a valid time format.(e.g., not ISO8601). | {"errors": ["update_at_min time format error"]} | |
500 | no context | Missing Context | {"errors": ["No context"]} |