Product Total Count

🔒

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:

  1. Analytics and Reporting: Obtain a count of products for detailed insights and reporting purposes.

  2. 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 NameTypeRequiredParameter LocationParameter ValueDescription
Access-TokenStringYesHeaderBx-_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-TypeStringYesHeaderapplication
/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 NameTypeMandatoryParameter LocationExample ValueDescription
errorStringNoResponse 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" }.
errorsArrayNoResponse Body{ "errors"["No Context"] }A list of errors that occurred during the request processing. Example: { "errors": [ "No Context" ] }.
Request-IdStringYesHeaderBx-_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

ParameterTypeRequiredExampleDescription
idsstringNo9e79ca1f-9ff2-409b-976f-98be343d38a3vProduct's IDs, separated by commas, to filter specific products.
titlestringNoShirtProduct's title for filtering results based on name.
collection_idstringNo9e79ca1f-9ff2-409b-976f-98be343d38a3Collection's unique identifier to filter products within a collection.
created_at_minstringNo2018-10-01T16:15:47-04:00Filter products created at or after the specified date.
created_at_maxstringNo2018-10-01T16:15:47-04:00Filter products created at or before the specified date.
updated_at_minstringNo2018-10-01T16:15:47-04:00Filter products last updated at or after the specified date.
updated_at_maxstringNo2018-10-01T16:15:47-04:00Filter products last updated at or before the specified date.
published_at_minstringNo2018-10-01T16:15:47-04:00Filter products published at or after the specified date.
published_at_maxstringNo2018-10-01T16:15:47-04:00Filter products published at or before the specified date.
published_statusstringNopublished, unpublished, or anyFilter products by their published status.

Response Explanation

Successful Response

FieldTypeExampleDescription
countinteger509The 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.

FieldTypeExampleDescription
errorsArray["created_at_max time format error"]A list of errors encountered during the request processing.
FieldTypeExampleDescription
errorArray "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 CodeMessagePossible ReasonExample Response
422failed verification: the published status is invalidThe published_status provided is not one of the allowed values.{"errors": ["failed verification: the published status is invalid"]}
created_at_min time format errorThe 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 errorThe 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 errorThe 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 errorThe 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 errorThe 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 errorThe 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
500no_contextMissing Context{"errors": ["No context"]}
Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!