4WS Suite
Home
API Reference
  • Data mangement API
  • Documents API
Home
API Reference
  • Data mangement API
  • Documents API
Fourwayshop
  1. Dimension
  • 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
        POST
      • Update dimension
        PATCH
      • Delete dimension
        DELETE
    • 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
      • 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. Dimension

Insert dimension

POST
/api/v1/dimensions/{DIMENSION_TYPE}/{DIMENSION_GROUP}/
Last modified:2025-02-07 14:41:49

Adding Product Dimensions to a Dimension Group#

This API allows an external system to add specific dimensions (e.g., sizes) to a predefined dimension group (e.g., "EU Sizes") associated with a given dimension type (e.g., "Size"). This functionality enables better organization of product attributes based on various size groupings.
dimension: The dimension value (e.g., "XL").
description_it: Description in Italian.
additional_description_it: Any additional description in Italian.
generic_name: Generic name for the dimension.
generic_name_it: Generic name in Italian.
dimension_grouping: Grouping category for the dimension.
position: Position or rank of the dimension within the group.
INFO
To learn more about how dimensions are managed, including defining dimension types, creating dimensional groups, and associating dimensions with products, please refer to our Product Dimensions

Languages#

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

Actors#

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

Preconditions#

The dimension_group must already exist and be created through the Insert dimension group API.
The dimension_type must be predefined (e.g., "TAGLIA").
The external system must have the necessary permissions and access to the document creation service, please refer to Authentication.

Main Success Scenario#

If the request is successful, the system will return an HTTP 200 response along with the internal program ID (prog_id) and the newly added dimension.
Example Success Response:
{
  "dimension": {
    "prog_id": 83434,
    "dimension": "XL"
  }
}

Alternate Flows#

1.
Dimension Type Not Found:
If the provided dimension_type does not exist in the system, the following error will be returned:
{
  "message": "dimension_type with {dimension_type} not found"
}
HTTP Status: 422 Unprocessable Entity
2.
Dimension Group Not Found:
If the dimension_group does not exist, the following error will be returned:
{
  "message": "dimension_group with {dimension_group} not found"
}
HTTP Status: 422 Unprocessable Entity
Best Practices
Please refer to Best Practices for Error Handling in External System for best practices on implementation.

Sequence Diagram#

To correctly create a new Dimension, the DimensionGroup must already be registered, otherwise the service will report an error.
WARNING
Avoid simultaneous calls as they do not guarantee the correct insertion and validation of the "position" field.

Code Example in Node.js#

This Node.js example demonstrates how to add a new dimension to a specified dimension group using the provided API.

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Path Params

Header Params

Body Params application/json

Example
{
    "dimension": "{{dimension}}",
    "description_it": "{{description_it}}",
    "additional_description_it":"{{additional_description_it}}",
    "generic_name":"{{generic_name}}",
    "generic_name_it":"{{generic_name_it}}",
    "dimension_grouping":"{{dimension_grouping}}",
    "position":"{{position}}"
}

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/dimensions///' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "dimension": "{{dimension}}",
    "description_it": "{{description_it}}",
    "additional_description_it":"{{additional_description_it}}",
    "generic_name":"{{generic_name}}",
    "generic_name_it":"{{generic_name_it}}",
    "dimension_grouping":"{{dimension_grouping}}",
    "position":"{{position}}"
}'

Responses

🟢200Success
application/json
Body

Example
{
    "dimension": {
        "prog_id": 83434,
        "dimension": "XXS"
    }
}
🟠401Authentication failed
🟠403Operation not allowed
🟠422Unique constraint error
Modified at 2025-02-07 14:41:49
Previous
Update dimension group
Next
Update dimension
Built with