Update variants in catalog

PATCH /catalog/product/variant/

Allows batch updates of variants in the catalog.

application/json

Body Required

A list of variants to update.

  • variants array[object] Required

    An array of variants to be updated in the catalog.

    At least 1 but not more than 500 elements.

    Hide variants attributes Show variants attributes object
    • sku string Required

      Stock Keeping Unit (SKU).

      Minimum length is 1.

    • barcode string

      The unique barcode for the variant, such as UPC or EAN.

    • price number

      The price of the product in the specified currency.

      Minimum value is 0, maximum value is 1000000.0.

    • quantity integer

      The available stock quantity of the product.

      Minimum value is 0, maximum value is 1000000.

    • images array[string(url)]

      List of image URLs associated with the product variant.

    • options array[object]

      A list of options specifying attributes of the variant (e.g., size, color).

      Hide options attributes Show options attributes object
      • name string Required

        The name of the option.

      • value string Required

        The value of the option.

    • attributes array[object]

      A list of key-value pairs representing attributes.

      Hide attributes attributes Show attributes attributes object
      • name string Required

        The name of the attribute (e.g., material, size, color).

      • value string Required

        The value of the attribute corresponding to its name (e.g., cotton, red, large).

Responses

  • 200 application/json

    Successfully updated variants in catalog.

    Hide headers attributes Show headers attributes
    Hide response attribute Show response attribute object
    • updated integer Required

      The count of variants successfully updated.

  • 400 application/json

    Bad request

    Hide headers attributes Show headers attributes
    Hide response attributes Show response attributes object
    • code string Required

      An error code that identifies the type of error that occurred.

    • message string Required

      A message that describes the error condition in a human-readable form.

    • data object | array Required

      Additional information that can help the caller understand or fix the issue.

  • 404 application/json

    Not found

    Hide response attributes Show response attributes object
    • code string Required

      An error code that identifies the type of error that occurred.

    • message string Required

      A message that describes the error condition in a human-readable form.

    • data object | array Required

      Additional information that can help the caller understand or fix the issue.

  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
    • code string Required

      An error code that identifies the type of error that occurred.

    • message string Required

      A message that describes the error condition in a human-readable form.

    • data object | array Required

      Additional information that can help the caller understand or fix the issue.

  • 429 application/json

    Too many requests

    Hide headers attributes Show headers attributes
    Hide response attributes Show response attributes object
    • code string Required

      An error code that identifies the type of error that occurred.

    • message string Required

      A message that describes the error condition in a human-readable form.

    • data object | array Required

      Additional information that can help the caller understand or fix the issue.

  • 500 application/json

    Internal server error

    Hide response attributes Show response attributes object
    • code string Required

      An error code that identifies the type of error that occurred.

    • message string Required

      A message that describes the error condition in a human-readable form.

    • data object | array Required

      Additional information that can help the caller understand or fix the issue.

PATCH /catalog/product/variant/
curl \
 -X PATCH https://m2e.cloud/api/v1/api/catalog/product/variant/ \
 -H "Content-Type: application/json" \
 -d '{"variants":[{"sku":"test-product-SKU","barcode":"012345678905","price":99.99,"quantity":17,"images":["https://example.com/image.jpg"],"options":[{"name":"Size","value":"Medium"}],"attributes":[{"name":"material","value":"cotton"}]}]}'
Request examples
{
  "variants": [
    {
      "sku": "test-product-SKU",
      "barcode": "012345678905",
      "price": 99.99,
      "quantity": 17,
      "images": [
        "https://example.com/image.jpg"
      ],
      "options": [
        {
          "name": "Size",
          "value": "Medium"
        }
      ],
      "attributes": [
        {
          "name": "material",
          "value": "cotton"
        }
      ]
    }
  ]
}
Response examples (200)
# Headers
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 90
X-RateLimit-Retry-After: 2022-11-04T13:43:28Z

# Payload
{
  "updated": 10
}
Response examples (400)
[
  {
    "code": null,
    "message": "All array items must match schema"
  },
  {
    "code": null,
    "message": "The required properties (currency) are missing"
  }
]
Response examples (404)
[
  {
    "code": 404,
    "message": "Entity is not found."
  }
]
Response examples (401)
[
  {
    "code": 401,
    "message": "Unauthorized"
  }
]
Response examples (429)
[
  {
    "code": 429,
    "message": "Too many requests."
  }
]
Response examples (500)
[
  {
    "code": 500,
    "message": "Internal server error."
  }
]