Skip to main content

/api/lite/products/batch

Создание/обновление нескольких продуктов (POST /api/lite/products/batch)

/api/lite/products/batch

Создает или обновляет продукты, переданные списком. Ограничение - 1000 продуктов.

Структура продуктов в списке аналогична методу POST /api/lite/products 

 

Пример вызова:

Пример запроса
{
   "products":[
      {
         "id":"BATCH2500",
         "shortName":"BATCH2500",
         "variantsToUpdate":[
            {
               "variantId":"BATCH2500",
               "productId":"BATCH2500",
               "barcodes":[
                  {
                     "value":"bc9194352",
                     "isDefault":true
                  }
               ]
            }
         ]
      },
      {
         "id":"BATCH2501",
         "shortName":"BATCH2501",
         "variantsToUpdate":[
            {
               "variantId":"BATCH2501",
               "productId":"BATCH2501",
               "barcodes":[
                  {
                     "value":"bc7216735",
                     "isDefault":true
                  }
               ]
            }
         ]
      },
      {
         "id":"BATCH2502",
         "shortName":"BATCH2502",
         "variantsToUpdate":[
            {
               "variantId":"BATCH2502",
               "productId":"BATCH2502",
               "barcodes":[
                  {
                     "value":"bc6271942",
                     "isDefault":true
                  }
               ]
            }
         ]
      }
   ]
}

Пример положительного ответа:

Пример ответа
{
    "finishTime": "2022-03-29 19:14:47",
    "products": [
        {
            "id": "BATCH2500",
            "product": {
                "available": true,
                "collections": [
                    "1001"
                ],
                "deleted": false,
                "id": "BATCH2500",
                "shortName": "BATCH2500",
                "type": "SKU",
                "useBatchAccounting": false,
                "variants": [
                    {
                        "barcodes": [
                            {
                                "isDefault": true,
                                "type": "COMMON",
                                "value": "bc9900111"
                            }
                        ],
                        "id": "BATCH2500",
                        "isFfPhysicalSetSynchronized": false,
                        "isFfSynchronised": true,
                        "isPhysicalSet": false,
                        "ordering": "1976406.000000000000000",
                        "stock": [
                            {
                                "stockAvailable": 0,
                                "stockDefective": 0,
                                "stockDefectiveReserved": 0,
                                "stockReserved": 0,
                                "stockTotal": 0,
                                "warehouseCode": "5cb8dd66-836d-6c1a-a84b-e71fcf97104c"
                            },
                            {
                                "stockAvailable": 0,
                                "stockDefective": 0,
                                "stockDefectiveReserved": 0,
                                "stockReserved": 0,
                                "stockTotal": 0,
                                "warehouseCode": "e55cd8ab-09f3-26b7-00df-27e3642f5b79"
                            }
                        ],
                        "type": "SKU",
                        "vat": "NO_VAT"
                    }
                ],
                "vat": "NO_VAT"
            },
            "success": true,
            "variantsResult": [
                {
                    "productId": "BATCH2500",
                    "success": true,
                    "variantId": "BATCH2500"
                }
            ]
        },
        {
            "id": "BATCH2501",
            "product": {
                "available": true,
                "collections": [
                    "1001"
                ],
                "deleted": false,
                "id": "BATCH2501",
                "shortName": "BATCH2501",
                "type": "SKU",
                "useBatchAccounting": false,
                "variants": [
                    {
                        "barcodes": [
                            {
                                "isDefault": true,
                                "type": "COMMON",
                                "value": "bc5524020"
                            }
                        ],
                        "id": "BATCH2501",
                        "isFfPhysicalSetSynchronized": false,
                        "isFfSynchronised": true,
                        "isPhysicalSet": false,
                        "ordering": "1976406.000000000000000",
                        "stock": [
                            {
                                "stockAvailable": 0,
                                "stockDefective": 0,
                                "stockDefectiveReserved": 0,
                                "stockReserved": 0,
                                "stockTotal": 0,
                                "warehouseCode": "5cb8dd66-836d-6c1a-a84b-e71fcf97104c"
                            },
                            {
                                "stockAvailable": 0,
                                "stockDefective": 0,
                                "stockDefectiveReserved": 0,
                                "stockReserved": 0,
                                "stockTotal": 0,
                                "warehouseCode": "e55cd8ab-09f3-26b7-00df-27e3642f5b79"
                            }
                        ],
                        "type": "SKU",
                        "vat": "NO_VAT"
                    }
                ],
                "vat": "NO_VAT"
            },
            "success": true,
            "variantsResult": [
                {
                    "productId": "BATCH2501",
                    "success": true,
                    "variantId": "BATCH2501"
                }
            ]
        },
        {
            "id": "BATCH2502",
            "product": {
                "available": true,
                "collections": [
                    "1001"
                ],
                "deleted": false,
                "id": "BATCH2502",
                "shortName": "BATCH2502",
                "type": "SKU",
                "useBatchAccounting": false,
                "variants": [
                    {
                        "barcodes": [
                            {
                                "isDefault": true,
                                "type": "COMMON",
                                "value": "bc6869740"
                            }
                        ],
                        "id": "BATCH2502",
                        "isFfPhysicalSetSynchronized": false,
                        "isFfSynchronised": true,
                        "isPhysicalSet": false,
                        "ordering": "1976406.000000000000000",
                        "stock": [
                            {
                                "stockAvailable": 0,
                                "stockDefective": 0,
                                "stockDefectiveReserved": 0,
                                "stockReserved": 0,
                                "stockTotal": 0,
                                "warehouseCode": "5cb8dd66-836d-6c1a-a84b-e71fcf97104c"
                            },
                            {
                                "stockAvailable": 0,
                                "stockDefective": 0,
                                "stockDefectiveReserved": 0,
                                "stockReserved": 0,
                                "stockTotal": 0,
                                "warehouseCode": "e55cd8ab-09f3-26b7-00df-27e3642f5b79"
                            }
                        ],
                        "type": "SKU",
                        "vat": "NO_VAT"
                    }
                ],
                "vat": "NO_VAT"
            },
            "success": true,
            "variantsResult": [
                {
                    "productId": "BATCH2502",
                    "success": true,
                    "variantId": "BATCH2502"
                }
            ]
        }
    ],
    "startTime": "2022-03-29 19:14:47",
    "success": true
}

