Assign Category to Product
POST/api/categories/assign-category-to-product
Assign a category to a product and optionally set it as the primary category. Uses updateOrCreate so re-posting changes is_primary.
Authentication: Requires Bearer token.
Request body fields:
category_id(required) — must be a leaf categoryproduct_id(required) — must exist in products tableis_primary(optional, boolean) — if true, unsets primary from all other categories for this product
Returns 201 on creation, 200 on update.
Request
Responses
- 200
Successful response