Stock change example

Creating a Batch Stock Change Using the Inventory Variance API

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 Requests

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 facilities and products we would like to use in our order and shipment(s). Let's 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).

Let's 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".

Batch Stock Change Request

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.

Explanation of Fields

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.