Creating size tables

The method is available for all models.

If you are using an API Key token, one of the accesses in the list is required to call the method

Creates business size tables. You can create up to 10 tables in one query, with a total of no more than 5000 cells. If there are more tables or cells, the request is rejected with an error. BAD_REQUEST and not a single table it is not being created.

The table refers to a dimensional characteristic, not a category.: it is selected for all categories with the same dimensional characteristic.

The size characteristic of the category is returned by the size table selection method POST v2/businesses/{businessId}/size-tables/suggest in the field result.sizeParameterId, a characteristic an existing table — method POST v2/businesses/{businessId}/size-tables in the field sizeParameterId. If the request contains an unknown identifier of the dimensional characteristic, the request is rejected with an error. UNKNOWN_SIZE_PARAMETER and no table is being created.

Dimensional grids and measurements that can be used in the table, their values and mandatory grids returns the method POST v2/businesses/{businessId}/size-tables/charts.

Как заполнить таблицу

Each element rows — table row: one size in all size grids and dimensions. In values pass one cell per column: the grid or measurement ID in sizeChartId or the name in sizeChartName and the value in sizeValueId, sizeValue or in both fields. You can skip or transfer a cell without a value. with an empty sizeValue — it will be saved as "no value".

Requirements for the table:

  • The table must have at least one mandatory size grid (required: true), otherwise the error will return ABSENT_MANDATORY_SIZE_CHART. Measurements and grids with required: false this requirement is not fulfilled.
  • Fill in every required grid in the table in all rows, otherwise an error will be returned. EMPTY_CELL.
  • Each column must have at least one value, except for the empty one and "no value", otherwise an error will be returned. NONE_COLUMN. If there is nothing to fill the column with, do not transfer its cells.
  • The strings must not match, otherwise an error will be returned. DUPLICATE_ROWS. Are the values in the column allowed to be repeated? (DUPLICATE_SIZES, DUPLICATE_MEASURES), depends on the dimensional characteristics.
Чем сохраненная таблица отличается от переданной

Method POST v2/businesses/{businessId}/size-tables returns a table by column: for each value there is a line number rowIndex. To get the rows, group the values by rowIndex.

The saved table may differ from the transmitted one:

  • the rows and columns go in the order that the Market sets, and rowIndex does not match the line number in the request.
  • the standard size grids return the text values from the reference book and its sizeValueId;
  • Commas are replaced with dots in measurements.: 42,5 → 42.5;
  • cells with "no value" and non-transmitted cells are not returned;
  • The spaces at the beginning and at the end of the name and values have been removed.

The values from the response can be passed unchanged to the size tables update method. POST v2/businesses/{businessId}/size-tables/update: fields columnType and rowIndex it does not take into account.

To link a table to a product, pass its ID to value characteristics with parameterId: 73979829 in the request POST v2/businesses/{businessId}/offer-cards/update. When the table is changed, the new content is applied to the linked items automatically.

Повторный запрос создает таблицы еще раз

The method is not idempotent: each query creates new tables, even if the same ones already exist.

If the query failed with a 5xx error, some of the tables may have been saved. Get the business tables using the method POST v2/businesses/{businessId}/size-tables and only then repeat the query for tables that are not there.

The number of tables a business has is limited — in total, according to all dimensional characteristics. The table cannot be deleted. If the limit is reached, the table is not created and an error is returned for it. LIMIT_TABLES. With simultaneous The limit is not strictly checked in queries, and more tables may be created.

⚙️ Limit without subscription: 5 requests per minute
⭐️ Limit with Medium subscription: 10 requests per minute

Request

POST

https://api.partner.market.yandex.ru/v2/businesses/{businessId}/size-tables/create

Path parameters

Name

Description

businessId

Type: integer

Cabinet ID.

To find out, use the request GET v2/campaigns.

ℹ️ What is a cabinet and a store on the Market?

Min value: 1

Body

application/json
{
  "sizeTables": [
    {
      "sizeParameterId": 1,
      "sizeTableName": "example",
      "rows": [
        {
          "values": [
            null
          ]
        }
      ]
    }
  ]
}

Name

Description

sizeTables

Type: object[]

rows

Type: object[]

values

Type: object[]

sizeChartId

Type: integer

ID of the dimension grid or measurement from the method response POST v2/businesses/{businessId}/size-tables/charts. Grids and measurements have a common identifier space. Required if not transmitted sizeChartName.

Min value: 1

sizeChartName

Type: string

The name of the dimensional grid or measurement from the method's response POST v2/businesses/{businessId}/size-tables/charts. It is compared case-insensitively and with spaces at the beginning and at the end. Required if not transmitted sizeChartId.

Min length: 1

Max length: 255

Example: example

sizeValue

Type: string

The value of the size or measurement. In columns without a directory — no longer than 20 characters.

Max length: 255

