Retrieve a specific variant by product ID and variant ID.
GET /api/v1/products/{productId}/variants/{variantId}
Headers:
Authorization: Bearer <api-key>
Content-Type: application/json| Parameter | Type | Description |
|---|---|---|
productId | string | Required - The Shopify product REST ID |
variantId | string | Required - The Shopify variant REST ID |
{
"success": true,
"data": {
"variant": {
"id": "456",
"unitMeasurement": {
"unit": "kg",
"value": 1
},
"settings": {
"onlineStore": {
"displayStyle": "number",
"rules": {
"min": 0.5,
"increment": 0.5,
"defaultValue": 1,
"max": null
}
}
},
"product": {
"id": "123",
"measurementType": "weight"
}
}
}
}| Field | Type | Description |
|---|---|---|
success | boolean | Indicates whether the request was successful |
data | object | Response data object |
data.variant | Variant | The variant object |
| Status code | Description |
|---|---|
| 400 | Bad Request - Missing product ID or variant ID |
| 401 | Unauthorized - Missing or invalid API key |
| 404 | Not Found - Variant not found, or variant doesn't belong to the specified product |
| 500 | Internal Server Error - Server error while processing the request |
Note
The variant must belong to the specified product, otherwise a 404 error will be returned. The response includes the parent product's ID and measurement type.
Related: