4WS Suite
Home
API Reference
  • Data mangement API
  • Documents API
Home
API Reference
  • Data mangement API
  • Documents API
Fourwayshop
  1. Stock
  • Document Manager
    • Orders
      • Save Sale Order
      • Save Return Order
    • Orchestrated Orders
      • Orchestrated Order
      • Orchestrated Return order
      • Orchestrated Update order
    • Cart
      • Cart Validation
      • Cart Full Validation
    • Sales
      • Save receipt
      • Salve only Order
      • Replace or update sale
      • Get last digital order
    • Warehouse
      • Save Entry from supplier
      • Save Transfer document
      • Save Free Entry
    • Purchase
      • Save Purchase
    • Get Document
      GET
    • Update Document external references
      POST
  • Customer
    • Get Customer
      GET
    • Set Customer Opt-in
      POST
  • Loyalty vouchers
    • Get customer loyalty vouchers
      GET
    • Get loyalty vouchers at a time interval
      GET
    • Get last loyalty vouchers
      GET
  • Giftcard
    • Get Giftcard
      GET
    • Update Giftcard
      POST
    • Generate Gift Card Barcode
      POST
    • Gift Card PDF Generation
      POST
  • Stock
    • Get Stock
      POST
    • Get last stock
      GET
    • Insert Stock
      POST
  1. Stock

Insert Stock

Deprecated
POST
/api
Last modified:2025-11-17 15:34:03
To insert one or more articles stock, it's necessary to make a POST call, passing a JSON body as specified below.
Depending on the amount of requested data, the stock creation can last some seconds up to many minutes, so this is why the web service is asynchronous, and it's mandatory to specify a callback URL that will be called once the stock has been created.
If a callback has been specified in the request, this callback will be called in POST when the queue has ended. If you wish you can specify a payload that will be returned to you in the callback.
The max allowed stock array size: 50 ITEMS

Request response#

The web service will respond with a JSON object composed as follows:
{
"success" : true
}
success: Boolean that indicated wether the request was successful or not
code : HTTP Code for the response
200 means the request was correctly processed
204 means a duplicate record was found in KeepIT, and that no insertion was performed
206 means that not all records were inserted or processed
400 means that the request body is invalid or contains syntax errors
500 means a server error has happened

Callback#

The callback url will be called in POST when the request has ended. In case of success the callback reuqest body is the following JSON:

Successful#

    { 
        "success": true,
        "code": 200,
        "message": "Insert/Update successful.",
        "jobName": COMPANY_WS_INSERT_STOCKS_jobName_Date.now() or COMPANY_WS_INSERT_STOCKS_Date.now(),
        "errorObjects": [],
        "insertedObjects": [{
            "entityCode" : "yyy",
            "itemBarcode": "xxx"
        }],
        "additionalData": {
            "additionalField": "Will be returned in response as-is"
        }
    }

Mandatory field not found in the JSON request#

    {
        "success": false,
        "code": 400,
        "message": "Error: was not performed, check the error message of the returned records.";
        "jobName": COMPANY_WS_INSERT_STOCKS_jobName_Date.now() or COMPANY_WS_INSERT_STOCKS_Date.now(),
        "errorObjects": [
        {
            "entityCode" : "yyy",
            "itemBarcode": "xxx",
            "errorMessage": "Errore: xxx non valorizzato."
        }
        ],
        "insertedObjects": [],
        "additionalData": {
            "additionalField": "Will be returned in response as-is"
        }
    }

Partial successful#

    { 
        "success": true,
        "code": 206,
        "message": insertedObjects.length + " record inserted/updated and " + errorObjects.length + " record in error",
        "jobName": COMPANY_WS_INSERT_STOCKS_jobName_Date.now() or COMPANY_WS_INSERT_STOCKS_Date.now(),
        "errorObjects": [
        {
            "entityCode" : "yyy",
            "itemBarcode": "xxx",
            "errorMessage": msgError
        }
        ],
        "insertedObjects": [{
            "entityCode" : "yyy",
            "itemBarcode": "xxx"
        }]
    }

Fields#

Root#

FieldDescriptionTypeMandatory
callbackUrlURL to be called with a POST request once the stock creation is terminedString
jobNameJob name returned if callbackUrl is set (if not set default is COMPANY_WS_INSERT_STOCKS_Date.now())String
stocksArray of articles stock object [MAX ALLOWED 50 ITEMS](see below for the complete structure).Array✓
additionalDataAn object containing any data, that will be returned as-in in response.
Useful to store information required in the callbackUrl
JSON Object

