Transmitting characteristic values

In all scenarios, be guided by the data from the response of the method of obtaining characteristics. POST v2/category/{categoryId}/parameters:

  • values[].id — ids to send to valueId;
  • multivalue — is it possible to pass multiple values;
  • allowCustomValues — is it possible to pass custom values (value without valueId);
  • unit.defaultUnitId, unit.units[] — units of measurement and their identifiers (unitId);
  • constraints — restrictions on values (number limits, maximum text length).

The values are passed in the parameter parameterValues in two methods (the rules are the same):

A characteristic with a list of acceptable values (type ENUM), you need to specify one value

  • When to apply: type characteristics ENUM, in the response of the characteristics method, the field multivalue = false.
  • What to transmit: one object with parameterId and valueId (take the ID from values[].id). Field value you don't have to specify it.
  • Restriction: if allowCustomValues = false, transfer only value without valueId will result in a validation error.
Example — one value from the list
{
  "parameterValues": [
    { "parameterId": 111111, "valueId": 999999, "value": "10" }
  ]
}

The characteristic allows for eigenvalues, you need to specify one eigenvalue.

  • When to apply: type characteristics ENUM, in the response of the characteristics method, the field allowCustomValues = true, multivalue = false.
  • What to transmit: one object with parameterId and a line in value. Field valueId don't specify it.
Example — one proper value
{
  "parameterValues": [
    { "parameterId": 111111, "value": "Собственное значение" }
  ]
}

The characteristic allows for several values

  • When to apply: in the response of the characteristics method, the field multivalue = true.
  • What to transmit: multiple objects with the same name parameterId — one for each value.
    • If the value is from the Market list — specify valueId.
    • If eigenvalues are allowed (allowCustomValues = true) — specify value without valueId.
Example — multiple eigenvalues
{
  "parameterValues": [
    { "parameterId": 111111, "value": "Собственное значение 1" },
    { "parameterId": 111111, "value": "Собственное значение 2" }
  ]
}

Characteristics with units of measurement

  • When to apply: units are indicated in the response for the characteristic (unit.defaultUnitId, unit.units[]).
  • What to send: specify if necessary unitId in each object, the values are; if unitId omitted, the default unit is used.
Example — value with a unit of measurement
{
  "parameterValues": [
    { "parameterId": 111111, "value": "10", "unitId": 3 }
  ]
}

Deleting a previously passed value

  • What to send: an object with the same name parameterId and empty value (""). This will delete the characteristic value.
Example — deleting a feature value
{
  "parameterValues": [
    { "parameterId": 111111, "value": "" }
  ]
}