Overview
This node manages price rules and discounts on the Sapo e-commerce platform. It allows users to create, retrieve, update, delete, count, and list price rules that define discounts or pricing conditions for products or orders.
Common scenarios where this node is useful include automating promotional campaigns, managing seasonal sales, or applying targeted discounts based on customer segments or product categories.
For example, a user can create a new price rule offering a 20% discount during summer, retrieve details of an existing price rule by its ID, update a price rule’s parameters, or delete obsolete price rules.
Properties
| Name | Meaning |
|---|---|
| Thao Tác | The operation to perform: Count, Create, Delete, Get (retrieve), Get Many (list), Update |
| ID Quy Tắc Giá | The unique numeric identifier of the price rule (required for get, update, delete operations) |
| Trả Về Tất Cả | Boolean flag indicating whether to return all results when listing price rules |
| Giới Hạn | Maximum number of price rules to return when not returning all |
| Thông Tin Bổ Sung | Additional filters for listing price rules, including status (active, disabled, expired), title, creation date range |
| Dữ Liệu Quy Tắc Giá | JSON object containing the data for creating or updating a price rule, such as title, discount value, start/end dates, target customers, etc. |
Output
The node outputs a JSON object representing the result of the performed operation:
- For create, get, update: The full details of the affected price rule.
- For delete: A success confirmation
{ success: true }. - For getMany: A list of price rules matching the criteria.
- For count: An object with the total count of price rules
{ count: number }.
No binary data output is produced by this node.
Dependencies
- Requires an API key credential for authenticating with the Sapo platform.
- Depends on the internal
SapoApiBaseclass to interact with Sapo's price rules API endpoints. - No additional environment variables are explicitly required beyond the API authentication.
Troubleshooting
Common issues:
- Providing an invalid or missing price rule ID for get, update, or delete operations will cause errors.
- Incorrectly formatted JSON in the "Dữ Liệu Quy Tắc Giá" property may lead to request failures.
- Network or authentication errors if the API key is invalid or missing.
Error messages:
- Errors from the Sapo API are caught and returned as error messages in the output if "Continue On Fail" is enabled.
- Otherwise, the node throws an error with the message and stack trace.
Resolutions:
- Ensure the price rule ID is correct and exists.
- Validate JSON input before running the node.
- Verify API credentials and network connectivity.
Links and References
- Sapo API Documentation (general reference for Sapo API)
- n8n documentation on creating custom nodes