Fluent Commerce Logo
Docs
Sign In

How to use Inventory Batches with Attributes

Topic

Author:

Fluent Commerce

Changed on:

18 Sept 2024

Overview

A topic on how to run Inventory Batches in the OMS. 

Inventory Batches - Introduction

Author:

Fluent Commerce

Changed on:

18 Sept 2024

Overview

An Inventory Batch is a bulk upload of Inventory Updates. These will typically range from 10,000 updates to in excess of 1 million inventory updates. By using the Batch API , you are able to leverage Fluent Big Inventory's ability to scale, enabling increased speed of inventory processing and more accurate inventory availability.

Key points

  • In what use cases can you use Inventory Batches
  • Capabilities of the platform this process uses
  • Supplementary guides

In what use cases can you use Inventory Batches

The primary use cases you should be using Inventory Batches:

  • Sending periodic updates of stock from the Inventory source of truth; in typical architectures, this will be an ERP that has collected all Inventory Updates during the last cycle (typically daily).
  • Informing the OMS of the latest stocktake ensures that the OMS is aware of any changes that may have been manually handled, e.g., missing or damaged stock.

Capabilities of the platform this process uses

After using this document, you will be able to run an Inventory Batch. If you need to extend or build on this document's capabilities, the below pages will link to the core capabilities used.

Capability

Description

Job API

API to create & manage batch loading of information

Send Inventory Batches With Attributes

Author:

Fluent Commerce

Changed on:

18 Sept 2024

Key Points

  • A step-by-step guide on how to send inventory batches into OMS with additional attributes

Steps

Step arrow right iconAPI Authentication

Authenticate against the Retailer you are sending the Inventory Batch to 

Please follow the Authentication API page for how to Authenticate against a Retailer.

The returned token will be used to authenticate all the following API calls.

Step arrow right iconSet Up a New Job to Execute Your Batches

Using the Job API you can create a new Batch Job.

1{
2    "name": "Batch Inventory Job",
3    "retailerId": "{{retailer.id}}"
4} 

Language: json

Name: Example payload

Description:

[Warning: empty required content area]
1{
2    "id": "199"
3}

Language: json

Name: Example response

Description:

[Warning: empty required content area]

This id number is the Job id which has been created, save this id as we will use it in the following requests for sending a Batch. This Job id and the created Job will be used to group subsequent Batches together.

Step arrow right iconCreate and send a new Inventory Batch

Using the Job API you can create an Inventory Batch to be processed under the previously created Job.

The URL is using the Job id returned by the last API call, for example 199 as per the previous response.

1{
2    "action": "UPSERT",
3    "entityType": "INVENTORY",
4    "source": "SAP-ERP",
5    "event" :"InventoryChanged",
6    "entities": [
7        {
8            "locationRef": "LOC1",
9            "skuRef": "SKU1",
10            "qty": 1534567,
11            "correctedQty": 0,
12            "retailerId": 2,
13            "attributes": {
14                "key1": "value1",
15                "complexJsonObject": {
16                    "keyA": "valueA",
17                    "keyB": [
18                        "B",
19                        "B1"
20                    ]
21                },
22                "expectedOn": "2024-10-31T00:00:00.00Z",
23                "storageAreaRef": "LOC-1",
24                "condition": "NEW"
25            }
26        }
27    ]
28}

Language: json

Name: Example payload

Description:

[Warning: empty required content area]

Field Name

Example Value

Mandatory/Optional

Notes

action

"UPSERT"

Mandatory

Indicates the action being performed is an "UPSERT"

entityType

"INVENTORY"

Mandatory

Specifies the type of entity being affected. In this case, it's related to inventory data.

source

"SAP-ERP"

Optional

Represents the source of the data integration. This helps identify where the data is coming from, which is available in the sources dashboard.

event

"InventoryChanged"

Optional

Indicates the specific event related to the inventory workflow, used to target a specific ruleset within the default catalog.

locationRef

"LOC1"

Mandatory

A reference identifier for the location of the inventory item.

skuRef

"SKU1"

Mandatory

A reference identifier for the stock-keeping unit (SKU) of the inventory item.

qty

250

Mandatory

The quantity of the inventory item.

correctedQty

0

Optional

The corrected quantity of the inventory item is used to adjust discrepancies.

retailerId

2

Mandatory

The id of the retailer who is the owner of the corresponding inventory catalogue and workflow. The catalogue is identified using the format

`DEFAULT:{{retailerId}}`
.

attributes

