Actions11
Overview
This node manages product collections on the Sapo e-commerce platform. It supports operations to create, update, delete, and retrieve both custom and smart collections, as well as manage products within these collections. Typical use cases include automating collection management workflows such as updating collection details, organizing products in a collection, or syncing collections with external data sources.
Practical examples:
- Automatically creating a new custom collection with a specific title and description.
- Updating an existing smart collection’s rules based on changing product attributes.
- Adding or removing products from a collection programmatically.
- Reordering products within a collection to control their display order on the storefront.
Properties
| Name | Meaning |
|---|---|
| ID Bộ Sưu Tập | The numeric ID of the collection to operate on (required for many operations). |
| Dữ Liệu Bộ Sưu Tập Tùy Chỉnh | JSON object containing data to create or update a custom collection, e.g., title, description, published status. |
| Thao Tác | The operation to perform, options include: addProduct, count, createCustom, createSmart, deleteCustom, deleteSmart, get, getMany, removeProduct, setProductOrder, updateCustom, updateSmart. |
| ID Sản Phẩm | Numeric ID of the product to add or remove from a collection (used in addProduct and removeProduct). |
| Danh Sách ID Sản Phẩm | Comma-separated string of product IDs specifying the desired order within a collection (used in setProductOrder). |
| Trả Về Tất Cả | Boolean indicating whether to return all results when listing collections (getMany operation). |
| Giới Hạn | Maximum number of results to return when not returning all (getMany operation). |
| Thông Tin Bổ Sung | Additional optional filters for listing collections, such as handle, published status, updated date ranges. |
Output
The node outputs a JSON object representing the result of the performed operation:
- For create, update, get, and list operations, the output contains the collection data returned by the Sapo API.
- For delete, addProduct, removeProduct operations, the output is a simple success confirmation
{ success: true }. - For setProductOrder, the output returns the updated collection data reflecting the new product order.
- For count operation, the output contains
{ count: <number> }indicating the total number of collections.
No binary data output is produced by this node.
Dependencies
- Requires an active connection to the Sapo API via an API key credential configured in n8n.
- Uses the internal
SapoApiBasehelper class to interact with the Sapo collections endpoints. - No additional external dependencies beyond the Sapo API and n8n environment.
Troubleshooting
Common issues:
- Invalid or missing collection or product IDs will cause API errors.
- Malformed JSON in the "Dữ Liệu Bộ Sưu Tập Tùy Chỉnh" property can lead to request failures.
- Insufficient permissions or invalid API credentials will result in authentication errors.
- Using unsupported operations or omitting required parameters will throw errors.
Error messages:
- Errors from the Sapo API are caught and either thrown or returned as error objects if "Continue On Fail" is enabled.
- Typical error messages include "Not Found" for invalid IDs, "Unauthorized" for credential issues, or validation errors for bad input data.
Resolution tips:
- Verify that all required fields are provided and correctly formatted.
- Ensure the API key credential has appropriate permissions.
- Use the "Continue On Fail" option to handle errors gracefully in workflows.
Links and References
- Sapo API Documentation (official API docs for collections)
- n8n documentation on creating custom nodes
- JSON formatting tools for preparing collection data payloads