Automatic stock update during a working day
Automated updating of the inventory using a basic script extension
It is possible to automate the uploads using an extension to the basic script. The extension deletes the current uploads and then creates and uploads a new, updated CSV file.
The constants/names from the basic script are used.
1. Login (included in the basic script)
POST PROTOCOL://BASE_URL/login
Important here are the headers for the login data and the cookie, which is required for further REST calls.
is required.
--data-raw "username=USERNAME&password=PASSWORD"
-c "bearingx_cookie.txt"
2. Initiate cancel-all process
POST PROTOCOL://BASE_URL/api/orders/cancel-all
The header for the cookie is important here
-b "bearingx_cookie.txt"
3. Cancel-All Status abfragen
GET PROTOCOL://BASE_URL/api/orders/cancel-all-status
The header for the cookie is important here
-b "bearingx_cookie.txt"
Provides the following data:
{
currentStatus: 'PROCESSING' | 'FINISHED',
numberOfCancelledOrders: number,
totalNumberOfOrders: number
}
4. CSV upload (included in the basic script)
POST PROTOCOL://BASE_URL/api/orders/upload
The headers for the actual CSV file and the cookie are important here
-F "file=@FILENAME"
-b "bearingx_cookie.txt"
5. Query CSV-UPLOAD status
GET PROTOCOL://BASE_URL/api/orders/upload
The header for the cookie is important here
-b "bearingx_cookie.txt"
Returns a list with elements from the following data:
{
completionDate: date,
currentStatus: 'PROCESSING' | 'FINISHED',
errors: [
{
error: string,
lineNumber: number
}
],
fileName: string,
numberOfFailedOrders: number,
numberOfOrders: number,
numberOfProcessedOrders: number,
numberOfSuccessfulOrders: number
}