Example: example

sizeValueId

Type: integer

ID of the value from the dimensional grid reference. Only the standard size grids of the Market have a reference book.

Min value: 1

The cells are rows in any order. Each dimension grid or measurement — no more than once per line, otherwise, the error will return INVALID_REQUEST.

A cell without a value can be omitted or passed with an empty one. sizeValue: it will be saved like "no value". This is an error in the mandatory size grid. EMPTY_CELL.

Min items: 1

Max items: 50

Example
[
  {
    "sizeChartId": 1,
    "sizeChartName": "example",
    "sizeValueId": 1,
    "sizeValue": "example"
  }
]

Rows of the table: each describes one size. When saving, the row order may change.

Min items: 1

Max items: 200

Example
[
  {
    "values": [
      {
        "sizeChartId": 1,
        "sizeChartName": "example",
        "sizeValueId": 1,
        "sizeValue": "example"
      }
    ]
  }
]

sizeParameterId

Type: integer

ID of the dimension characteristic that the dimensions from the table relate to.

Min value: 1

sizeTableName

Type: string

The name of the size chart. The spaces at the beginning and at the end are deleted. The name consists of only spaces — mistake INVALID_REQUEST.

Min length: 1

Max length: 256

Example: example

Size tables. They are processed in order, each independently of the others.

In total, in all tables — no more than 5000 cells. If there are more cells, the request is not processed.

Min items: 1

Max items: 10

Example
[
  {
    "sizeParameterId": 1,
    "sizeTableName": "example",
    "rows": [
      {
        "values": [
          {}
        ]
      }
    ]
  }
]

Responses

200 OK

The results of creating tables in the query order.

If at least one table could not be created, the field status takes the value ERROR. The rest of the tables are processed and saved.

Body

application/json
{
  "status": "OK",
  "result": {
    "results": [
      {
        "sizeTableId": 0,
        "sizeTableName": "example",
        "errors": [
          null
        ]
      }
    ]
  }
}

Type: object

All of 2 types
  • Type: object

    status

    Type: string

    The type of response. Possible values:

    • OK — There are no errors.
    • ERROR — an error occurred while processing the request.

    Enum: OK, ERROR

    The standard wrapper for server responses.

    Example
    {
      "status": "OK"
    }
    
  • Type: object

    result

    Type: object

    results

    Type: object[]

    errors

    Type: object[]

    code

    Type: string

    Error code for saving the size chart:

    • INVALID_REQUEST — the table structure is broken: the name consists of only spaces, the cell without sizeChartId and sizeChartName (rowIndex), repeat column in row, cell without sizeValueId and sizeValue or a cell, in which sizeChartName doesn't match the column name sizeChartId (rowIndex, sizeChartId).
    • UNKNOWN_SIZE_CHART — dimensional grids or measurements from sizeChartIds not among the available ones for the dimensional characteristics of the table, and the names from sizeChartNames there was not exactly one such column.
    • INVALID_SIZE_VALUE — the value does not match the column (rowIndex, sizeChartId).
    • EMPTY_TABLE — there is not a single cell in the table. It is not returned for requests that match the schema. If there is only "no value" in the column, it returns NONE_COLUMN.
    • EMPTY_CELL — the required size grid cell is not filled (rowIndex, sizeChartId).
    • NONE_COLUMN — in columns from sizeChartIds there is no single value except "no value".
    • DUPLICATE_ROWS — lines from rowIndices they match.
    • DUPLICATE_SIZES — the values are repeated in dimensional grids from sizeChartIds. Depends on the size Characteristics: for some characteristics, the error returns when repeated in any grid, for others — only if there are repeats in all grids of the table.
    • DUPLICATE_MEASURES — the values are repeated in the measurements from sizeChartIds. Depends on the size Characteristics: For some characteristics, repetitions in measurements are allowed.
    • ABSENT_MANDATORY_SIZE_CHART — There is no mandatory size grid in the table.
    • LIMIT_TABLES — the business already has the maximum number of tables. Only during creation.
    • NOT_FOUND — there is no table. Only when updating.
    • FORBIDDEN — this is the Market table (sizeTableType: STANDARD), it cannot be changed. Only when updating.
    • CONCURRENT_MODIFICATION — the table was changed during the request processing. Repeat the request. Only when updating.
    • INTERNAL_ERROR — internal error, the table is not saved.

    Enum: INVALID_REQUEST, UNKNOWN_SIZE_CHART, INVALID_SIZE_VALUE, EMPTY_TABLE, EMPTY_CELL, NONE_COLUMN, DUPLICATE_ROWS, DUPLICATE_SIZES, DUPLICATE_MEASURES, ABSENT_MANDATORY_SIZE_CHART, LIMIT_TABLES, NOT_FOUND, FORBIDDEN, CONCURRENT_MODIFICATION, INTERNAL_ERROR

    rowIndex

    Type: integer

    The number of the line with the error in rows the request, starting from 0. It may not match with rowIndex the saved table.

    Min value: 0

    rowIndices

    Type: integer[] | null

    The numbers of matching rows in rows the request, starting from 0.

    Min items: 1

    Unique items: true

    Example
    [
      0
    ]
    

    sizeChartId

    Type: integer

    ID of the dimension grid or dimension that has an error in its column.

    sizeChartIds

    Type: integer[] | null

    Identifiers of dimensional grids and measurements with an error in their columns.

    Min items: 1

    Unique items: true

    Example
    [
      0
    ]
    

    sizeChartNames

    Type: string[] | null

    Column names from sizeChartName a query that does not have exactly one dimension grid or measurement.

    Min items: 1

    Unique items: true

    Example
    [
      "example"
    ]
    

    Errors that caused the table to not be saved.

    First, the structure of the table, its columns, and cell values are checked. — mistakes INVALID_REQUEST, UNKNOWN_SIZE_CHART and INVALID_SIZE_VALUE. If there are any, other checks are not performed., therefore, other errors may return after the correction.

    Min items: 1

    Example
    [
      {
        "code": "INVALID_REQUEST",
        "rowIndex": 0,
        "sizeChartId": 0,
        "sizeChartIds": [
          0
        ],
        "sizeChartNames": [
          "example"
        ],
        "rowIndices": [
          0
        ]
      }
    ]
    

    sizeTableId

    Type: integer

    ID of the saved size table.

    sizeTableName

    Type: string

    The name of the saved size chart.

    Example: example

    The results for the tables from the query are in the same order: results[i] refers to sizeTables[i].

    Example
    [
      {
        "sizeTableId": 0,
        "sizeTableName": "example",
        "errors": [
          {
            "code": "INVALID_REQUEST",
            "rowIndex": 0,
            "sizeChartId": 0,
            "sizeChartIds": [
              0
            ],
            "sizeChartNames": [
              "example"
            ],
            "rowIndices": [
              0
            ]
          }
        ]
      }
    ]
    

    The results of saving the size tables.

    Example
    {
      "results": [
        {
          "sizeTableId": 0,
          "sizeTableName": "example",
          "errors": [
            {
              "code": "INVALID_REQUEST",
              "rowIndex": 0,
              "sizeChartId": 0,
              "sizeChartIds": [
                null
              ],
              "sizeChartNames": [
                null
              ],
              "rowIndices": [
                null
              ]
            }
          ]
        }
      ]
    }
    
    Example
    {
      "result": {
        "results": [
          {
            "sizeTableId": 0,
            "sizeTableName": "example",
            "errors": [
              {}
            ]
          }
        ]
      }
    }
    

