To create a Simple: Multiple Product run the following API call:
Action : Create/Update Multiple Products
URL : <HOST>/V1/product/create/
METHOD : POST
REQUEST :
{ "product": { "10001": { "id": 10001, "name": "Sport Tshirt White", "price": "70.12", "special_price": "", "category_id": "1001", "status": 1, "enable_product_designer": 1, "tier_price": [ { "price": "50", "qty": "15" }, { "price": "40", "qty": "20" } ], "images": [ { "src": "image_url" } ], "type": "simple", "custom_options": [ { "title": "Message for packaging", "type": "field", "sort_order": 1, "is_require": 0, "price": 45, "price_type": "fixed", "sku": "85465da", "max_characters": 100 }, { "title" : "Test Option", "type" : "file", "is_require" : 0, "sort_order": 3, "price" : 2, "price_type" : "fixed", "sku" :"testsku", "file_extension" :"png,jpg", "image_size_x" : "100", "image_size_y" : "20" }, { "sort_order": 2, "title": "Color", "price_type": "fixed", "type": "drop_down", "is_require": 0, "price": 23, "sku": "854465da", "max_characters": 208, "values": [ { "title": "RED", "value": "red", "sort_order": 1, "price": 10, "price_type": "fixed", "sku": "fgh45", "is_delete": 0 }, { "title": "Yellow", "sort_order": 2, "value": "yellow", "price": 10, "price_type": "fixed", "sku": "fhfgh5", "is_delete": 0 } ] }, { "title": "My test", "type": "date_time", "sort_order": 3, "is_require": 0, "price": 5, "price_type": "fixed", "sku": "85465da" } ] }, "10002": { "id": 10002, "name": "Sport Tshirt Red", "price": "70.12", "special_price": "", "category_id": "1001", "status": 1, "enable_product_designer": 1, "tier_price": [ { "price": "50", "qty": "15" }, { "price": "40", "qty": "20" } ], "images": [ { "src": "image_url" } ], "type": "simple", "custom_options": [ { "title": "Message for packaging", "type": "field", "sort_order": 1, "is_require": 0, "price": 45, "price_type": "fixed", "sku": "85465da", "max_characters": 100 }, { "title" : "Test Option", "type" : "file", "is_require" : 0, "sort_order": 3, "price" : 2, "price_type" : "fixed", "sku" :"testsku", "file_extension" :"png,jpg", "image_size_x" : "100", "image_size_y" : "20" }, { "sort_order": 2, "title": "Color", "price_type": "fixed", "type": "drop_down", "is_require": 0, "price": 23, "sku": "854465da", "max_characters": 208, "values": [ { "title": "RED", "value": "red", "sort_order": 1, "price": 10, "price_type": "fixed", "sku": "fgh45", "is_delete": 0 }, { "title": "Yellow", "sort_order": 2, "value": "yellow", "price": 10, "price_type": "fixed", "sku": "fhfgh5", "is_delete": 0 } ] }, { "title": "My test", "type": "date_time", "sort_order": 3, "is_require": 0, "price": 5, "price_type": "fixed", "sku": "85465da" } ] }, "10034": { "id": 10034, "name": "Sport Tshirt Blue", "price": "70.12", "special_price": "", "category_id": "1001", "status": 1, "enable_product_designer": 1, "tier_price": [ { "price": "50", "qty": "15" }, { "price": "40", "qty": "20" } ], "images": [ { "src": "image_url" } ], "type": "simple", "custom_options": [ { "title": "Message for packaging", "type": "field", "sort_order": 1, "is_require": 0, "price": 45, "price_type": "fixed", "sku": "85465da", "max_characters":100 }, { "title" : "Test Option", "type" : "file", "is_require" : 0, "sort_order": 3, "price" : 2, "price_type" : "fixed", "sku" :"testsku", "file_extension" :"png,jpg", "image_size_x" : "100", "image_size_y" : "20" }, { "sort_order": 2, "title": "Color", "price_type": "fixed", "type": "drop_down", "is_require": 0, "price": 23, "sku": "854465da", "max_characters": 208, "values": [ { "title": "RED", "value": "red", "sort_order": 1, "price": 10, "price_type": "fixed", "sku": "fgh45", "is_delete": 0 }, { "title": "Yellow", "sort_order": 2, "value": "yellow", "price": 10, "price_type": "fixed", "sku": "fhfgh5", "is_delete": 0 } ] }, { "title": "My test", "type": "date_time", "sort_order": 3, "is_require": 0, "price": 5, "price_type": "fixed", "sku": "85465da" } ] } } }
Note:
– “image_src” contains a source path that specifies the full path of the source image.
– Custom Options:
The below is the type which is used in “type”: “field”
text (morefield: ‘max_characters’)
field
area
file (mf: ‘file_extension’, ‘image_size_x’, ‘image_size_y’)
select (mf: ‘value_id’, ‘title’, ‘sort_order’)
drop_down
radio
checkbox
multiple
date
date
date_time
time
RESPONSE
Success:
[ { "response": [ { "id": 10001, "code": "200", "status": "success", "message": "Product Updated Successfully!" }, { "id": 10002, "code": "200", "status": "success", "message": "Product Updated Successfully!" }, { "id": 10034, "code": "200", "status": "success", "message": "Product Updated Successfully!" } ] } ]
Note: “image_src” contains a source path which specifies the full path of the source image.
Required Request (Data Fields) :
custom_optionsNoJson Array( { “title”:string ‘Message’,”sort_order”:number 1 },)
Field Name | Required Value | Data Type |
---|---|---|
id | Yes | String |
name | Yes | String |
price | No | Float |
category_ids | No | String (comma(,) seperated) |
status | No | Number(0,1) |
enable_product_designer | No | Number(0,1) |
images | No | Array() {“src”:”Path”} |
type | Yes | String (“Simple”,”Configurable”) Only |
tier_price | No | Json Array({“price”:”value”,”qty”:”value”}) |
Error Validation Example
REQUEST
{ "product": { "10001": { "id": 10001, "name": "Test1111111", "price": "70.12", "special_price": "Test 11111", "category_id": "101", "status": 1, "enable_product_designer": 1, "tier_price": [ { "price": "50", "qty": "15" }, { "price": "40", "qty": "20" } ], "images": [ { "src": "image_src" } ], "type": "simple" } } }
RESPONSE
[ { "response": [ { "id": 10001, "code": 404, "status": "error", "message": "Please pass vaild special_price." } ] } ]