This example will cover creating a batch stock change using the Inventory Variance API.

Replace "newcentury" with your own accountPathComponent

Creating a batch stock change through the API can be done with a single request. This allows you to add or subtract stock for any number of products.

We need to make sure we have an account with products and facilities. We will be using the fields productUrl and facilityUrl fairly extensively in our example. A full list of the products and facilities available for your specific account can be found by running the GET requests below against our API endpoints for facility and product (For larger accounts, this may take some time):

curl https://app.finaleinventory.com/newcentury/api/facility --header 'authorization: Basic XXX'
curl https://app.finaleinventory.com/newcentury/api/product --header 'authorization: Basic XXX'

From these lists, we can pick the facilites and products we would like to use in our order and shipment(s). Lets assume our productUrl is "/newcentury/api/product/100000" and our facilityUrl is "/newcentury/api/facility/100001" for our location (see facilities for more details on the difference between magazine and location).

Lets go ahead and make a batch stock change request to the Finale API, with the date "2018-04-30", in the committed state, adding a +4 variance to the product "/newcentury/api/product/100000" at location "/newcentury/api/facility/100001".

curl --request POST \
     --url https://app.finaleinventory.com/newcentury/api/inventoryvariance \
     --header 'authorization: Basic XXX' \
     --data '{"physicalInventoryDate":"2018-04-30T19:00:00.000","statusId":"PHSCL_INV_COMMITTED","physicalInventoryTypeId":"FACILITY","facilityUrl":"/newcentury/api/facility/100001","inventoryItemVarianceList":[{"productUrl":"/newcentury/api/product/100000","facilityUrl":"/newcentury/api/facility/100001","quantityOnHandVar":10}]}'

Finale responds with

{  
  "physicalInventoryId":"100002",  
  "physicalInventoryUrl":"/newcentury/api/inventoryvariance/100002",  
  "physicalInventoryTypeId":"FACILITY",  
  "physicalInventoryDate":"2018-04-03T19:00:00",  
  "statusId":"PHSCL_INV_COMMITTED",  
  "facilityUrl":"/newcentury/api/facility/100001",  
  "lastUpdatedDate":"2018-05-03T17:39:25",  
  "createdDate":"2018-05-03T17:39:25",  
  "actionUrlCancel":"/newcentury/api/inventoryvariance/100002/cancel",  
  "contentList":[],  
  "inventoryItemVarianceList":[  
    {  
      "facilityUrl":"/newcentury/api/facility/100001",  
      "productId":"100000",  
      "productUrl":"/newcentury/api/product/100000",  
      "quantityOnHandVar":10  
    }  
  ],  
  "statusIdHistoryList":[{"statusId":"PHSCL_INV_COMMITTED","txStamp":1525369165,"userLoginUrl":"/newcentury/api/userlogin/test"}],  
  "invalidations":["/newcentury/api/inventoryvariancesummary/","/newcentury/api/inventoryitem/"],
}

To explain what we did, there are several fields involved in a request to the Inventory Variance api.

physicalInventoryDate: we have to pick a date that our inventory will be applied to. This is in a datetime format, but should always be at 19:00 hours. This will ensure that the inventory variance applies consistently with other variances entered in the Finale web application.

statusId: this is the status that our variance will be in. There are several statuses, but we suggest that any API inventory variances be set in "PHSCL_INV_COMMITTED" so that it immediately applies to your inventory and is closed.

phsyicalInventoryTypeId: for batch stock changes, this should always be set to "FACILITY".

inventoryItemVarianceList: the actual meat of our batch stock transfer, this will incidate the product, facility, and quantity variance that the batch stock change will make. The fields available per variance item are: facilityUrl, productUrl, quantityOnHandVar, productId, normalizedPackingString, shipmentBoxTypeId, and lotId. Fields marked with an asterisk are required.

The Finale web application also makes use of quantityOnHandCount, but this field is not calculated or used in setting the stock level.

This variance is applied directly to the quantity on hand stock for the identified product.