Config Product Creation

This API is offering to create Configurable Product.

Create Simple (Child) Product

POST {{Base_url}}/rest/V1/products

Body

{
  "product": {
    "sku": "simple-product-sku1_color",
    "name": "Simple Product 1",
    "price": 50,
    "status": 1,
    "type_id": "simple",
    "attribute_set_id": 92,
    "visibility": 1,
    "extension_attributes": {
      "stock_item": {
        "qty": 100,
        "is_in_stock": true
      }
    },
    "custom_attributes": [
      {
        "attribute_code": "color_dropdown",
        "value": "1922" //Color Dropdown ID
      }
    ]
  }
}

Product JSON Object Explanation

"product"

  • Root object representing the product data being created.

Attributes in product:

  1. "sku"

    • Type: String.

    • Unique identifier for the product, e.g., "simple-product-sku1_color".

  2. "name"

    • Type: String.

    • The product's name, e.g., "Simple Product 1".

  3. "price"

    • Type: Float.

    • The product's price, e.g., 50.

  4. "status"

    • Type: Integer.

    • Product status: 1 for enabled, 0 for disabled.

  5. "type_id"

    • Type: String.

    • Product type, e.g., "simple" for a simple product.

  6. "attribute_set_id"

    • Type: Integer.

    • ID of the attribute set to which this product belongs (e.g., 92).

  7. "visibility"

    • Type: Integer.

    • Visibility on the storefront:

      • 1: Not visible individually.

      • 2: Catalog only.

      • 3: Search only.

      • 4: Catalog and search.


Extension Attributes

"stock_item"

  • Represents stock and inventory data:

    • "qty": Quantity in stock, e.g., 100.

    • "is_in_stock": Boolean to indicate if the product is in stock (true or false).


Custom Attributes

"custom_attributes"

  • A list of additional attributes for the product:

    • "attribute_code": Identifier for the attribute (e.g., "color_dropdown").

    • "value": Value for the attribute (e.g., "1922", which might represent a color ID).


Responses

Top-Level Attributes

  1. id

    • Type: Integer.

    • Unique identifier for the product in Magento (e.g., 14602).

  2. sku

    • Type: String.

    • Stock Keeping Unit (unique product identifier) used for inventory and management (e.g., "simple-product-sku1_color").

  3. name

    • Type: String.

    • The product name displayed to customers (e.g., "Simple Product 1").

  4. attribute_set_id

    • Type: Integer.

    • ID of the attribute set associated with this product (e.g., 92). Attribute sets define the attributes available for the product.

  5. price

    • Type: Float.

    • Base price of the product (e.g., 50).

  6. status

    • Type: Integer.

    • Indicates whether the product is enabled (1) or disabled (0) in the store.

  7. visibility

    • Type: Integer.

    • Product visibility setting:

      • 1: Not visible individually.

      • 2: Catalog only.

      • 3: Search only.

      • 4: Catalog and search.

  8. type_id

    • Type: String.

    • Specifies the product type. Here, "simple" indicates a simple product.

  9. created_at

    • Type: String (timestamp).

    • Timestamp for when the product was created ("2025-01-10 11:49:09").

  10. updated_at

    • Type: String (timestamp).

    • Timestamp for when the product was last updated ("2025-01-13 07:51:39").


extension_attributes

  1. website_ids

    • Type: Array.

    • IDs of the websites where this product is available (e.g., [1]).

  2. stock_item

    • Details about stock and inventory for this product:

      • item_id: Unique stock item ID (e.g., 432290).

      • product_id: ID of the product associated with this stock item (e.g., 14602).

      • stock_id: ID of the stock (e.g., 1).

      • qty: Quantity in stock (e.g., 100).

      • is_in_stock: Indicates if the product is in stock (true).

      • is_qty_decimal: Whether the product allows fractional quantities (false).

      • use_config_*: Boolean flags indicating if stock-related configurations are using global settings.

      • min_qty: Minimum stock quantity (e.g., 0).

      • max_sale_qty: Maximum quantity that can be purchased in one order (e.g., 100).

      • backorders: Backorder settings (0 for no backorders).

      • notify_stock_qty: Threshold for low stock notification (e.g., 1).

      • manage_stock: Indicates if stock management is enabled (true).


options

  • Type: Array.

  • Additional product options (empty here).


  • Type: Array.

  • Media (images, videos) associated with the product (empty here).


custom_attributes

  1. url_key

    • URL-friendly identifier for the product (e.g., "simple-product-1").

  2. options_container

    • Defines where product options are displayed on the product page (e.g., "container2").

  3. purchase_price_cap

    • Reserved for managing purchase price limits (e.g., "0.000000").

  4. msrp_display_actual_price_type

    • Determines how MSRP (Manufacturer Suggested Retail Price) is displayed (e.g., "0").

  5. is_sclp

    • Custom attribute, possibly related to product-specific logic (e.g., "0").

  6. required_options

    • Indicates if the product has required options ("0" means no required options).

  7. has_options

    • Indicates if the product has any custom options ("0" means no options).

  8. popular_product

    • Custom attribute to flag popular products (e.g., "0").

  9. tax_class_id

    • ID of the tax class applied to the product (e.g., "2").

  10. category_ids

    • List of category IDs to which the product belongs (empty here).

  11. sw_featured

    • Custom attribute, possibly related to featured products ("0").

  12. color_dropdown

    • Custom attribute for color, storing a value that corresponds to an option ID (e.g., "1922").

