MasterProducts are common products that vendors can sell. This entity is added by the Common Products for Vendors add-on that is available in Multi-Vendor.
To get a list of common products, send a GET
request to /api/master_products/
:
GET /api/master_products/
The number of the returned products can be changed by the items_per_page
parameter. For example:
GET /api/master_products/?items_per_page=100
The default number is defined by the Elements per page setting in the Admin panel on the Settings → General → Appearance page.
To refer to all products of a particular Category send a GET
request to /api/categories/:id/master_products/
:
GET /api/categories/166/master_products/
Pagination, sorting, and filtering parameters are inherited from Products.
The Common Products for Vendors add-on adds the show_master_products_only
filtering parameter with true
or false
value, available via Products API.
The true
value will return only common products in the response, while the false
will return only products offered by vendors.
GET /api/master_products?sort_by=price&sort_order=asc
Response is an array of all common products sorted by price in an ascending order.
GET /api/master_products?page=5&items_per_page=20
Response is an array of 20 common products from the 5th Products page.
GET /api/master_products/310
Response is the data of a common product with the id 310.
Field name | Values | Description |
---|---|---|
master_product_id | integer | ID of a common product to which the product belongs |
master_product_status | A D H |
The status of a common product to which the product belongs:
A for ActiveD for DisabledH for Hidden |
master_product_offers_count | integer | The current number of product offers that the common product has |
To create a new common product, send a POST
request to /api/master_products/
with required fields in JSON: product
, price
.
{ "product": "Common product name", "price": "100" } ``
This request creates a common product with minimum required details: a name, and a price.
The product has been created successfully: HTTP/1.1 201 Created and the JSON with the new product_id
. For example:
{ "product_id": 310 }
The product couldn’t be created: HTTP/1.1 400 Bad Request.
To update an existing common product, send the PUT
request to /api/master_products/:id/
. For example:
PUT /api/master_product/310
A product has a number of properties, represented by fields.
{
"product_code": "12345",
"price": "99.90",
"list_price": "110.00",
"category_ids": [223]
}
This request updates the Product Code, the List Price, the Price, and the Category of the particular Common Product.
product_id
.To delete a product, send a DELETE
request to /api/master_products/:id
. For example:
DELETE /api/master_products/310/
This request will delete the product with product_id=310
.
Questions & Feedback
Have any questions that weren't answered here? Need help with solving a problem in your online store? Want to report a bug in our software? Find out how to contact us.