4WS Suite
Home
API Reference
  • Data mangement API
  • Documents API
Home
API Reference
  • Data mangement API
  • Documents API
Fourwayshop
  1. Custom category
  • 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
      • Generate missing barcodes
      • Generate missing barcode for SKU
      • Insert barcode
      • Delete barcode
    • 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
        GET
      • Insert Custom code
        POST
      • Update Custom code
        PATCH
    • 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. Custom category

Update Custom code

PATCH
/api/v1/customCodes/{CUSTOM_CODE}
Last modified:2025-02-07 14:57:51

Customs Code Update#

This API allows an external system to update an existing customs code in the 4ws.trade database. The system can update multiple fields such as descriptions in various languages, active status, and net weight.

Actors#

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

Preconditions#

The external system must have the necessary permissions and access to the document creation service, please refer to Authentication.
The custom_code to be updated must exist in the 4ws.trade database. If it does not exist, an error will be returned.

Languages#

To understand how languages are managed, please refer to our Managing Languages Documentation.

Main Success Scenario#

1.
The external system sends a PATCH request with the updated data for a specific custom_code.
2.
If the custom_code exists and the update is successful, the system returns the internal prog_id and the updated custom_code.
{
  "customCode": {
    "prog_id": 178175,                       // Internal ID of the updated customs code
    "custom_code": "12345678"                // Customs code that was updated
  }
}

Alternate Flows#

1.
Custom Code Not Found:
If the custom_code does not exist, the API returns an HTTP 422 error with the message:
{
  "message": "Custom code not found {custom_code}"
}
2.
Validation Errors:
If the input data fails validation (e.g., invalid fields), the API will return an appropriate error message indicating the issue.

Sequence Diagram#

Code Examples in Node.js#

Example for updating a customs code:
Best Practices
Please refer to Best Practices for Error Handling in External System for best practices on implementation.

This documentation describes how to update an existing customs code in the 4ws.trade database using the API. It covers the success scenarios, error handling, best practices, and includes code examples for implementation in Node.js.

Request

Path Params

Body Params application/json

Example
{
    "description_it": "string",
    "description_en": "string",
    "description_de": "string",
    "description_es": "string",
    "description_fr": "string",
    "description_pt": "string",
    "description_ru": "string",
    "description_ar": "string",
    "description_ja": "string",
    "description_zh": "string",
    "active": true,
    "net_weight": 19
}

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 PATCH '/api/v1/customCodes/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "description_it": "string",
    "description_en": "string",
    "description_de": "string",
    "description_es": "string",
    "description_fr": "string",
    "description_pt": "string",
    "description_ru": "string",
    "description_ar": "string",
    "description_ja": "string",
    "description_zh": "string",
    "active": true,
    "net_weight": 19
}'

Responses

🟢200Success
application/json
Body

Example
{
    "customCode": {
        "prog_id": 178175,
        "custom_code": "12345678"
    }
}
🟠401Authentication failed
🟠403Operation not allowed
🟠422Custom code not found
Modified at 2025-02-07 14:57:51
Previous
Insert Custom code
Next
Get VAT type
Built with