Stocks#

FieldDescriptionTypeMandatory
entityCodeShop codeVarchar(250)✓
entityLocationLocation codeVarchar(250)✓(if you want lease management)
itemBarcodeBarcode of the article for insert stockVarchar(50)✓
quantityStockQuantity in stockInteger✓
quantityGeneric1Quantity configurable1Integer
quantityGeneric2Quantity configurable2Integer
quantityGeneric3Quantity configurable3Integer
quantityGeneric4Quantity configurable4Integer
quantityGeneric5Quantity configurable5Integer
quantityArrivedQuantity arrivedInteger
quantityArrivedWarehouseQuantity arrived from warehouseInteger
quantityArrivedStoreQuantity arrived from storeInteger
quantityArrivedSupplierQuantity arrived from supplierInteger
quantityOnDeliveryQuantity on deliveryInteger
quantityOrderQuantity orderInteger
quantityRiassortQuantity restockingInteger
quantityCommittedQuantity committedInteger
quantityDispatchedQuantity dispatchedInteger
quantityInvoicedQuantity invoicedInteger
quantityReceiptedQuantity receiptedInteger
quantitySaleB2BQuantity sales delivery noteInteger
quantityCanceledQuantity canceledInteger
quantityReturnedQuantity returnedInteger
quantityAdjustedQuantity adjustedInteger
quantityTransferedQuantity transferedInteger

Request

Query Params

Header Params

Body Params application/json

Example
{
    "stocks": [
        {
            "entityCode": "1001",
            "itemBarcode": "500007069710",
            "quantityStock": 3,
            "entityLocation": "01"
        },
        {
            "entityCode": "1001",
            "itemBarcode": "500007069710",
            "quantityStock": 2,
            "entityLocation": "02"
        },
        {
            "entityCode": "1001",
            "itemBarcode": "156399000108",
            "quantityStock": 7,
            "entityLocation": "01"
        },
        {
            "entityCode": "1001",
            "itemBarcode": "500007069710",
            "quantityStock": 1,
            "entityLocation": "01"
        },
        {
            "entityCode": "1001",
            "itemBarcode": "500007069703",
            "quantityStock": 9,
            "entityLocation": "02"
        }
    ],
    "callbackUrl": "https://yourcallbackurl",
    "additionalData": {
        "additionalField": "Will be returned in response as-is"
    }
}

Request Code Samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location -g --request POST '/api?cmd=insertStocks_v1&applicationId={{APPLICATION_ID}}&appId={{APPLICATION_ID}}' \
--header 'applicationId: {{APPLICATION_ID}}' \
--header 'appId: {{APPLICATION_ID}}' \
--header 'namespace: {{NAMESPACE}}' \
--header 'languageId: {{LANGUAGE}}' \
--header 'username: {{USERNAME}}' \
--header 'password: {{PASSWORD}}' \
--header 'companyId: {{COMPANY_ID}}' \
--header 'siteId: {{SITE_ID}}' \
--header 'loadRoles: Y' \
--header 'Content-Type: application/json' \
--data-raw '{
    "stocks": [
        {
            "entityCode": "1001",
            "itemBarcode": "500007069710",
            "quantityStock": 3,
            "entityLocation": "01"
        },
        {
            "entityCode": "1001",
            "itemBarcode": "500007069710",
            "quantityStock": 2,
            "entityLocation": "02"
        },
        {
            "entityCode": "1001",
            "itemBarcode": "156399000108",
            "quantityStock": 7,
            "entityLocation": "01"
        },
        {
            "entityCode": "1001",
            "itemBarcode": "500007069710",
            "quantityStock": 1,
            "entityLocation": "01"
        },
        {
            "entityCode": "1001",
            "itemBarcode": "500007069703",
            "quantityStock": 9,
            "entityLocation": "02"
        }
    ],
    "callbackUrl": "https://yourcallbackurl",
    "additionalData": {
        "additionalField": "Will be returned in response as-is"
    }
}'

Responses

🟢200Success
application/json
Body

Example
{}
Modified at 2025-11-17 15:34:03
Previous
Get last stock
Built with