Requires
read_product
access scope. For more access scope
The Product Total Count API retrieves the total number of products that match specific filter criteria. It allows you to query the product catalog using various parameters, such as creation date, update date, published status, or collection ID, providing a count of products without fetching their full details.This API is especially useful for:
-
Analytics and Reporting: Obtain a count of products for detailed insights and reporting purposes.
-
Pagination Optimization: Use the count to calculate total pages or optimize data retrieval processes.
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 | Example | Description |
---|---|---|---|---|
ids | string | No | 9e79ca1f-9ff2-409b-976f-98be343d38a3 v | Product's IDs, separated by commas, to filter specific products. |
title | string | No | Shirt | Product's title for filtering results based on name. |
collection_id | string | No | 9e79ca1f-9ff2-409b-976f-98be343d38a3 | Collection's unique identifier to filter products within a collection. |
created_at_min | string | No | 2018-10-01T16:15:47-04:00 | Filter products created at or after the specified date. |
created_at_max | string | No | 2018-10-01T16:15:47-04:00 | Filter products created at or before the specified date. |
updated_at_min | string | No | 2018-10-01T16:15:47-04:00 | Filter products last updated at or after the specified date. |
updated_at_max | string | No | 2018-10-01T16:15:47-04:00 | Filter products last updated at or before the specified date. |
published_at_min | string | No | 2018-10-01T16:15:47-04:00 | Filter products published at or after the specified date. |
published_at_max | string | No | 2018-10-01T16:15:47-04:00 | Filter products published at or before the specified date. |
published_status | string | No | published , unpublished , or any | Filter products by their published status. |
Response Explanation
Successful Response
Field | Type | Example | Description |
---|---|---|---|
count | integer | 509 | The total number of products matching the filters. |
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 | ["created_at_max 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.myshoplaza.com/openapi/2022-01/products/count?ids=9e79ca1f-9ff2-409b-976f-98be343d38a3&title=title&collection_id=9e79ca1f-9ff2-409b-976f-98be343d38a3&published_status=published' \
--header 'accept: application/json' \
--header 'access-token: WPMSdB6M8Cpum4X1GoMYOKZpiESd8d2x7dZW8d79ZeQ'
Success Response Example
{
"count": 509
}
Error Response Example
{
"errors": [
"created_at_min time format error"
]
}
{
"error": "store is not active"
}
Error Details
Status Code | Message | Possible Reason | Example Response |
---|---|---|---|
422 | failed verification: the published status is invalid | The published_status provided is not one of the allowed values. | {"errors": ["failed verification: the published status is invalid"]} |
created_at_min time format error | The created_at_min field is not in a valid time format.(e.g., not ISO8601). | {"errors": [" created_at_min time format error""]} | |
created_at_max time format error | The updated_at_max field is not in a valid time format.(e.g., not ISO8601). | {"errors": ["created_at_max time format error"]} | |
published_at_max time format error | The published_at_max field is not in a valid time format.(e.g., not ISO8601). | {"errors": ["published_at_max time format error"]} | |
published_at_min time format error | The published_at_min field is not in a valid time format.(e.g., not ISO8601). | {"errors": ["published_at_min time format error"]} | |
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"]} | |
Invalid cursor or pre_cursor type | |||
500 | no_context | Missing Context | {"errors": ["No context"]} |