Skip to content

Validate variant

POST
/merchants/{merchantCode}/products/{productCode}/validate
curl --request POST \
--url https://catalog.shopgate.io/v1/merchants/example/products/example/validate \
--header 'Content-Type: application/json' \
--data '{ "selectedOptions": [ { "code": "color", "valueCode": "black" } ] }'

Validates the selected options and returns possible options or the matching variant

merchantCode
required
string
<= 255 characters
productCode
required
string
<= 255 characters
locationCode
string
<= 255 characters

Location code used to determine product availability

Media typeapplication/json
object
selectedOptions
required
Array<object>
object
code
required
string
<= 255 characters
Example
color
valueCode
required

Unique identifier for the attribute value

string
<= 255 characters
Example
black

Return the possible options or matching variants

Media typeapplication/json
object
possibleOptions
Array<object>
object
code
string
<= 255 characters
name

Name of the attribute which will be shown to the customer. It’s saved in the language of the passed locale.

string
<= 255 characters
type

Type of the attribute. It specifies which type the attribute value will have.

string
Allowed values: text productList input number
values
Array
object
code
required

Unique identifier for the attribute value

string
<= 255 characters
sequenceId
required

Sequence id of the order of the values. The lowest number is at the top and the highest number is at the bottom.

number
name
required

Name of the attribute value which will be shown to the customer. It’s saved in the language of the passed locale.

string
<= 255 characters
swatch
object
type
string
Allowed values: image color
value
string
additionalPrice

The price which is added to the base price of the configurable product. It can be positive and negative

number | null
matchingVariant
object
productCode
string
isPurchasable
boolean
Example
{
"possibleOptions": [
{
"code": "color",
"name": "Color",
"values": [
{
"code": "white",
"name": "White",
"sequenceId": 1
},
{
"code": "black",
"name": "Black",
"sequenceId": 2
}
]
}
]
}

Validation error

Media typeapplication/json
object
statusCode
number
message
string
code
string
additionalInfo
object
validationErrors
Array<object>
object
code
number
reason
string
entity
string
entityId
string
subentityPath
Array<string | number>
error
object
paramName

The parameter-field, that failed to validate, like “userId”

string
paramValue

The value, that was sent, like “xxx”

null | string | number | array | object
code

Machine readable error code

string
Allowed values: SCHEMA_VALIDATION_FAILED VALIDATION_FAILED ENUM_MISMATCH MAXIMUM MAXIMUM_EXCLUSIVE MINIMUM MINIMUM_EXCLUSIVE MULTIPLE_OF ARRAY_LENGTH_LONG ARRAY_LENGTH_SHORT ARRAY_ADDITIONAL_ITEMS ARRAY_UNIQUE MAX_LENGTH MIN_LENGTH MAX_PROPERTIES MIN_PROPERTIES OBJECT_MISSING_REQUIRED_PROPERTY OBJECT_PROPERTIES_MAXIMUM OBJECT_PROPERTIES_MINIMUM OBJECT_ADDITIONAL_PROPERTIES OBJECT_DEPENDENCY_KEY ONE_OF_MISSING ONE_OF_MULTIPLE NOT_PASSED INVALID_FORMAT INVALID_TYPE UNKNOWN_FORMAT PATTERN
message
required

Human readable error code

string
results
object
errors
Array<object>
object
code

Machine readable error code

string
Allowed values: ENUM_MISMATCH MAXIMUM MAXIMUM_EXCLUSIVE MINIMUM MINIMUM_EXCLUSIVE MULTIPLE_OF ARRAY_LENGTH_LONG ARRAY_LENGTH_SHORT ARRAY_ADDITIONAL_ITEMS ARRAY_UNIQUE MAX_LENGTH MIN_LENGTH MAX_PROPERTIES MIN_PROPERTIES OBJECT_MISSING_REQUIRED_PROPERTY OBJECT_PROPERTIES_MAXIMUM OBJECT_PROPERTIES_MINIMUM OBJECT_ADDITIONAL_PROPERTIES OBJECT_DEPENDENCY_KEY ONE_OF_MISSING ONE_OF_MULTIPLE NOT_PASSED INVALID_FORMAT INVALID_CREDENTIALS INVALID_TYPE UNKNOWN_FORMAT PATTERN
message

Human readable error code

string
description
string
path
Array<string>
warnings
array
Example
{
"error": {
"code": "SCHEMA_VALIDATION_FAILED",
"results": {
"errors": [
{
"code": "MAX_LENGTH",
"message": "Name too long",
"description": "Property Name is too long",
"path": [
"name"
]
}
]
}
}
}

Merchant or product not found

Media typeapplication/json
object
statusCode
number
code
required
string
message
required
string
Example
{
"code": "NotFound",
"message": "Merchant not found"
}