Skip to main content

Get Product Variants

Getting Product Variants

Contents

Overview

  • Call name: get-product-variants
  • Endpoint URL: https://{API hostname}/internal/get-product-variants
  • Request methods: GET
  • Request Content-Type: application/x-www-form-urlencoded
  • Response Content-Type: application/json
  • Auth required: yes

This API call provides a general product search and returns a list of product variants and their barcodes for a particular chain. The results can be filtered by barcode and paginated using offset and limit parameters.

Version-specific information

The following version-specific changes apply to this endpoint. See the versioning page for more details.

VersionChange details
N/AN/A

Permissions and Authentication

This API call requires admin authentication:

  • The performing user must be logged in and have READ access to the chain that owns the product variants
  • User and privileged authentication methods are not permitted for this endpoint

Headers

Standard headers are used for this endpoint. No special headers are required.

HTTP Parameters

The following HTTP parameters can be passed to the API:

ParameterDescription
chain_id(integer, mandatory) The ID of the chain to retrieve product variants from
barcodes(array, optional) Comma-separated list of barcodes to filter product variants. Maximum 50 barcodes allowed
offset(integer, optional) Starting index for pagination. Must be 0 or greater. Default: 0
limit(integer, optional) Maximum number of results to return. Must be between 1 and 500 inclusive. Default: 500

Sample request

GET /internal/get-product-variants?chain_id=1&barcodes=6566826825607,8512345875215&offset=0&limit=10 HTTP/1.1

Sample response

{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"product_variants": [
{
"barcodes": [
{
"barcode": "6566826825607",
"created_date": "2025-01-24T12:00:00+00:00",
"deleted": false,
"id": 3709374,
"last_modified_date": "2025-01-24T12:00:00+00:00",
"product_variant_id": 3101029
}
],
"colour": null,
"condition": "new",
"cost_price": null,
"currency_id": 1,
"deleted": false,
"id": 3101029,
"image_url": null,
"name": null,
"price": null,
"product": {
"created_date": "2025-01-24T12:00:00+00:00",
"id": 292421,
"last_modified_date": "2025-01-24T12:00:00+00:00",
"name": "Sample Product",
"owner_code": "6566826825607"
},
"published_expiry_date": "2025-02-23T12:00:00+00:00",
"published_status": 1,
"size": null,
"web_url": null
}
],
"total_count": 1,
"result_type": "get-product-variants"
}
}

Possible error responses

CodeName and DescriptionHTTP Status Code
6no_valid_session
The user needs to be logged in and a valid session key needs to be sent
401
68permission_denied_or_non_existent
This user has insufficient permissions for this object or the object does not exist
403
330server_error
Unexpected server error
500
419parameter_invalid
One of the parameters is invalid (e.g., negative offset, invalid limit range, too many barcodes)
400
441parameter_missing
The required chain_id parameter is missing
400