Create an Exception

Endpoint Overview

Product option exceptions allow you to define combinations of options that should not be available together. This endpoint enables you to create new exceptions for your products.

POST /api/exceptions/

Creates a new option exception for a specific product.

Request Parameters

Pass the following parameters in the HTTP request body according to your specified Content-Type:

Parameter Type Required Description
product_id* integer Yes The unique identifier of the product that the exception is associated with.
combination object No The options and variants that comprise the exception. The object keys are option IDs and values are variant IDs.
Note: The options you specify in the combination object should have the Checkbox, Select box, or Radiogroup type and be available for the product.
Using -1 as a Variant Value: You can use -1 as a variant value to indicate "any variant" of an option. This allows you to create more flexible exceptions.

Example Request

{
  "product_id": "12",
  "combination": {
    "3": "-1",
    "4": "19",
    "17": "61"
  }
}

This request creates a new exception for the product with product_id=12. This exception describes the following combination of variants that should not be available together:

  • Any variant of option 3
  • Variant 19 of option 4
  • Variant 61 of option 17

Response Format

Success Response (201 Created)

{
  "exception_id": "10"
}

Error Response (400 Bad Request)

Returned when the exception couldn't be created due to invalid parameters or other issues.

Implementation Notes

Option exceptions are useful for defining rules about which combinations of options shouldn't be available together. This can be helpful when:

Tip: Using -1 as a variant ID (meaning "any variant") allows you to create broader rules. For example, you can specify that a particular color option should never be combined with any size variant of another option.
Important: Be careful when creating exceptions, as they directly affect the options available to your customers. Testing your exceptions thoroughly is recommended to ensure they work as expected.

Common Use Cases

Here are some common scenarios where option exceptions are useful: