Danh Mục KiotViet icon

Danh Mục KiotViet

Quản lý danh mục sản phẩm từ KiotViet

Overview

This node manages product categories from the KiotViet platform. It allows users to create new categories, retrieve a single category by ID, update existing categories, or fetch a list of categories with optional filtering and pagination.

Common scenarios include:

  • Synchronizing product categories from KiotViet into another system.
  • Automating category creation or updates based on external data.
  • Retrieving category lists for reporting or further processing.

For example, you can use this node to get all categories that belong to a specific parent category or search categories by name or code.

Properties

Name Meaning
Thao Tác (operation) The action to perform: Create new category, Get category by ID, Get list of categories, Update category. Options: "Tạo Mới", "Lấy Theo ID", "Lấy Danh Sách", "Cập Nhật".
ID Danh Mục (categoryId) The unique identifier of the category. Required for "Lấy Theo ID" and "Cập Nhật" operations.
Tên Danh Mục (name) The name of the category. Required for "Tạo Mới" and "Cập Nhật" operations.
Trả Về Tất Cả (returnAll) Boolean flag indicating whether to return all results when listing categories ("Lấy Danh Sách"). If false, limits results by "Giới Hạn".
Giới Hạn (limit) Maximum number of results to return when listing categories. Only used if "Trả Về Tất Cả" is false. Minimum value is 1.
Bộ Lọc (filters) Collection of filters applied when listing categories:
- Trang (pageSize): Number of results per page.
- Số Trang (currentPage): Current page number.
- Từ Khóa (searchTerm): Search term to filter by category name or code.
- ID Danh Mục Cha (parentId): Filter by parent category ID.
Trường Bổ Sung (additionalFields) Additional optional fields for creating or updating categories:
- Mã Danh Mục (categoryCode): Category code; auto-generated if empty.
- ID Danh Mục Cha (parentId): Parent category ID if this is a subcategory.
- Mô Tả (description): Description of the category.
- Thứ Tự Hiển Thị (orderIndex): Display order index.
- Thuộc Tính (attributes): List of custom attributes, each with a name and value.

Output

The node outputs JSON data representing the category or categories retrieved or affected:

  • For create, get, and update operations, the output is a JSON object representing the single category created, fetched, or updated.
  • For the getAll operation, the output is an object containing:
    • data: An array of category objects matching the filters.
    • total: Total number of categories available.
    • pageSize: Number of results per page.
    • currentPage: The current page number.

Each category object includes fields such as category name, ID, code, description, parent ID, order index, and any custom attributes.

The node does not output binary data.

Dependencies

  • Requires an API key credential to authenticate with the KiotViet API.
  • Uses a shared KiotViet API helper class internally to handle requests.
  • No additional environment variables are required beyond the API credential configuration in n8n.

Troubleshooting

  • Error: Update operation is not supported by the KiotViet API
    This error occurs if the underlying API client does not implement the update method. Ensure your KiotViet API version supports category updates.

  • API authentication errors
    Verify that the API key credential is correctly configured and has sufficient permissions.

  • Empty or incomplete results when listing categories
    Check the filter parameters, especially pageSize, currentPage, and searchTerm. Also verify if returnAll is set appropriately.

  • Invalid input types
    Make sure numeric fields like categoryId, pageSize, currentPage, and orderIndex receive valid numbers.

  • Continue On Fail behavior
    If enabled, the node will continue processing other items even if one fails, returning error messages in the output JSON.

Links and References

Discussion