4WS Suite
Home
API Reference
  • Data mangement API
  • Documents API
Home
API Reference
  • Data mangement API
  • Documents API
Fourwayshop
  1. Barcode
  • Login
    • login
      POST
  • Product
    • Brand
      • Get All Brands
      • Get A Brand
      • Insert brand
      • Update brand
    • Season
      • Get All Seasons
      • Get A Season
      • Insert season
      • Update season
    • Attribute
      • Get All Attribute Types
      • Get Attribute Type
      • Get Attribute
      • Insert attribute
      • Update attribute
    • Hierarchy
      • Insert hierarchy
      • Update hierarchy
    • Dimension groups
      • Insert dimension group
      • Update dimension group
    • Dimension
      • Insert dimension
      • Update dimension
      • Delete dimension
    • Product
      • Get products
      • Get product
      • Get product grouping
      • Get SKU's barcodes
      • Get product stock
      • Insert product
      • Update product
    • Activate dimensions on products
      • Insert active dimensions
      • Delete active dimensions
    • Barcode
      • Get SKU from barcode
        GET
      • Generate missing barcodes
        POST
      • Generate missing barcode for SKU
        POST
      • Insert barcode
        POST
      • Delete barcode
        DELETE
    • Prices
      • Get product prices
    • Price dimension groupings
      • Get Dimension Price Grouping
      • Get All Dimension Price Grouping
      • Insert dimension grouping
      • Update dimension grouping
      • Delete dimension grouping
    • Assortment
      • insert product assortment
      • delete product assortment
    • Image
      • Get images
      • Add image
      • Replace image
      • Delete image
    • Supplier
      • Get Item suppliers
      • Insert item supplier
      • Delete item supplier
      • Update item supplier
    • Custom category
      • Get Custom code
      • Insert Custom code
      • Update Custom code
    • Vat
      • Vat types
        • Get VAT type
        • Get VAT types
      • VATs
        • Get VATs
        • Get VATs by type
        • Get VAT
      • Vat rates
        • Get VAT rates
        • Get single VAT rates
    • Stock
      • Insert stock
      • Get stock
  • Price lists
    • Get price lists
      GET
    • Get price lists by type
      GET
    • Get price list
      GET
    • Get prices from price list
      GET
    • Get entities from price lists
      GET
    • Insert Price List
      POST
    • Insert Product Price
      POST
    • Insert Entity On Price Lists
      POST
    • Update price list
      PATCH
    • Delete all product prices
      DELETE
    • Delete single product price
      DELETE
    • Delete entity from a price lists
      DELETE
  • Supplier
    • Supplier contacts
    • Supplier addresses
    • Get Suppliers
    • Get A Specific Supplier
    • Insert supplier
    • Update supplier
  • Entities
    • Get entities
    • Get entity
    • Insert entity
    • Update entity
  • Miscellaneous
    • Get requests rate limits
  • Catalog
    • Get Catalogs details
    • Get Catalog details by Code
    • Get products by Catalog Code
  • Export
    • Get bulk CSV Export
  1. Barcode

Generate missing barcodes

POST
/api/v1/products/{ITEM_CODE}/missingBarcodes
Last modified:2025-02-07 14:44:56

Generate Missing Barcodes for SKUs#

This API enables the automatic generation of barcodes for all SKUs of a specified product {ITEM_CODE} that currently lack barcodes.
Products and dimensions
For more detail about Products ad dimensions please refeare to use case Product dimensions.
The barcode type is specified in the request body.
Upon successful execution, the API returns the list of SKUs for which barcodes have been generated, along with the corresponding EAN13 codes.
Barcode type
Currently, only EAN13 is supported for barcode generation.

Actors#

API Client: The system or user initiating the request.
4ws.trade: The backend system that processes the request.

Preconditions#

The ITEM_CODE should be valid and correspond to an existing product in the system.
The barcode type must be specified in the request body, and only EAN13 is currently supported.
The external system must have the necessary permissions and access to the document creation service, please refer to Authentication.

Main Success Scenario#

1.
The client sends a POST request with a valid ITEM_CODE and specifies barcode_type in the request body.
2.
The API checks each SKU associated with the product code for missing barcodes.
3.
For SKUs without barcodes, the API generates EAN13 barcodes and returns a success message with the list of generated barcodes.
TIP
To generate a barcode for a specific SKU, please utilize the Generate missing barcode for SKU service.

Alternate Flows#

1.
Invalid Product Code or Dimensions (404)
If the ITEM_CODE or any required dimension group is not found, the API returns a 404 error with a descriptive message.
Response:
{
  "message": "Product not found with item_code: {ITEM_CODE}"
}
NOTE
Barcodes generated are in the specify format with a system-configured prefix.
The API does not guarantee consecutive numbering of barcode numbers.

Sequence Diagram#

Best Practices
Please refer to Best Practices for Error Handling in External System for best practices on implementation.

Code Examples in Node.js#


Request

Path Params

Body Params application/json

Example
{
    "barcode_type": "EAN13"
}   

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 --request POST '/api/v1/products//missingBarcodes' \
--header 'Content-Type: application/json' \
--data-raw '{
    "barcode_type": "EAN13"
}'

Responses

🟢200Success
application/json
Body

Example
{
    "success": true,
    "insertedBarcodes": [
        {
            "barcode": "2000021035010",
            "dimension_level_1": "4",
            "dimension_level_2": "080"
        },
        {
            "barcode": "2000021035027",
            "dimension_level_1": "4",
            "dimension_level_2": "020"
        },
        {
            "barcode": "2000021035034",
            "dimension_level_1": "8",
            "dimension_level_2": "080"
        },
        {
            "barcode": "2000021035041",
            "dimension_level_1": "8",
            "dimension_level_2": "020"
        },
        {
            "barcode": "2000021035058",
            "dimension_level_1": "10",
            "dimension_level_2": "080"
        },
        {
            "barcode": "2000021035065",
            "dimension_level_1": "10",
            "dimension_level_2": "020"
        }
    ]
}
🟠422error - barcode exists
🟠403Operation not allowed
🟠401Authentication failed
🟠422Unique constraint error
Modified at 2025-02-07 14:44:56
Previous
Get SKU from barcode
Next
Generate missing barcode for SKU
Built with