HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback


## Get an instance of IInventoryService

Use IInventoryService.GetCacheSkippingInstance(IEnumerable<string>) to get an instance of IInventoryService that skips the cache on reads.



## Get a single inventory

Use IInventoryService.Get(string, string) to get a single inventory record for a catalog entry and a warehouse.



## List inventories

Use IInventoryService.List() to list information for all inventories.



Use IInventoryService.QueryByEntry(IEnumerable<string>) to list all inventories by entry code.



Use IInventoryService.QueryByEntry(IEnumerable<string>, int, int, out int) to list all inventories by entry code in a specified range.



Use IInventoryService.QueryByWarehouse(IEnumerable<string>) to list all inventories by warehouse code.



Use IInventoryService.QueryByWarehouse(IEnumerable<string>, int, int, out int) to list all inventories by warehouse code in a specified range.



Use IInventoryService.QueryByPartialKey(IEnumerable<InventoryKey>) to list all inventories matching an item in an inventory key.



Use IInventoryService.QueryByPartialKey(IEnumerable<InventoryKey>, int, int, out int) to list all inventories matching an item in an inventory key in a specified range.



## Request a transactional inventory operation

Use IInventoryService.Request(InventoryRequest request) to request a transactional inventory operation.



## Update inventories

Use IInventoryService.Save(IEnumerable<InventoryRecord>) to save specified inventory records. Records are matched to existing records on InventoryRecord.CatalogEntryCode or  InventoryRecord.WarehouseCode values, and are updated if a match is found, and inserted if no match is found.



Use IInventoryService.Insert(IEnumerable<InventoryRecord>) to insert the specified inventory records. An exception is thrown if any records exist with matching InventoryRecord.CatalogEntryCode and InventoryRecord.WarehouseCode values.



Use IInventoryService.Update(IEnumerable<InventoryRecord>) to update the specified inventory records. Records are matched to existing records on InventoryRecord.CatalogEntryCode and InventoryRecord.WarehouseCode values. And, an exception is thrown for any records that do not match.



Use IInventoryService.Delete(IEnumerable<InventoryKey>) to delete all specified inventory data.



Use IInventoryService.Adjust(IEnumerable<InventoryChange>) to increment or decrement matching values in the inventory provider. Elements of changes are matched to existing data by item and warehouse code, and each quantity in the InventoryService.InventoryChange is added to the corresponding quantity in the inventory provider.



Use IInventoryService.DeleteByEntry(IEnumerable<string>) to delete all inventory data for specified catalog entries.



Use IInventoryService.DeleteByWarehouse(IEnumerable<string>) to delete all inventory data for specified warehouses.



## List warehouses

Use IWarehouseRepository.List() to list information for all warehouses.



## Get a warehouse

Use IWarehouseRepository.Get() to get a single warehouse. You can get a warehouse by **ID** or by **Code**.




## Save a warehouse

Use IWarehouseRepository.Save(IWarehouse) to add/edit and save a warehouse.

Note

The IWarehouse object returned from Get and List methods above IWarehouseRepository is read-only. To edit it, you must make a writable clone object then update it, as is.



\*\*\*\*:

Note

For Commerce 12 or higher, you can improve the UpdateWarehouse section of the above code like this:



## Delete a warehouse

Use IWarehouseRepository.Delete(int) to delete a warehouse.