{
 "key1": "value1",
 "complexJsonObject": {
   "keyA": "valueA",
   "keyB": [
     "B",
     "B1"
   ]
 },
 "expectedOn": "2024-10-31T00:00:00.00Z",
 "storageAreaRef": "LOC-1",
 "condition": "NEW"
}

Optional

Attributes can include complex data types such as JSON objects, arrays, booleans, numbers, and strings.
The attributes will be available in the corresponding event, which is processed by the workflow engine.

1{
2  "id": "331"
3}

Language: json

Name: Example response

Description:

[Warning: empty required content area]

The returned id will be used to check the Batch status in a following call. If you needed to send multiple groups of updates you would run this call for each group of Batches that you are running. If you needed to send 15,000 updates, you would run this 3 times for every 5,000 records( for illustration ) , all under the same Job, using the same job ID.

Step arrow right iconCheck Job status

You can use the Job API again to check the status of an existing Job, this will share with you the status of Batches which are part of that Job.

1{
2  "jobId": "199",
3  "status": "OPEN",
4  "batch": [
5    {
6      "batchId": "331",
7      "status": "COMPLETE",
8      "createdOn": "2022-10-06T00:31:08.104+0000"
9    }
10  ],
11  "createdOn": "2022-10-06T00:31:08.104+0000"
12}

Language: json

Name: Example response

Description:

[Warning: empty required content area]

Step arrow right iconCheck Inventory Batch status

You can view the status of a specific Batch as well, this provides a few more details than the previous Job status check.

The URL uses the Job id and the Batch id returned by previous APIs.

1{
2  "batchId": "331",
3  "entityType": "INVENTORY",
4  "status": "COMPLETE",
5  "start": 1,
6  "count": 10,
7  "total": 0,
8  "results": [],
9  "createdOn": "2022-10-06T00:36:09.344+0000"
10}

Language: json

Name: Example response

Description:

[Warning: empty required content area]

How to Implement Enhanced Inventory Attributes in Your Payloads

Author:

Fluent Commerce

Changed on:

18 Sept 2024

Overview

This guide is designed to help you implement the enhanced

`attributes`
functionality in your inventory payloads. The
`attributes`
object is a flexible structure that allows you to include a wide range of key-value pairs, including complex JSON objects and arrays. This flexibility enables you to customize the data according to your specific business needs, whether you are managing detailed product information, handling sophisticated supply chain operations, or integrating with custom workflows.

Key points

  • Flexible Attribute Structure: The
    `attributes`
    object supports any combination of key-value pairs, including complex JSON structures and arrays. This flexibility allows you to customize the data sent in your inventory payloads to meet specific business needs.
  • Recommended Attributes: Certain key attributes, such as
    `expectedOn`
    ,
    `storageAreaRef`
    , and
    `condition`
    , are automatically integrated into our platform’s workflows. These fields will be directly updated in the inventory quantity associated with the incoming record, facilitating seamless integration with existing fields.
  • Custom Attribute Availability: Any custom attributes that you include in the
    `attributes`
    object will be available in workflows via
    `inventoryPosition.inventoryQuantity.attributes.<fieldname>`
    . This enables you to incorporate custom data into rule-based processes or other logic tailored to your business requirements.
  • ISO 8601 Date Format: For any date-related attributes, it is recommended to use the ISO 8601 format (e.g.,
    `YYYY-MM-DDTHH:MM:SSZ`
    ) to ensure consistency and proper handling within the system.
  • Integration with Workflows: The system is designed to handle both recommended and custom attributes, making them accessible within the workflow context. This ensures that you can leverage these attributes in custom rules and other logic, depending on the specific needs of your implementation.
  • Extensibility: While the table of recommended attributes provides a useful starting point, you are encouraged to extend the
    `attributes`
    object with any additional fields relevant to your business processes. The flexibility of this structure allows for robust customization.


Leveraging Recommended Attributes

While the

`attributes`
object gives you the freedom to define and send any custom fields, we recommend using certain key attributes that are optimized for our platform. These recommended fields, such as
`expectedOn`
,
`storageAreaRef`
, and
`condition`
, are automatically integrated into our platform’s inventory management workflows. This means that these fields will be directly updated in the inventory quantity associated with the incoming record, ensuring seamless operation and enhanced performance.

Flexibility for Custom Attributes

Beyond the recommended attributes, you have the flexibility to include additional fields that are specific to your business requirements. Whether you need to send simple key-value pairs, nested JSON structures, or arrays, our system will process these and make them available within the workflow via

