Sapo Bộ Sưu Tập icon

Sapo Bộ Sưu Tập

Quản lý bộ sưu tập sản phẩm trên Sapo

Overview

This node manages product collections on the Sapo e-commerce platform. It supports creating, updating, retrieving, deleting, and organizing both custom and smart collections of products. Users can add or remove products from collections, reorder products within a collection, and count total collections.

Common scenarios include:

  • Automating the creation of themed product collections (e.g., seasonal sales).
  • Updating collection details or rules dynamically based on inventory changes.
  • Managing product placement order within collections for optimized storefront display.
  • Removing obsolete collections or products from collections programmatically.

Example: Automatically create a "Summer Sale" custom collection with specific products added and ordered, then update it weekly.

Properties

Name Meaning
operation The action to perform on collections. Options: Add Product, Count, Create Custom, Create Smart, Delete Custom, Delete Smart, Get, Get Many, Remove Product, Set Product Order, Update Custom, Update Smart
collectionId ID of the collection to operate on (required for most operations except count and getMany)
productId ID of the product to add or remove from a collection (required for addProduct and removeProduct)
productIds Comma-separated list of product IDs in desired order (used for setProductOrder)
returnAll Boolean indicating whether to return all results or limit them (used in getMany)
limit Maximum number of results to return when returnAll is false (used in getMany)
additionalFields Additional filters for listing collections such as handle (URL identifier), published status (published, unpublished, any), updated_at_min, updated_at_max (used in getMany)
data JSON object containing collection data for creating or updating collections. For custom collections, includes fields like title, body_html, published; for smart collections, includes title and rules array

Output

The node outputs an array with one item containing a json field representing the result of the operation:

  • For retrieval operations (get, getMany), the output contains collection details or lists of collections.
  • For creation and update operations, the output contains the newly created or updated collection data.
  • For deletion, addition/removal of products, and reordering, the output contains a success confirmation { success: true }.
  • For the count operation, the output contains { count: <number> }.

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 SapoApiBase class to interact with Sapo's collections endpoints.
  • No other external services are required beyond the Sapo API.

Troubleshooting

  • Common issues:

    • Invalid or missing collection or product IDs will cause API errors.
    • Providing malformed JSON in the data property for create/update operations may lead to request failures.
    • Attempting to delete or update non-existent collections will result in errors.
    • Using incorrect operation names or missing required parameters will cause the node to throw errors.
  • Error messages:

    • Errors returned from the Sapo API are surfaced with their message and stack trace.
    • If continueOnFail is enabled, errors are returned as part of the output JSON under an error field instead of stopping execution.
  • Resolution tips:

    • Ensure all required IDs and JSON data are correctly provided.
    • Validate JSON syntax before inputting into the node.
    • Confirm that the API credentials have sufficient permissions.
    • Use the returnAll and limit properties appropriately to avoid large data loads.

Links and References

Discussion