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
- offers-and-cards-management — Manage products and cards
- all-methods — Full account management
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 returnABSENT_MANDATORY_SIZE_CHART. Measurements and grids withrequired: falsethis 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
rowIndexdoes 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: |
Body
application/json
{
"sizeTables": [
{
"sizeParameterId": 1,
"sizeTableName": "example",
"rows": [
{
"values": [
null
]
}
]
}
]
}
|
Name |
Description |
||||||||||||||||
|
sizeTables |
Type: object[]
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: Max items: Example
|
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,ERRORThe 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 withoutsizeChartIdandsizeChartName(rowIndex), repeat column in row, cell withoutsizeValueIdandsizeValueor a cell, in whichsizeChartNamedoesn't match the column namesizeChartId(rowIndex,sizeChartId).UNKNOWN_SIZE_CHART— dimensional grids or measurements fromsizeChartIdsnot among the available ones for the dimensional characteristics of the table, and the names fromsizeChartNamesthere 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 returnsNONE_COLUMN.EMPTY_CELL— the required size grid cell is not filled (rowIndex,sizeChartId).NONE_COLUMN— in columns fromsizeChartIdsthere is no single value except "no value".DUPLICATE_ROWS— lines fromrowIndicesthey match.DUPLICATE_SIZES— the values are repeated in dimensional grids fromsizeChartIds. 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 fromsizeChartIds. 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_ERRORrowIndex
Type: integer
The number of the line with the error in
rowsthe request, starting from 0. It may not match withrowIndexthe saved table.Min value:
0rowIndices
Type: integer[] | null
The numbers of matching rows in
rowsthe request, starting from 0.Min items:
1Unique items:
trueExample
[ 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:
1Unique items:
trueExample
[ 0 ]sizeChartNames
Type: string[] | null
Column names from
sizeChartNamea query that does not have exactly one dimension grid or measurement.Min items:
1Unique items:
trueExample
[ "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_CHARTandINVALID_SIZE_VALUE. If there are any, other checks are not performed., therefore, other errors may return after the correction.Min items:
1Example
[ { "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:
exampleThe results for the tables from the query are in the same order:
results[i]refers tosizeTables[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 hassizeParameterIdnot 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,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "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,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "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,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "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,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "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,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "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,ERRORThe standard wrapper for server responses.
Example
{ "status": "OK" } -
Type: object
errors
Type: object[]
code
Type: string
The error code.
Example:
examplemessage
Type: string
Description of the error.
Example:
exampleA list of errors.
Min items:
1Example
[ { "code": "example", "message": "example" } ]Example
{ "errors": [ { "code": "example", "message": "example" } ] }
A standard wrapper for server errors.
Example
{ "status": "OK", "errors": [ { "code": "example", "message": "example" } ] } -