Create Product
You can create a product using this service. You no longer need to find category IDs - you can send category information directly as names.
The old system used subCategoryBrandId which required you to navigate the category hierarchy to find the ID first. In the new system, you can send category names directly as strings. The system automatically handles the matching.
Request
curl --location --request POST '<BASE_URL>/merchant-products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <jwtToken>' \
--data '{
"mainCategoryName": "Electronics",
"categoryName": "Phone",
"subCategoryName": "Smartphone",
"brand": "Apple",
"name": "iPhone 15 Pro",
"warrantyYear": 2,
"model": "A2848",
"description": "Apple iPhone 15 Pro 256GB Titanium",
"setupRequired": false,
"productCode": "PRD-001",
"price": 49999.99
}'
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| mainCategoryName | String | No | Main category name (e.g., "Electronics"). Max 255 characters. |
| categoryName | String | No | Category name (e.g., "Phone"). Max 255 characters. |
| subCategoryName | String | No | Sub category name (e.g., "Smartphone"). Max 255 characters. |
| brand | String | No | Brand name (e.g., "Apple"). Max 255 characters. |
| name | String | Yes | Product name. Max 255 characters. |
| warrantyYear | Integer | Yes | Warranty duration in years. Can take values between 2 and 10. |
| model | String | No | Product model. Max 255 characters. |
| description | String | No | Product description. Max 1000 characters. |
| setupRequired | Boolean | Yes | Indicates whether the product requires setup/installation. |
| productCode | String | Yes | Unique product code in your system. Max 255 characters. |
| price | Decimal | No | Product price. Minimum 0. |
Response
Returns HTTP 201 (Created) on successful creation, together with the identifier of the created product.
{
"merchantProductId": 12345
}
Response Fields
| Field | Type | Description |
|---|---|---|
| merchantProductId | Integer | ID of the created product |
Previously this service returned an empty body, so you had to call Get ID By Product Code afterwards to learn the ID of the product you had just created. The merchantProductId is now returned directly in the creation response, so that second call is no longer necessary. The Get ID By Product Code service is still available and unchanged.
The error behaviour is unchanged: sending the same productCode again for the same merchant still fails. This service is not idempotent, so do not retry a creation request that has already succeeded.
Example Usage Scenarios
Scenario 1: Creating a Product with Full Category Information
{
"mainCategoryName": "Electronics",
"categoryName": "Computer",
"subCategoryName": "Laptop",
"brand": "Apple",
"name": "MacBook Pro 14",
"warrantyYear": 2,
"model": "M3 Pro",
"description": "Apple MacBook Pro 14 inch M3 Pro 18GB RAM",
"setupRequired": false,
"productCode": "MBP-14-M3PRO",
"price": 89999.0
}
Scenario 2: Creating a Product without Category Information
Since category fields are optional, you can also create a product with only the required fields:
{
"name": "Generic Product",
"warrantyYear": 2,
"setupRequired": false,
"productCode": "GEN-001"
}