`inventoryPosition.inventoryQuantity.attributes.<fieldname>`
. This allows you to incorporate your custom data into rule-based processes or other logic tailored to your specific business scenarios.

The table below provides examples of the recommended attributes along with their descriptions, usage, and examples. However, you are not limited to these fields—you can extend the

`attributes`
object with any custom fields that meet your needs. These will be accessible within the workflow for your custom implementations.

Recommended Attributes Table

Attribute Description

Recommended Attribute Key Name

Example

Notes

Specific storage locations in a warehouse.

Use Case :

Optimizing space utilization, reducing retrieval time, and improving warehouse efficiency.

`storageAreaRef`


"LOC1-SR-1"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.storageAreaRef`
and automatically updated in the inventory quantity associated with the incoming record.

Date when new stock is expected.

Use Case :

Planning for space allocation, staffing, and ensuring timely product availability.

`expectedOn`


"2024-10-31T00:00:00.00Z"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.expectedOn`
and automatically updated in the inventory quantity associated with the incoming record. Recommended date format is ISO 8601.

Information on the manufacturing country.

Use Case :

Compliance with import/export regulations, supporting marketing strategies emphasizing local products.

`countryOfOrigin`



"France"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.countryOfOrigin`
and can be used in custom rules.
Alternate field name for this madeIn 

Details like production date and location.

Use Case :

Tracking production details, quality control, and recall management.

`manufacturingBatchInfo`



{ "batchNumber": "BATCH001", "productionDate": "2024-01-15T00:00:00.00Z" }

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.manufacturingBatchInfo`
and can be used in custom rules. Production date should be in ISO 8601 format.

Indicates the last date a product is safe to use.

Use Case :

Managing stock rotation, reducing waste, and ensuring compliance with health and safety regulations.

`expiryDate`


"2025-12-31T23:59:59.00Z"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.expiryDate`
and can be used in custom rules. Recommended date format is ISO 8601.

Unique identifier for each supplier.

Use Case :

Tracking supplier performance, managing vendor relationships, and optimizing supply chain efficiency.

`supplierId`


"SUP12345"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.supplierId`
and can be used in custom rules.

Details on how inventory is quantified.

Use Case:

Ensure consistency in inventory counting, aid in order fulfillment, and simplify stocktaking processes.

`unitOfMeasurement`



"PCS"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.unitOfMeasurement`
and can be used in custom rules.

Unique identifier for high-value items.

Use Case:

Tracking individual items, managing warranties, and enhancing theft prevention.

`serialNumber`


"SN123456789"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.serialNumber`
and can be used in custom rules.

Links inventory to specific purchase orders.

Use Case:

Matching received goods with purchase orders, improving procurement tracking, and enhancing order accuracy.

`purchaseOrderNumber`


"PO987654321"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.purchaseOrderNumber`
and can be used in custom rules.

Source of inventory transfer.

Use Case:

Tracking inventory movement between locations for internal auditing.

`transferFrom`


"STORE01"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.transferFrom`
and can be used in custom rules.

Purpose of the inventory.

Use Case:

Differentiating stock based on its intended use, aiding in inventory accounting and management.

`inventoryPurpose`


