Inventory Batch API
Author:
Fluent Commerce
Changed on:
3 July 2024
Overview
A batch contains a series of records that will have the same operation applied to it. All batches are run asynchronously as such the client will be required to request a status update for entered batches. A batch can include a maximum of 5000 records.
To create a Batch, the user must first create a Job. A job is required to store a series of batches. For more information please refer to the Job API.
Key points
- Overview
- Inventory Batch Properties
- What you can do with Inventory Batch
- Response on Failures
Inventory Batch API
Inventory Batch Properties
Below are the properties available in the Inventory Batch object which can be updated and retrieved through the APIs in this document.
1. jobId
Type: String
1{ "jobId" : "223" }
Language: json
Name: Description
Description:
[Warning: empty required content area]The unique identifier associated with the Job.
2. action
Type: String
1{ "action": "UPSERT" }
Language: json
Name: Description
Description:
[Warning: empty required content area]The type of operation that will be applied to all records in the batch. Possible values are UPSERT.
- UPSERT: Insert the record. If the record already exists then update existing record.
3. entityType
Type: String
1{ "entityType" : "INVENTORY" }
Language: json
Name: Description
Description:
[Warning: empty required content area]Entity type. Possible values are INVENTORY.
4. entities
Type: Array
1{ "retailerId" : "197" }
2
3{ "inventoryId" : "56470" }
4
5{ "skuRef" : "29SPM0020X96-1-8" }
6
7{ "locationRef" : "158" }
8
9{ "qty" : "10" }
10
11{ "correctedQty" : "2" }
12
13{ "reservedQty" : "2" }
Language: java
Name: Description
Description:
[Warning: empty required content area]An array of InventoryPost records
- retailerId(string) : The retailer identifier assigned by Fluent Commerce.
- inventoryId (string) : The unique identifier assigned by Fluent Commerce.
- skuRef (string) : The unique reference or code provided by the retailer.
- locationRef (string) : The location (i.e. store) number.
- qty (integer) : The stock on hand.
- correctedQty (integer) : Correction quantity based on stock updates.
- reservedQty (integer) : Quantity reserved due to unfulfilled orders.
5. status
Type: String
1{ "status" : "RUNNING" }
Language: json
Name: Description
Description:
[Warning: empty required content area]The state of the batch:
- PENDING - Batch has been entered but is not currently running
- RUNNING - Batch is being processed
- COMPLETE - Batch has been processed ( with or without errors )
6. responseCode
Type: -
Description: HTTP response code.
What you can do with Inventory Batch
Create a Batch
Create a Batch in the Fluent Retail System
POST:
`/api/v4.1/job/{jobid}/batch`
Request and response
Request parameters and sample
1batchRequest {
2 action (string, compulsory) = UPSERT,
3 entityType (string, compulsory) = INVENTORY,
4 entities (array, compulsory)
5}
Language: java
Name: Example request
Description:
[Warning: empty required content area]1 InventoryPost {
2 retailerId (string, compulsory),
3 inventoryId (string, optional),
4 skuRef (string, compulsory),
5 locationRef (string, compulsory),
6 qty (integer, compulsory)
7 correctedQty (integer, optional)
8 reservedQty (integer, optional)
9 }
Language: java
Name: entities
Description:
[Warning: empty required content area]1{
2"action": "UPSERT",
3"entityType": "INVENTORY",
4"entities": [
5{
6"locationRef": "158",
7"qty": 10,
8"correctedQty": 11,
9"reservedQty" : 12,
10"skuRef": "29SPM0020X96-1-8",
11"retailerId": 197
12}
13]
14}
Language: java
Name: Example request
Description:
[Warning: empty required content area]Response Parameters and sample
1SuccessMessageResponse {
2
3 id (object, optional),
4 message (string, optional),
5 status (string, optional)
6}
Language: java
Name: Batch response
Description:
[Warning: empty required content area]1{
2 "id":"427323"
3}
Language: javascript
Name: Example response
Description:
[Warning: empty required content area]View a Batch
Retrieve details of the Batch.
GET:
`/api/v4.1/job/{jobid}/batch/{batchId}`
Request and response
Request parameters and sample
Batch request
`/api/v4.1/job/{jobid}/batch/{batchId}`
Example request
`/api/v4.1/job/223/batch/299`
Response Parameters and sample
1batchResponse {
2 batchId (string),
3 entityType (string) = 'INVENTORY',
4 status (string) = 'PENDING', 'RUNNING', 'COMPLETE',
5 start (integer),
6 count (integer),
7 total (integer),
8 results (array[batchRecordStatus]):[
9 {
10 entityId (string),
11 entityRef (string),
12 responseCode (string) = '200', '404', '500', '401'
13 message (string)
14 }
15 ]
16}
Language: java
Name: Batch response
Description:
[Warning: empty required content area]1{
2"batchId": "300",
3"entityType": "INVENTORY",
4"status": "COMPLETE",
5"start": 1,
6"count": 10,
7"total": 1,
8"results": [
9{
10"entityId": "1013187",
11"entityRef": null,
12"responseCode": 200,
13"message": "Inventory Created."
14}
15]
16}
Language: json
Name: Example response
Description:
[Warning: empty required content area]Response on Failures
NAME | TYPE | DESCRIPTION |
error | Array | Array of errors |
message | String | Additional information on the code Unauthorised | Bad Request | Forbidden | Not Found | Status 500 Error |
code | String | Status Code for the above messages 401 | 400 | 403 | 404 | 500 |