The Specification Value Object

A Specification Value represents a global value used by Products and filtering.

Properties

color
When the specId relates to a Specification with a type of swatch, you may supply a hexadecimal colour reference (e.g. #ff0000).
Defaults to null.
id read-only
An unsigned 64-bit integer, which is unique across all Specification Values and all Evance Accounts.
image
When the specId relates to a Specification with a type of swatch, you may supply an image. The URL to an image in the Media Library may be a JPEG, GIF, PNG, or SVG file up to 20MB in size.
Evance requires images for specification values to be imported into the Media Library. If you supply the image as a Data URI, or an external URL, Evance will import the image into the Media Library and an Evance CDN URL will be returned.
Defaults to null.
See Importing Images below.
maxValue
When the specId relates to a Specification with a type of range the maxValue supplied must contain a numeric value (signed or unsigned) greater than the value property.
Defaults to null.
sequence
Indicates the display position of the specification value on product profiles.
The sequence of items starts from 1 (the first item). You may supply the sequence when adding or updating specification values as an integer or as an object containing placement and id properties (see Sequencing Specification Values below). If omitted when inserting a specification value, the new item will be positioned last in the sequence.
specId
An unsigned 64-bit integer representing the Specification.
value
Required. The specification value may be a string up to 150 characters in length.
When the specId relates to a Specification with a type of numeric or range the value must contain a numeric value (signed or unsigned).

Importing Images

Importing new files for image properties may be done using one of the following methods:

  • Content URI
    Upload files to the Media Library manually through the Evance admin panel, then reference their location using a Content URI. For example, uploading a file named my-image-name.jpg to the images/products subfolder in the Media Library is referenced as ~/content/images/products/my-image-name.jpg

  • External URLs
    Evance will import file data from external URLs (http or https) into the Media Library. The file will be placed in a directory in the Media Library, which is calculated based on the URL and the mime type of the file.

  • Data URIs
    You can provide base64 encoded binary file data as a Data URI. Evance will calculate the directory within the Media Library based on the mime type of the file and the filename will be based on an md5 of the file contents.

When importing External URLs or Data URIs, you may want greater control over the resulting filename and location within the Media Library. Supply your data within an object consisting of src, filename and directory properties:

src
Required. May be either an absolute External URL, or a Data URI.
filename
Optional, allows you to set a preferred filename and extension for the image. For example my-file-name.png.
The file name should not include spaces or special characters.
The extension must be appropriate to the mime type.
directory
Optional, allows you to set a preferred directory within the Media Library and must be a valid Content URI starting with ~/content.

Example

The example below highlights how to specify both a filename and directory for an image imported using a Data URI.

{
    "data": {
        "image": {
            "src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...",
            "filename": "my-image-name.png",
            "directory": "˜/content/images/products"
        }
    }
}

If the filename already exists within the directory supplied, the import may be ignored as Evance may assume the file already exists.

Sequencing Specification Values

The position of specification values is represented by the sequence property. When importing data you may adjust the sequence of your specification value by supplying either an integer (starting from 1) or a position object containing placement and id properties.

When supplying an integer, existing specification values with a sequence greater than or equal to the sequence supplied will increment by one. If you supply a sequence number greater than the current number of values, your object will be positioned last and the appropriate sequence number will be recalculated and returned as part of the response.

Alternatively, you may supply a position object consisting of the following properties:

placement
May be one of the following:
  • first - insert or move the object to the first position.
  • last - insert or move the object to the last position.
  • before - insert or move the object in front of another referenced by id (see below).
  • after - insert of move the object after another referenced by id(see below).
id
Required when placement is either before or after. Represents the ID of another Specification Value for the same Specification.

Example

The example below shows a request to position the specification value before another value with ID 1234.

{
    "data": {
        "sequence": {
            "placement": "before",
            "id": 1234
        }
    }
}