XM

Bulk Insert

Path:

POST https://{baseurl}/inventory/bulk-insert

Enables you to maintain your inventory up-to-date by facilitating bulk add or update action to the inventory. You may add one or multiple items to the inventory or update one or multiple existing items in the inventory. To check the current stock of items, the Retrieve Inventory for Multiple Items API is recommended. And, to check stock level of a single item, the Retrieve Inventory of Single Item API is recommended."

Headers

Content-Type : application/json

x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }

Parameters

Type: Body

Name: The item details to be added/updated to the inventory.

Required: true

Sample Request

[
{
"sku": "123456",
"totalQuantity": 30003,
"reservedQuantity":0,
"locationId": 104,
"type": "Stock",
"channelId": 12
},
{
"itemId": "1000000213",
"totalQuantity": 10000,
"reservedQuantity":0,
"locationId": 104,
"type": "Transit",
"channelId": 12,
"transitOrderDate": "2020-05-05",
"transitStockDate": "2020-05-05",
"transitRef": "WO-20000"
}
]

SampleResponse

Response Code: 200

Message: OK

Description: You will see this message when the inventory is successfully updated.

{
"_id": "5fa087827899ae0007ce1ff0",
"messages": [
"Import Inventory job started: Mon Nov 02 2020 22:26:10 GMT+0000 (Coordinated Universal Time)",
"2 row(s) found",
"1 Inventory Item(s) found",
"Successfully saved 1 items ",
"Successfully finished API Inventory Bulk Upload: Mon Nov 02 2020 22:26:10 GMT+0000 (Coordinated Universal Time)"
],
"keyId": "api-1604355970096",
"type": "api",
"status": "FINISHED",
"totalItems": 1,
"totalItemsUploaded": 1,
"totalRows": 2,
"totalRowsErrors": 0,
"createdAt": "2020-11-02T22:26:10.175Z",
"updatedAt": "2020-11-02T22:26:10.448Z",
"__v": 0
}

Response Code: 400

Message: Bad Request

Description: You will see this message when the location ID doesn't exist in the system.

Sample

{
"code": "INVENTORY_INSERT_FAILED",
"message": "Inventory insert failed: Row 1: Cannot find \"Location Id\" 999."
}

Error Code: 500

Message: Internal Server Error

Description: You will see this error when the account number is incorrect in the x-site-context (for a multi-tenent client).

Change Log

  • June - 2021

  • July - 2020 First updated