Importing order and inventory data
This document is intended for merchants and System Integrator (SI) partners who want to migrate or import inventory and order data.
Prerequisites
- Ensure that you have Orders & Inventory Editor or Administrator privileges to fabric Orders. For more information, see the Role-Based Access Control section.
- Ensure that you have a valid Authorization Token to provide in the header. When generating an authorization token, ensure that the API System App that you are using to generate the token has the correct role assigned. If a token doesn’t have the correct role, the following error is returned:
- If you have fabric Products Catalog enabled for your organization, ensure that you create and update the product catalog before importing inventory. If you are using product management software other than fabric’s Product Catalog, you must import your product data using the Products endpoint.
- Ensure that you have at least one fulfillment location, such as a Distribution Center (DC).
Process
To import inventory, you must create an inventory CSV file. Once you have filled in the CSV file, you can upload it to the inventory-imports
endpoint. With the file uploaded, fabric process’s the CSV file and populates your inventory. With your baseline inventory populated, you’re ready to update the counters onHand, allocated, and shipped for each location. This populates your total available to purchase amount for each product and populates the inventory for each location.
To import orders, you must create an orders JSON file. Once you have completed the JSON file, you can upload it to the oms-imports
endpoint. With the file uploaded, fabric process’s the JSON file and populates your orders.
Importing Inventory
Before using the inventory-imports
endpoint, you must download and update the Update CSV file template. This file is uploaded in a subsequent API call.
Step 1: Download the CSV template file
-
Log in to fabric Copilot.
-
In the left menu, click Inventory.
The Manage inventory tab is displayed.
-
Click Import.
The Import CSV file to add or edit your inventory window is displayed. Two templates are provided.
-
Click Template: Update.
The inventory_update.csv file is downloaded.
Step 2: Update the CSV template file
The inventory_update.csv file contains a number of columns with optional fields, such as preorder and backorder dates. These fields are set to Null by the system if left blank. The following values are required:
Field | Description |
---|---|
SKU | The stock keeping unit. |
Item ID | The fabric item ID generated after a successful import of a product. This is required only if you use fabric Product Catalog. |
Location Number | A unique value used to identify the location such as a DC. Products can have multiple locations associated with their inventory. |
Channel ID | The sales channel ID. |
Step 3: Create the importId
The inventory-imports
endpoint is used to create the importId
and returns a uploadFileUrl
. The uploadFileUrl
is used to upload the CSV file from step 2 that populates your inventory levels.
POST Request:
Response:
Step 4: Upload the template file
Use the uploadFileUrl
value, which is returned in step 3, and send a PUT request with the template file.
Note: No authorization token is required for this step. If you use Postman, click the URL to automatically open the request in a new tab. Remember to change the request from GET to PUT and in the body of the request click the binary option followed by providing your inventory CSV file.
A successful response returns a 200 status.
Step 5: Check the upload status
Ensure that you have the importId
value from the response in Step 3.
You can check your inventory upload status by making a GET request to the inventory-imports/{importId}
endpoint.
GET Request:
Response:
On the Manage inventory page mentioned in step 1, the Available To Purchase column for each SKU is updated. Note that you may need to refresh your browser to see the update.
Step 6: Update inventory counters
After importing your inventory, update the default counters for onHand, allocated, and shipped for each product. Custom counters are supported and can be created using the Counters API endpoint.
PUT Request:
Response:
With the inventory counters updated, the fabric virtual counter also updates the SKU’s Available To Purchase value. In the following example, the value is updated to 130:
Importing orders
Before using the oms-imports
endpoint, you must create a JSON file containing all your order information in a specific format.
The JSON file is used to provide a centralized source for order, inventory, and warehouse information, enabling you to receive, track, and fulfill customer orders.
Step 1: Create the JSON file containing your orders
Note that each line in the JSON file represents one order. If you want to import 1000 orders , the file should have exactly 1000 lines with each line representing an order object. If you save the JSON file with an extension that makes it more readable or expands the object to more than one line, the upload fails.
Step 2: Retrieve the importId
and upload URL
The oms-imports
endpoint is used to create the importId
and returns a uploadFileUrl
. The uploadFileUrl
is used to upload the JSON file from step 1.
Response:
Step 3: Upload the JSON file
Use the uploadFileUrl
value, which is returned in step 2, and send a PUT request with the template file.
Note: No authorization token is required for this step. If you use Postman, click the URL to automatically open the request in a new tab. Remember to change the request from GET to PUT and in the body of the request click the binary option followed by providing your inventory CSV file.
A successful response returns a 200 status.
Step 4: Check the status of the import
Ensure that you have the importId
value from the response in Step 2.
You can check your order upload status by making a GET request to the oms-imports/{importId}
endpoint.
GET Request:
Response:
Depending on the number of orders being imported, this process can take up to 20 minutes to complete. Batches of up to 1 million imports are supported at a time. The statusCode
value is set to INITIATED until the process completes.
Step 5: Use the order number to retrieve an order
To verify the orders are imported, make a GET request to the orders/order-number/{orderNumber}
endpoint using one of the imported order numbers.
Request:
A successful response returns a 200 status with an order object in the payload.
Related Resources
Was this page helpful?