Category Management in Venddor IO

Introduction to Categories

Venddor IO provides a robust API for managing product categories, making it easier for businesses to organize and access products. This guide explains how to leverage this functionality to create, retrieve, update, and delete categories in your store.

Well-organized categories improve customer navigation and can significantly enhance the shopping experience. The Categories API allows you to programmatically manage your store's category structure.

API Endpoints for Categories

  1. All Categories:
    URL: http://example.com/api/categories
    Purpose: Retrieve all categories
    Supported Methods: GET, POST
  2. Specific Category:
    URL: http://example.com/api/categories/:id
    Purpose: Access details of a specific category
    Supported Methods: GET, PUT, DELETE
  3. Products Within a Category:
    URL: http://example.com/api/categories/:id/products
    Purpose: Access all products within a specified category
  4. Specific Product Within a Category:
    URL: http://example.com/api/categories/:id/products/:id
    Purpose: Access a specific product within a particular category

Pagination Options

Venddor IO offers pagination capabilities, facilitating easy retrieval of categories based on specific criteria:

Pagination Parameter Description
page The page number of results to display (default: 1)
items_per_page Number of categories to display per page (default: 10)

Examples:

Fetch 10 categories from the 5th page:
http://example.com/api/categories?page=5

Retrieve 20 categories from the first page:
http://example.com/api/categories?items_per_page=20

Access 20 categories from the 5th page:
http://example.com/api/categories?page=5&items_per_page=20

Field Descriptions for Categories

Each category within Venddor IO has distinct attributes, denoted as fields. Mandatory fields are marked with an asterisk (*). Any unspecified field in an API request will be overlooked.

Field Name Description Default Value Supported Values
category* The category's name String
company_id* ID indicating which store or vendor owns the category Default company ID Integer
status* Denotes the category's visibility status A A (Active), D (Disabled), H (Hidden)
age_limit Restriction value for age access, specified in years 0 Integer
parent_id ID of the parent category 0 (root category ID) Integer
position Specifies the category's order in a list Auto-set Integer

Always provide the required fields marked with an asterisk (*) when creating or updating categories. Missing mandatory fields will result in an error response.

Working with Categories

Creating a Category

To create a new category, send a POST request to the categories endpoint with the required data:

POST /api/categories/
{
  "category": "New Electronics",
  "status": "A",
  "parent_id": 0
}

Updating a Category

To modify an existing category, send a PUT request:

PUT /api/categories/42
{
  "category": "Updated Electronics",
  "position": 3
}

Deleting a Category

To remove a category, send a DELETE request:

DELETE /api/categories/42

When you delete a category with subcategories, those subcategories will be reassigned to the parent of the deleted category.