Actions11
Overview
This node manages product collections on the Sapo e-commerce platform. It supports a variety of operations such as creating, updating, deleting, and retrieving both custom and smart collections, as well as managing products within those collections (adding, removing, ordering). This node is useful for automating collection management workflows, syncing collections with external systems, or bulk updating collections based on business rules.
Practical examples:
- Automatically create a new custom collection with specific metadata.
- Retrieve detailed information about a particular collection by its ID.
- Add or remove products from a collection programmatically.
- Update the order of products within a collection to control display priority.
- Count total collections available in the store.
Properties
| Name | Meaning |
|---|---|
| Thao Tác (operation) | The action to perform on collections. Options include: addProduct, count, createCustom, createSmart, deleteCustom, deleteSmart, get, getMany, removeProduct, setProductOrder, updateCustom, updateSmart. |
| ID Bộ Sưu Tập (collectionId) | Numeric ID of the collection to operate on. Required for most operations except listing and counting. |
| ID Sản Phẩm (productId) | Numeric ID of the product to add or remove from a collection. Required for addProduct and removeProduct operations. |
| Danh Sách ID Sản Phẩm (productIds) | Comma-separated string of product IDs specifying the desired order within a collection. Used in setProductOrder operation. |
| Trả Về Tất Cả (returnAll) | Boolean flag indicating whether to return all collections when listing (getMany) or limit results. |
| Giới Hạn (limit) | Maximum number of collections to return when listing and returnAll is false. Minimum 1. |
| Thông Tin Bổ Sung (additionalFields) | Additional filters for listing collections, including handle (URL-friendly identifier), published status (published, unpublished, any), updated_at_min, and updated_at_max timestamps. |
| Dữ Liệu Bộ Sưu Tập Tùy Chỉnh (data) | JSON object containing data to create or update a custom collection, e.g., title, description, published status. Required for createCustom and updateCustom operations. |
| Dữ Liệu Bộ Sưu Tập Thông Minh (data) | JSON object containing data to create or update a smart collection, including title and rules defining the smart collection criteria. Required for createSmart and updateSmart operations. |
Output
The node outputs an array with one item containing a json field representing the result of the performed operation:
- For retrieval operations (
get,getMany), the output contains collection details or a list of collections matching the query. - For creation and update operations, the output includes the newly created or updated collection data.
- For deletion and product management operations (
deleteCustom,deleteSmart,addProduct,removeProduct), the output returns{ success: true }upon successful completion. - For
countoperation, the output contains{ count: <number> }indicating the total number of collections. - For
setProductOrder, the output returns the updated collection data reflecting the new product order.
No binary data output is produced by this node.
Dependencies
- Requires an API key credential for authenticating with the Sapo platform's API.
- Depends on the internal
SapoApiBaseclass to interact with the Sapo API endpoints related to collections. - No additional external services are required beyond access to the Sapo API.
Troubleshooting
Common issues:
- Invalid or missing collection or product IDs will cause API errors.
- Incorrectly formatted JSON in the
dataproperty for create/update operations may lead to request failures. - Network or authentication errors if the API key credential is invalid or expired.
- Using unsupported operations or omitting required parameters for an operation.
Error messages:
- Errors returned from the Sapo API are wrapped and thrown as node errors with message and stack trace.
- If "Continue On Fail" is enabled, errors are returned in the output as
{ error: "<message>" }instead of stopping execution.
Resolutions:
- Verify that all required parameters are provided and correctly formatted.
- Ensure the API key credential is valid and has necessary permissions.
- Check network connectivity to the Sapo API endpoint.
- Use the node’s built-in error messages and stack traces to identify issues.
Links and References
- Sapo API Documentation (official API docs for collections and products)
- n8n documentation on creating custom nodes