400 Bad Request

The query contains incorrect data, and no tables are being created. More information about the error

Error codes:

  • BAD_REQUEST — the request does not match the description of the method: for example, the number of tables, rows, or cells is exceeded.
  • UNKNOWN_SIZE_PARAMETER — one of the tables has sizeParameterId not from the list of acceptable values.

Body

application/json
{
  "status": "OK",
  "errors": [
    {
      "code": "example",
      "message": "example"
    }
  ]
}

Type: object

All of 1 type
  • Type: object

    All of 2 types
    • Type: object

      status

      Type: string

      The type of response. Possible values:

      • OK — There are no errors.
      • ERROR — an error occurred while processing the request.

      Enum: OK, ERROR

      The standard wrapper for server responses.

      Example
      {
        "status": "OK"
      }
      
    • Type: object

      errors

      Type: object[]

      code

      Type: string

      The error code.

      Example: example

      message

      Type: string

      Description of the error.

      Example: example

      A list of errors.

      Min items: 1

      Example
      [
        {
          "code": "example",
          "message": "example"
        }
      ]
      
      Example
      {
        "errors": [
          {
            "code": "example",
            "message": "example"
          }
        ]
      }
      

    A standard wrapper for server errors.

    Example
    {
      "status": "OK",
      "errors": [
        {
          "code": "example",
          "message": "example"
        }
      ]
    }
    

401 Unauthorized

The authorization data is not specified in the request. More information about the error

Body

application/json
{
  "status": "OK",
  "errors": [
    {
      "code": "example",
      "message": "example"
    }
  ]
}

Type: object

All of 1 type
  • Type: object

    All of 2 types
    • Type: object

      status

      Type: string

      The type of response. Possible values:

      • OK — There are no errors.
      • ERROR — an error occurred while processing the request.

      Enum: OK, ERROR

      The standard wrapper for server responses.

      Example
      {
        "status": "OK"
      }
      
    • Type: object

      errors

      Type: object[]

      code

      Type: string

      The error code.

      Example: example

      message

      Type: string

      Description of the error.

      Example: example

      A list of errors.

      Min items: 1

      Example
      [
        {
          "code": "example",
          "message": "example"
        }
      ]
      
      Example
      {
        "errors": [
          {
            "code": "example",
            "message": "example"
          }
        ]
      }
      

    A standard wrapper for server errors.

    Example
    {
      "status": "OK",
      "errors": [
        {
          "code": "example",
          "message": "example"
        }
      ]
    }
    