"For Sale"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.inventoryPurpose`
and can be used in custom rules.

Indicates the condition of the inventory item.

Use Case:

Managing inventory condition, enabling categorization of items for different sales channels.

`condition`


"NEW"

Available in the workflow via

`inventoryPosition.inventoryQuantity.attributes.condition `
and automatically updated in the inventory quantity associated with the incoming record.


Example payload with enhanced inventory payload via Batch API ( BPP enabled)

1{
2    "action": "UPSERT",
3    "entityType": "INVENTORY",
4    "source": "SAP_ERP",
5    "event" :"InventoryChanged",
6    "entities": [
7        {
8            "locationRef": "LOC_MEL",
9            "skuRef": "D45",
10            "qty": 350,
11            "correctedQty": 0,
12            "retailerId": 2,
13            "attributes": {
14                "expectedOn": "2024-10-31T00:00:00.00Z", // ISO 8601 format
15                "storageAreaRef": "LOC_MELB_RET2-SR1",
16                "condition": "NEW",
17                "countryOfOrigin": "China",
18                "expiryDate": "2025-12-31T23:59:59.00Z", // ISO 8601 format
19                "supplierId": "SUP12345",
20                "unitOfMeasurement": "PCS",
21                "serialNumber": "SN123456789",
22                "purchaseOrderNumber": "PO987654321",
23                "transferFrom": "STORE01",
24                "inventoryPurpose": "For Sale",
25                "manufacturingBatchInfo": {
26                    "batchNumber": "BATCH001",
27                    "productionDate": "2024-01-15T00:00:00.00Z" // ISO 8601 format
28                }
29                    }
30
31            }
32        
33    ]
34}

Language: json

Name: Example payload with enhanced inventory payload via Batch API

Description:

Example payload with enhanced inventory payload via Batch API


Example payload with enhanced inventory payload for direct updates via INVENTORY_UPDATE event

1
2{
3  "name": "INVENTORY_UPDATE",
4  "accountId": "YOUR_ACCOUNT",
5  "retailerId": "1",
6  "entityRef": "DEFAULT:2",
7  "entityType": "INVENTORY_CATALOGUE",
8  "entitySubtype": "DEFAULT",
9  "rootEntityType": "INVENTORY_CATALOGUE",
10  "rootEntityRef": "DEFAULT:2",
11  "attributes": 
12    { 
13      "inventoryUpdates": 
14      [ 
15        { 
16          "ref" : "testref1",
17          "productRef": "D45",
18          "locationRef": "LOC_MEL",
19          "qty": 350,
20          "correctedQty":0,
21          "type":"DEFAULT" ,
22          "inventoryQuantity": {
23             "attributes": {
24                "expectedOn": "2024-10-31T00:00:00.00Z", // ISO 8601 format
25                "storageAreaRef": "LOC_MELB_RET2-SR1",
26                "condition": "NEW",
27                "countryOfOrigin": "China",
28                "expiryDate": "2025-12-31T23:59:59.00Z", // ISO 8601 format
29                "supplierId": "SUP12345",
30                "unitOfMeasurement": "PCS",
31                "serialNumber": "SN123456789",
32                "purchaseOrderNumber": "PO987654321",
33                "transferFrom": "STORE01",
34                "inventoryPurpose": "For Sale",
35                "manufacturingBatchInfo": {
36                    "batchNumber": "BATCH001",
37                    "productionDate": "2024-01-15T00:00:00.00Z" // ISO 8601 format
38                }
39                    }
40        } 
41      ]
42    }
43}

Language: json

Name: Example payload with enhanced payload for direct updates via INVENTORY_UPDATE event

Description:

Example payload with enhanced payload for direct updates via INVENTORY_UPDATE event

Inventory Data Integration Guidelines

Author:

Fluent Commerce

Changed on:

18 Sept 2024

Overview

Integration Guidelines for Sending Inventory Data with Attributes


Key points

  • A number of factors need to be considered in order to create a successful Inventory run:
    • Size of Batch files
    • Batch Item size
    • Attributes in Inventory Data
    • What to do if the number of updates is too small
    • Visibility of successful Batch processing 

Inventory Data Integration Guidelines

When sending inventory data to the batch endpoint with BPP enabled, please adhere to the following guidelines to ensure successful processing:

Batch Size Limits:

  • Each batch of inventory data must not exceed 10MB in total size.
  • You can include up to 1,000 items per batch if each item is 10KB in size.

Batch Item Size:

  • It is recommended that each individual batch item be a maximum of 10KB in size, including both the fixed part of the payload and any key-value pairs of attributes.

Attributes in Inventory Data:

  • Attributes can include complex data types such as JSON objects, arrays, booleans, numbers, and strings.
  • While there is no specific limit on the number of attributes, we recommend including only relevant data and keeping the size of attributes as small as possible to ensure more efficient processing.

General Structure:

  • Ensure that the fixed part of the payload (e.g., 
    `locationRef`
    `skuRef`
    `qty`
    `correctedQty`
    `retailerId`
    ) is included as required.
  • The remaining size, after accounting for the fixed part, should be allocated to the attributes.

Encoding:

  • Use UTF-8 encoding for all data. Standard ASCII characters are recommended to optimize space.

Visibility of successful Batch processing

The current best tool for visibility is to use the orchestration_audit events to understand the success and failures of Inventory Updates sent via batch. This provides visibility into the individual items included in the Batches.

Note: Right now, only Failures & Exception audit events are visible for Inventory.

Supplementary guides

After you have followed this guide and understand how to use Inventory Batches, we suggest reading a few more guides to enhance the usability of your Inventory implementation.

Guide

Description

How to use Direct Inventory updates

Learn how to send Inventory Updates via events

How to send Delta Inventory updates

Learn how to send delta inventory updates via events

Fluent Commerce

Fluent Commerce

Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.

Fluent Logo