There a 2 ways in which the inventory count for a product can be updated and below we’ll describe both, presenting the advantages and disadvantages of using them.

1. Full inventory flow via dedicated features.

The first solution is what we recommend for the majority of use cases and definitely for all the stores where Vend is the source of truth for all the inventory and cost information. To achieve this, all inventory adjustments should be done by using the dedicated functions. E.g. e-commerce orders coming from another system should be submitted as sales, supplier deliveries should be logged as stock orders (consignments with type SUPPLIER) and manual adjustments should be performed with inventory counts. This approach ensures that the product will have a consistent history where all changes can be attributed to specific operations. It enables accurate inventory cost and discrepancy reporting as well as correct margin calculations for sales reports.

2. Direct update on the product.

The second way works by directly modifying the inventory record associated with the product. It’s important to note that while this solution is much easier to implement it has some serious drawbacks in terms of data consistency. First of all, when used, it will create very non-specific product history records. Secondly, using this method will adversely affect the attributed cost information for the product.

Update request

In order to update the count for a specific product in a particular outlet a POST request can be made to the /api/products endpoint with the following payload:

{
	"id": "dc85058a-a683-11e5-ef46-09c76a469811",
	"inventory": [{
		"outlet_id": "b8ca3a65-0183-11e4-fbb5-2816d2677218",
		"count": 21,
		"reorder_point": 5,
		"restock_level": 10
	}]
}

It is also possible to change just the count value by sending a payload like:

{
	"id": "dc85058a-a683-11e5-ef46-09c76a469811",
	"inventory": [{
		"outlet_id": "b8ca3a65-0183-11e4-fbb5-2816d2677218",
		"count": 21
	}]
}

WARNING: It is important to note that using a payload where reorder_point and restock_level are included in the payload but have null values, will set those values to an empty string. If it’s important to preserve the original value for those attributes, they should be either submitted in the payload with the value or omitted completely in the request.