Product Inventory

[base module url]/product_inventory

The product inventory endpoint serves as the place to quickly get/update product inventory data. As it serves a more constrained purpose, it is more streamlined for product inventory management purposes and with more finite data points, allows more records to be returned.

Please note that name, model, sku and upc are not forced to be unique values in the system. Depending on how the admin configured their products, there may be multiple products for those values ( however id will always be unique ).

Sort parameters ( ?sort=param,param,etc )

Default: -id

Boolean sort behavior will sort as integer 0/1 respectively for false/true for purposes of sort order ( asc/desc )

ParameterInfoAsc/Desc
id id number Y
name product name (string) Y
model (string) Y
sku (string) Y
upc (string) Y
num_in_stock number of items in stock (integer) Y
track_stock stock tracking enabled on this product (boolean) Y


Filter parameters ( ?parameter=value&parameter=value&etc )

Default: none

ParameterInfo
page Sets the current page to retrieve ( returned in sets of 100 )
id id number. When used it will filter to >= provided id
name product name (string)
model (string)
manufacturer (string)
sku (string)
upc (string)
active when true will only show active products (boolean - true/false)
track_stock when true will only show products with stock tracking enabled (boolean - true/false)

Please note that name, model, sku and upc are not forced to be unique values in the system.



Sample Response

The "next_page" will contain an integer for the next page number to retrieve the next set of results using ?page. If "next_page" is false, there are no more pages of results to retrieve

{
    "product_inventory": [
        {
            "id": "16918",
            "name": "Product Name",
            "model": "G6",
            "sku": "12ag",
            "upc": "123456",
            "manufacturer": "Acme Corp",
            "active": true,
            "track_stock": true,
            "num_in_stock": 3,
            "starting_stock": 0,
            "low_stock": 0
        },
        .....
    ],
    "next_page": false
}

Product Inventory Update

[base module url]/product_inventory

Product inventory updates are done in batch ( multiple products can be updated per call, up to 100 per call ). You should post a json body in the sample request format below in order to update product inventory.

Product lookup

The system will use the provided product identity fields to lookup the product to be updated. The first lookup field ( in order of precedence in the table below ) will be used as the sole lookup field for product updating. For example, if you provide id and model on a product inventory update object then only the id will be used to lookup the product. If you provide upc and sku, only the upc will be used. If you provide just sku, any products that match that sku will be updated to the provided inventory information.

FieldInfo
id unique matches only one product
upc may match multiple (string)
sku may match multiple (string)
name may match multiple (string)
model may match multiple (string)

Product inventory fields

You  must at least provide one product inventory related field in order for the system to update the product ( otherwise that object is skipped ). You do not need to provide all the fields, any fields that are provided will be updated ( and subsequently any fields that are not provided will be left at their current value in the database ). Only the below fields are updated through this endpoint, any other field provided will be disregarded as far as product update information.

FieldInfo
track_stock enables/disables stock tracking on this product ( boolean - true/false )
num_in_stock current number in stock for this product (integer)
starting_stock starting stock for this product (integer). The desired amount of stock to be held, used to indicate overstock on products if num__in_stock is greater than this figure
low_stock low stock figure for this product (integer). Indicator that the product is understocked when num_in_stock falls below this figure

Sample Request

If more than 100 products are provided in a single call, only the first 100 will be processed, any additional products will be skipped and an error will be returned in the response.

{
    "product_inventory": [
        {
            "id": 15355,
            "num_in_stock": 4
        },
        {
            "model": "12v20ah",
            "track_stock": true,
            "num_in_stock": 2
        },
        {
            "sku": "late",
            "num_in_stock": 1
        },
        {
            "upc": "upcupc",
            "track_stock": true,
            "num_in_stock": 1,
            "starting_stock": 3
        }
    ]
}

Sample Response

The num_records_updated field contains the number of products that were updated. If you provided 100 products in the request and only 90 were updated, this means that not all of your lookups matched up to existing products in the database. If you provided 100 products in the request and 120 products were updated, this means that there were some product lookup fields that matched up to multiple products in the database.

{
    "num_records_updated": 4
}