Пример положительного ответа с ошибкой сохранения:

Пример ответа
{
    "finishTime": "2022-03-29 19:22:30",
    "products": [
        {
            "errors": [
                {
                    "code": 0,
                    "message": "Заданный ID продукта \"№BATCH2500\" не соответствует требованиям: ID должен содержать только цифры, латиницу, тире, подчеркивание, #, или точку "
                }
            ],
            "success": false
        },
        {
            "id": "BATCH2501",
            "product": {
                "available": true,
                "collections": [
                    "1001"
                ],
                "deleted": false,
                "id": "BATCH2501",
                "shortName": "BATCH2501",
                "type": "SKU",
                "useBatchAccounting": false,
                "variants": [
                    {
                        "barcodes": [
                            {
                                "isDefault": true,
                                "type": "COMMON",
                                "value": "bc7216735"
                            }
                        ],
                        "id": "BATCH2501",
                        "isFfPhysicalSetSynchronized": false,
                        "isFfSynchronised": true,
                        "isPhysicalSet": false,
                        "ordering": "1976406.000000000000000",
                        "stock": [
                            {
                                "stockAvailable": 0,
                                "stockDefective": 0,
                                "stockDefectiveReserved": 0,
                                "stockReserved": 0,
                                "stockTotal": 0,
                                "warehouseCode": "5cb8dd66-836d-6c1a-a84b-e71fcf97104c"
                            },
                            {
                                "stockAvailable": 0,
                                "stockDefective": 0,
                                "stockDefectiveReserved": 0,
                                "stockReserved": 0,
                                "stockTotal": 0,
                                "warehouseCode": "e55cd8ab-09f3-26b7-00df-27e3642f5b79"
                            }
                        ],
                        "type": "SKU",
                        "vat": "NO_VAT"
                    }
                ],
                "vat": "NO_VAT"
            },
            "success": true,
            "variantsResult": [
                {
                    "productId": "BATCH2501",
                    "success": true,
                    "variantId": "BATCH2501"
                }
            ]
        },
        {
            "id": "BATCH2502",
            "product": {
                "available": true,
                "collections": [
                    "1001"
                ],
                "deleted": false,
                "id": "BATCH2502",
                "shortName": "BATCH2502",
                "type": "SKU",
                "useBatchAccounting": false,
                "variants": [
                    {
                        "barcodes": [
                            {
                                "isDefault": true,
                                "type": "COMMON",
                                "value": "bc6271942"
                            }
                        ],
                        "id": "BATCH2502",
                        "isFfPhysicalSetSynchronized": false,
                        "isFfSynchronised": true,
                        "isPhysicalSet": false,
                        "ordering": "1976406.000000000000000",
                        "stock": [
                            {
                                "stockAvailable": 0,
                                "stockDefective": 0,
                                "stockDefectiveReserved": 0,
                                "stockReserved": 0,
                                "stockTotal": 0,
                                "warehouseCode": "5cb8dd66-836d-6c1a-a84b-e71fcf97104c"
                            },
                            {
                                "stockAvailable": 0,
                                "stockDefective": 0,
                                "stockDefectiveReserved": 0,
                                "stockReserved": 0,
                                "stockTotal": 0,
                                "warehouseCode": "e55cd8ab-09f3-26b7-00df-27e3642f5b79"
                            }
                        ],
                        "type": "SKU",
                        "vat": "NO_VAT"
                    }
                ],
                "vat": "NO_VAT"
            },
            "success": true,
            "variantsResult": [
                {
                    "errors": [
                        {
                            "code": 0,
                            "message": "Штрихкод bc7216735 уже используются в варианте [BATCH2501] BATCH2501, ШК: bc7216735 "
                        }
                    ],
                    "productId": "BATCH2502",
                    "success": false,
                    "variantId": "BATCH2502"
                }
            ]
        }
    ],
    "startTime": "2022-03-29 19:22:30",
    "success": true
}

 

Обновление отдельных полей нескольких продуктов (PATCH /api/lite/products/batch)

/api/lite/products/batch

Обновляет одно или несколько полей продукта, значения отсутствующих в запросе полей при этом не изменяются.

Тело запроса аналогично POST /api/lite/products/batch

id - необходимо указывать обязательно

Пример вызова:

Пример запроса
{
	"products":[
		{
			"id":"1015",
			"shortName":"Limited Edition Паста (помада) для укладки волос",
			"internationalDescription":"abc"
		},
      	{
			"id":"1016",
			"shortName":"Товар 2"
		}
	]
}

ответ аналогичен POST /api/lite/products/batch