Overview
This node manages product categories from the KiotViet platform. It allows users to create new categories, retrieve category details by ID, list all categories with optional filtering and pagination, and update existing categories. This is useful for automating inventory or catalog management workflows where synchronization or manipulation of product categories in KiotViet is required.
Practical examples include:
- Automatically creating new product categories when adding products in another system.
- Fetching detailed information about a specific category by its ID for reporting or integration purposes.
- Retrieving a paginated list of categories to synchronize with an external database.
- Updating category details such as name, description, or attributes based on changes in another system.
Properties
| Name | Meaning |
|---|---|
| Thao Tác (operation) | The action to perform: "Tạo Mới" (create), "Lấy Theo ID" (get), "Lấy Danh Sách" (getAll), "Cập Nhật" (update) |
| ID Danh Mục (categoryId) | The unique identifier of the category; required for "get" and "update" operations. |
| Tên Danh Mục (name) | The name of the category; required for "create" and "update" operations. |
| Trả Về Tất Cả (returnAll) | Boolean flag to return all results or limit them; used in "getAll" operation. |
| Giới Hạn (limit) | Maximum number of results to return; applies when "returnAll" is false in "getAll". |
| Trường Bổ Sung (additionalFields) | Additional optional fields for "create" and "update": - Mã Danh Mục (categoryCode): Category code, auto-generated if empty. - ID Danh Mục Cha (parentId): Parent category ID for subcategories. - 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. |
| Bộ Lọc (filters) | Filters for "getAll" operation: - Trang (pageSize): Number of results per page. - Số Trang (currentPage): Current page number. - Từ Khóa (searchTerm): Search term for category name or code. - ID Danh Mục Cha (parentId): Filter by parent category ID. |
Output
The node outputs JSON data representing the category information returned by the KiotViet API:
- For create: JSON object of the newly created category.
- For get: JSON object of the category identified by the given ID.
- For getAll: JSON object containing:
data: Array of category objects.total: Total number of categories matching the filter.pageSize: Number of items per page.currentPage: Current page number.
- For update: JSON object of the updated category.
No binary data output is produced by this node.
Dependencies
- Requires an active connection to the KiotViet API via an API key credential configured in n8n.
- Uses the internal KiotViet API helper class to handle requests.
- Network access to KiotViet's endpoints is necessary.
Troubleshooting
Common issues:
- Invalid or missing API credentials will cause authentication failures.
- Providing non-integer values for IDs or numeric fields like
parentIdororderIndexmay cause errors. - Attempting to update a category when the API does not support it will throw an error.
- Pagination parameters must be valid numbers; otherwise, the API may reject the request.
Error messages:
"Update operation is not supported by the KiotViet API": Indicates that the current API version or endpoint does not allow updates; verify API capabilities.- Errors related to invalid IDs or missing required parameters: Ensure all required fields are provided and correctly formatted.
- Network or authentication errors: Check API key validity and network connectivity.
Links and References
- KiotViet Official API Documentation (for detailed API usage and limitations)
- n8n documentation on creating custom nodes