To support changes to item availability, Deliverect can receive an inventory file.
Purpose
The method to transfer an Inventory CSV file allows the following;
- Defining product ranging per Location / Location_Group
- Defining pricing strategy per Location / Location_Group and Channel
- Updating stock count per Location
- Updating stock status (
IN_STOCK
/OUT_OF_STOCK
)
Method
To process Inventory updates, a two step process is required to first request a signed URL via Google Cloud Services (GCS) to then submit a CSV file of Inventory data via PUT request.
1.Request a Signed URL
Sending a request to this endpoint with a callbackUrl
will return a signedUrl
from GCS with specific headers.
2.Submit .csv file via PUT Request
Once a signedUrl
is retrieved, the Inventory update process is as follows;
- Your Inventory .csv file should be submitted via a PUT request to the
signedUrl
with all the headers provided - Deliverect will then process the CSV asynchronously and callback to the provided
callbackUrl
when the CSV file has been fully processed.
Please ensure that all the headers returned from the signed URL request are included within the PUT request
Example PUT Request
curl -X PUT \\
-H "Content-Type: text/csv" \\
-H "X-goog-meta-callback: https://example.com/inventoryCallback"
--upload-file inventory.csv \\
'https://storage.googleapis.com/cicd-signed-url/inventory.csv?x-goog-signature=13d**5b3&x-goog-algorithm=GOOG4-RSA-SHA256&x-goog-credential=signed-url-poc%40test-demo-410111.iam.gserviceaccount.com%2F20240223%2Fasia-south1%2Fstorage%2Fgoog4_request&x-goog-date=20240223T080312Z&x-goog-expires=86400&x-goog-signedheaders=content-type%3Bhost'
Callback Response
{
"file_id": "a420*******************************725b",
"status": "success"
}
{
"file_id": "d0f7*******************************d278",
"status": "error",
"errors":
[
"No products found in the file. Please check the file and try again."
]
}
Glossary
Parameter | Description |
---|---|
callbackUrl | An optional URL where we'll send a completion event when Inventory CSV is fully imported |
signedUrl | Once the signed URL is created, it is valid for 15 minutes. This means that you have up to 15 minutes to initiate an upload via POST of the CSV to this endpoint. For more information please read: https://cloud.google.com/storage/docs/access-control/signed-urls |
fileId | Included in the callbackUrl as a unique identifier to the inventory upload request |
Inventory .csv Format
Depending on the use case and requirements for e.g. price specificity per channel, one of the following formats can be used;
Each file transferred can include complete or partial updates to products in one or more location or location groups.
1. Location File
2.Location Group File
3.Channel Specific File
Inventory .csv Glossary
Please note that all the fields marked with * are required.
Column Header | Description | Type |
---|---|---|
Location * | A single retail store referenced by it's name e.g. 'Central Station Store' | String |
Location Group | As alternative to a single retail store, location groups can reference a tag assigned as in guide here) | String |
PLU * | Unique identifier of a product | String |
Channel | The ordering platform can be specified to assign unique pricing, status or stock status | String |
Aisle | A reference to the store planogram where the specific item is located | String |
Price | The price set at the level of specificity of Location or Location Group or Channel (where empty, the "Base Price" imported via Items file will be used) e.g. if the item's price is 1€, input 1 | Float |
Status | A status of | Enum |
Stock | Current stock quantity of an item | Integer |
Stock Status | Marking | String |