# ArticleVariant

An object representing an Article variant, which has it's own stock and article number.

This object is only accessible by admin.

# Properties

Property Type Description
uid integer The unique identifier of the article variant.
stock number The total amount of the stock.
articleNumber string An optional identifier of the article modifiable by an adminstrator.
article integer Article UID
image string An URL to the article variant image.

# get

Fetches information about an article variant. You need the unique identifier of the article variant.

# Parameters

Parameter Description
uid The unique identifier of an article variant.
query Which info to return. See Query language.

# getSchema

Fetches the JSON Schema which can be used for client-side validation.

# Parameters

The unique identifier of an article variant or null for a new article article variant.

# list

Fetches multiple article variants as an array of article variants objects.

# Parameters

Parameter Description
query Which info to return. See Query language.
selection Which articles to list. See List language.

# count

Takes a filter object and returns the number of article variants found, as an integer.

# Parameters

A filter object specifying which article variants to count. See Filter objects on the page List selection.

# set

Updates an article variant.

# Parameters

Parameter Description
uid The unique identifier of an article variant. Null is not allowed to create new variant.
patch An object containing the properties and values to set for the article variant.
query A query specifying what to return after a successful set (optional). See Query language.

# validate

Validates the data to be set. The performed validation is the same as in set; it validates the resulting object and includes all of the required properties. However, nothing is saved.

# Parameters

Parameter Description
uid The unique identifier of an existing article variant.
patch An object containing the properties and values to set before validating.

# Errors

Error messages are given as an array of validation-error objects, each containing the keys pointer (a property referenced using a JSON Pointer) and message (a readable text in the language of the context).

# Returns

If there are no validation errors, then an empty array is returned.

# normalize

Fetches a normalized version of the patch. Uses the same parameters as set and validate.

While set also normalizes the patch, before storing, normalize only returns the normalized patch. Any properties with numeric values represented as strings are converted to number literals. A normalization error is thrown when we are unable to convert a string to a number literal.

# Parameters

Parameter Description
uid The unique identifier of an article variant.
patch An object containing the properties and values to normalize.