Create Config (Parent) Product

POST {{Base_url}}/rest/V1/products

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

This cURL request is for creating a configurable product in Magento via the REST API. A configurable product allows customers to select options (like size or color) that are linked to simple products.

Payload (Product Information):

  • sku

    • Unique identifier for the product (e.g., "configurable-product-22").

  • name

    • Name of the product (e.g., "Configurable Product").

  • attribute_set_id

    • Defines the attribute set for the product (e.g., 92).

  • price

    • Base price of the configurable product (e.g., 20). This acts as a placeholder since pricing is tied to associated simple products.

  • status

    • Product status: 1 for enabled, 0 for disabled.

  • visibility

    • Visibility setting:

      • 4: Visible in catalog and search.

  • type_id

    • Indicates the product type. "configurable" specifies this is a configurable product.

  • extension_attributes:

    1. stock_item

      • Details about inventory:

        • qty: Stock quantity (100).

        • is_in_stock: Indicates stock availability (true).

    2. configurable_product_options

      • Defines the configurable options for the product:

        • attribute_id: ID of the attribute used for configuration (e.g., "681" for color).

        • label: Label for the configurable attribute (e.g., "color_dropdown").

        • position: Display order of the attribute (e.g., 0).

        • values: Array of possible values for this attribute:

          • value_index: Option value (e.g., 1922).

    3. configurable_product_links

      • Links the configurable product to its associated simple products:

        • 14602: The id of a simple product that belongs to this configurable product.

Responses

Top-Level Attributes

  1. id

    • Unique identifier for the configurable product (e.g., 14603).

  2. sku

    • Stock Keeping Unit for the configurable product (e.g., "configurable-product-22").

  3. name

    • Product name (e.g., "Configurable Product").

  4. attribute_set_id

    • ID of the attribute set associated with this product (e.g., 92).

  5. price

    • Base price for the configurable product (e.g., 0). Actual pricing comes from the associated simple products.

  6. status

    • Product status: 1 for enabled, 0 for disabled.

  7. visibility

    • Defines visibility:

      • 4: Visible in catalog and search.

  8. type_id

    • Product type: "configurable".

  9. created_at / updated_at

    • Timestamps for when the product was created and last updated.


Extension Attributes

  1. website_ids

    • List of websites where this product is available (e.g., [1]).

  2. stock_item

    • Inventory details for the product:

      • qty: Stock quantity (e.g., 0).

      • is_in_stock: Indicates if the product is in stock (e.g., true).

      • Various other attributes control stock behavior (e.g., min_qty, backorders, etc.).

  3. configurable_product_options

    • Defines the configurable options for this product:

      • id: Internal ID for this option (e.g., 1128).

      • attribute_id: Attribute used for configuration (e.g., "681" for color_dropdown).

      • label: Display label for the option (e.g., "color_dropdown").

      • values: Available options:

        • value_index: Option ID (e.g., 1922).

        • label: Label for the option (e.g., "New Color Option").

        • sku: SKU of the associated simple product (e.g., "simple-product-sku1_color").

        • price: Price of the simple product (50.00).

        • status: Status of the simple product (1).

        • qty: Stock quantity for the simple product (100).

  4. configurable_product_links

    • IDs of simple products associated with this configurable product (e.g., [14602]).


Options

  • options

    • Array for custom product options (e.g., left empty here).


  1. media_gallery_entries

    • Product media details:

      • id: Media ID (e.g., 212576).

      • media_type: Type of media (e.g., "external-video").

      • label: Media label (e.g., "Sample Video").

      • file: File path or image/video reference (e.g., "/0/_/0_4.jpg").

      • extension_attributes.video_content: Video details:

        • video_provider: Provider (e.g., "youtube").

        • video_url: Video URL.

        • video_title: Title of the video.

        • video_description: Description of the video.


Custom Attributes

  1. image, small_image, thumbnail

    • Paths to product images (e.g., "/0/_/0.jpg").

  2. url_key

    • SEO-friendly URL for the product (e.g., "configurable-product-aaaa").

  3. options_container

    • Placement of additional options on the product page (e.g., "container2").

  4. purchase_price_cap

    • Reserved for price limitations (e.g., "0.000000").

  5. msrp_display_actual_price_type

    • Defines how MSRP is displayed (e.g., "0").

  6. is_sclp, required_options, has_options

    • Flags indicating special behaviors or configurations (e.g., "0" means disabled).

  7. image_label, small_image_label, thumbnail_label

    • Labels for different media types (e.g., "Sample Video").

  8. popular_product

    • Custom attribute indicating if this product is popular (e.g., "0").

  9. tax_class_id

    • Tax class applied to the product (e.g., "2").

  10. category_ids

    • Array of category IDs the product belongs to (e.g., []).

  11. sw_featured

    • Indicates if the product is featured (e.g., "0").

Last updated