When one thinks of an online store or marketplace, the first thing that usually comes to mind is the products. These are the heart of any e-commerce platform. Within the Venddor IO system, administrators have the power to curate an array of products, updating or removing them as needed. However, it's essential to understand that these product manipulations are behind the scenes, away from the customer's eye. Customers experience these products via the storefront, where they can view and make purchases, but they don't interact with them through the API directly.
In the digital shopping ecosystem of Venddor IO, a product isn't just confined to being an item on a shelf. It plays a dynamic role, especially when it transitions into carts or becomes part of orders, establishing the entire shopping journey.
Now, let's delve into the concept of Product Variations. Consider products that are essentially the same but have minor distinctions, like color or size, which are tied to specific product features. Venddor IO innovatively groups these under "Product Variation Groups." This grouping is more than just an organizational tool. It elevates the shopping experience, enabling customers to seamlessly toggle between variations on the storefront. Rather than navigating to a new page for each variation, they can smoothly transition to their desired product feature on the same page, ensuring a more streamlined and user-friendly shopping experience.
When diving into the digital realm of online commerce, products act as the backbone. To effectively interact with this core element within Venddor IO, certain API endpoints and parameters are available.
Getting a Glimpse of All Products:
Shoot a simple GET request to /api/products/. The number of products that grace your screen will depend on the items_per_page parameter. This parameter is flexible; you can alter its value either directly through the API or indirectly via the Admin panel under Settings → Appearance.
If your aim is zoned in on products within a specific category, then direct your GET request towards /api/categories/:id/products/. Here, :id stands for the desired category's unique identifier.
Venddor IO ensures that you're never overwhelmed with data. With an array of parameters, you can choose exactly which products you want to see and in what order:
page parameter lets you navigate through product lists page by page.items_per_page parameter, decide how many products you'd like to view at once.sort_by and sort_order jointly determine the sequence in which products appear. Whether you want to see products based on their date, price, or any other attribute, and in ascending or descending order, it's all at your fingertips.price_from, status, product_type, and others act as fine-tuned search tools, ensuring you find precisely what you're looking for.GET /api/stores/<company_id>/products/
GET api/vendors/<vendor_id>/products
GET /api/stores/1/products?price_from=10&sort_by=product&sort_order=asc&pname=foo
Navigating through online marketplaces and stores, products serve as the linchpin. When interacting with these essential components within Venddor IO, it's helpful to understand the structure and significance of the API responses you'll encounter.
Consider this basic request to fetch a limited list of products:
GET /api/products?items_per_page=2
Upon firing this request, the system responds with a neatly formatted JSON, which we'll dissect below:
This section provides a detailed array of products fetched from the system. Each product comes equipped with essential attributes. For instance:
product_id provides the unique identifier.product indicates the product name.product_type and many others offer specifics about the product.main_pair and detailed collectively offer comprehensive details about the product's imagery.The tail-end of the response offers a glimpse into the parameters applied during the request. Here's a rundown:
area, extend, and custom_extend provide context about the response's scope and its depth.items_per_page reflects the number of products fetched in the request, which, in this case, is 2.sort_by and sort_order.subcats, hide_out_of_stock_products, and others provide granular control over the search and display settings.To retrieve detailed data on a single product, initiate a GET request as follows:
GET /api/products/<product_id>/
For instance:
GET /api/products/12
To hone in on a specific product housed under a distinct category, utilize the following structure:
GET /api/categories/:id/products/:id
Example:
GET /api/categories/229/products/12
In Venddor IO, products encompass a wide range of properties that are encapsulated as fields. The platform always communicates using strings and array/objects for a consistent and reliable experience. Here's a glimpse of what to expect:
product (product name), company_id (store or vendor ID), and product_id (product ID) offer core details.price, list_price, and amount give insight into the product's cost and stock status.box_height, box_width, and box_length provide the physical dimensions.seo_name, status, and localization govern how the product is presented and accessed online.is_edp and unlimited_download cater to electronic downloadable products.main_pair and associated attributes contain the product's imagery details.Initiating a sample request:
GET request to /api/products/12
Yields a comprehensive JSON response. For example:
{
"product_id": "12",
"product": "100g Pants",
...
"seo_name": "100g-pants",
"seo_path": "223/224",
...
"main_pair":
{
"pair_id": "823",
...
"detailed":
{
...
"image_path": "https://example.com/images/detailed/0/173283_0113298267324f438bac97eaf.jpg",
...
}
},
...
}
Venddor IO streamlines product addition via simple POST requests:
Use the endpoint:
POST /api/stores/<company_id>/products/
The endpoint is:
POST /api/products/
A basic product requires just three attributes: a name, its main category ID, and a price. The structure would resemble:
{
"product": "Product Name",
"category_ids": "166",
"price": "1000"
}
Each vendor in stores using Venddor Seller Center is treated as an independent entity. If you're aiming to list a product under a specific vendor, you need to include their unique vendor_id. An example for a vendor with ID 1:
POST /api/vendors/1/products/
{
"product": "Vendor's Product Name",
"category_ids": "166",
"price": "1000"
}
Venddor IO allows products to be associated with multiple images. The primary image is specified under the main_pair object, whereas additional images fall under image_pairs. Images can be sourced from URLs or uploaded directly to your server. Here's an illustrative breakdown:
{
"product": "Product Name",
...
"image_pairs": {...},
"main_pair": {...}
}
If the product creation process succeeds, the server returns:
HTTP/1.1 201 Created
With a JSON payload confirming the product's ID, for example: { "product_id": 391 }.
However, if there are issues, the system will respond with a HTTP/1.1 400 Bad Request.
Venddor IO makes product modification straightforward with PUT requests. For instance, to modify a product with ID 12:
PUT /api/product/12
You can adjust numerous attributes, ranging from basic details such as the product name, price, and quantity to more intricate elements like imagery and features.
Product deletion in Venddor IO is achieved through DELETE requests. If you wish to remove a product with ID 12, for example:
DELETE /api/products/12/
Successful product deletion yields:
HTTP/1.1 204 No Content
Whereas a failed deletion or attempt to delete a non-existent product results in error messages like HTTP/1.1 400 Bad Request or HTTP/1.1 404 Not Found respectively.