403 Forbidden

The authorization data is incorrect or access to the resource is prohibited. More information about the error

Body

application/json
{
  "status": "OK",
  "errors": [
    {
      "code": "example",
      "message": "example"
    }
  ]
}

Type: object

All of 1 type
  • Type: object

    All of 2 types
    • Type: object

      status

      Type: string

      The type of response. Possible values:

      • OK — There are no errors.
      • ERROR — an error occurred while processing the request.

      Enum: OK, ERROR

      The standard wrapper for server responses.

      Example
      {
        "status": "OK"
      }
      
    • Type: object

      errors

      Type: object[]

      code

      Type: string

      The error code.

      Example: example

      message

      Type: string

      Description of the error.

      Example: example

      A list of errors.

      Min items: 1

      Example
      [
        {
          "code": "example",
          "message": "example"
        }
      ]
      
      Example
      {
        "errors": [
          {
            "code": "example",
            "message": "example"
          }
        ]
      }
      

    A standard wrapper for server errors.

    Example
    {
      "status": "OK",
      "errors": [
        {
          "code": "example",
          "message": "example"
        }
      ]
    }
    

404 Not Found

The requested resource was not found. More information about the error

Body

application/json
{
  "status": "OK",
  "errors": [
    {
      "code": "example",
      "message": "example"
    }
  ]
}

Type: object

All of 1 type
  • Type: object

    All of 2 types
    • Type: object

      status

      Type: string

      The type of response. Possible values:

      • OK — There are no errors.
      • ERROR — an error occurred while processing the request.

      Enum: OK, ERROR

      The standard wrapper for server responses.

      Example
      {
        "status": "OK"
      }
      
    • Type: object

      errors

      Type: object[]

      code

      Type: string

      The error code.

      Example: example

      message

      Type: string

      Description of the error.

      Example: example

      A list of errors.

      Min items: 1

      Example
      [
        {
          "code": "example",
          "message": "example"
        }
      ]
      
      Example
      {
        "errors": [
          {
            "code": "example",
            "message": "example"
          }
        ]
      }
      

    A standard wrapper for server errors.

    Example
    {
      "status": "OK",
      "errors": [
        {
          "code": "example",
          "message": "example"
        }
      ]
    }
    

420 Method Failure

The resource access limit has been exceeded. More information about the error

Body

application/json
{
  "status": "OK",
  "errors": [
    {
      "code": "example",
      "message": "example"
    }
  ]
}

Type: object

All of 1 type
  • Type: object

    All of 2 types
    • Type: object

      status

      Type: string

      The type of response. Possible values:

      • OK — There are no errors.
      • ERROR — an error occurred while processing the request.

      Enum: OK, ERROR

      The standard wrapper for server responses.

      Example
      {
        "status": "OK"
      }
      
    • Type: object

      errors

      Type: object[]

      code

      Type: string

      The error code.

      Example: example

      message

      Type: string

      Description of the error.

      Example: example

      A list of errors.

      Min items: 1

      Example
      [
        {
          "code": "example",
          "message": "example"
        }
      ]
      
      Example
      {
        "errors": [
          {
            "code": "example",
            "message": "example"
          }
        ]
      }
      

    A standard wrapper for server errors.

    Example
    {
      "status": "OK",
      "errors": [
        {
          "code": "example",
          "message": "example"
        }
      ]
    }
    

500 Internal Server Error

Internal error of the Market. More information about the error

Body

application/json
{
  "status": "OK",
  "errors": [
    {
      "code": "example",
      "message": "example"
    }
  ]
}

Type: object

All of 1 type
  • Type: object

    All of 2 types
    • Type: object

      status

      Type: string

      The type of response. Possible values:

      • OK — There are no errors.
      • ERROR — an error occurred while processing the request.

      Enum: OK, ERROR

      The standard wrapper for server responses.

      Example
      {
        "status": "OK"
      }
      
    • Type: object

      errors

      Type: object[]

      code

      Type: string

      The error code.

      Example: example

      message

      Type: string

      Description of the error.

      Example: example

      A list of errors.

      Min items: 1

      Example
      [
        {
          "code": "example",
          "message": "example"
        }
      ]
      
      Example
      {
        "errors": [
          {
            "code": "example",
            "message": "example"
          }
        ]
      }
      

    A standard wrapper for server errors.

    Example
    {
      "status": "OK",
      "errors": [
        {
          "code": "example",
          "message": "example"
        }
      ]
    }