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 allows users to create, update, delete, and retrieve both custom and smart collections, as well as manage products within those collections. Common scenarios include organizing products into thematic groups, updating collection details, removing products from collections, or reordering products for display purposes.

Practical examples:

  • Creating a new custom collection with a specific title and description.
  • Adding or removing a product from an existing collection by specifying their IDs.
  • Deleting a smart collection that is no longer needed.
  • Retrieving a list of collections with filters such as publication status or update date.
  • Setting the order of products within a collection to control how they appear in the store.

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 the number (used in getMany)
limit Maximum number of results to return when returnAll is false (used in getMany)
additionalFields Additional filters for listing collections, including:
- Handle: URL-friendly identifier
- Published Status: published, unpublished, or any
- Updated At Min/Max: date range filters
data JSON object containing data to create or update a collection. For custom collections, includes fields like title, body_html, published; for smart collections, includes rules defining the collection logic

Output

The node outputs a JSON object representing the result of the performed operation:

  • For retrieval operations (get, getMany), it returns collection details or lists of collections.
  • For creation and update operations, it returns the newly created or updated collection data.
  • For deletion, addition, removal, and reorder operations, it returns a success confirmation object { success: true }.
  • For the count operation, it returns an object with the total count of collections { 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 Sapo API base class to handle HTTP requests to Sapo endpoints.
  • No additional external services are required beyond access to the Sapo API.

Troubleshooting

  • Common issues:

    • Invalid or missing collection or product IDs can cause errors.
    • Incorrectly formatted JSON in the data property may lead to request failures.
    • Network or authentication errors if the API key is invalid or expired.
  • Error messages:

    • Errors returned from the Sapo API will be surfaced with their message and stack trace.
    • If continueOnFail is enabled, errors will be included in the output JSON under an error field instead of stopping execution.
  • Resolutions:

    • Verify that all required IDs are correct and exist in the Sapo system.
    • Ensure JSON data is valid and matches expected schema for collections.
    • Check API credentials and network connectivity.

Links and References

Discussion