Overview
This node manages price rules and discounts on the Sapo platform. It allows users to create, retrieve, update, delete, count, and list price rules that define discounts or pricing strategies for products or orders.
A common use case is automating discount campaigns, such as seasonal sales or customer-specific promotions. For example, a user can create a "Summer Sale" price rule offering 20% off all line items between June and August, or retrieve a list of active price rules to display in a dashboard.
The "Lấy Danh Sách" (Get Many) operation specifically fetches multiple price rules with options to filter by status, title, creation date range, and control how many results are returned.
Properties
| Name | Meaning |
|---|---|
| Trả Về Tất Cả | Boolean option to return all matching price rules or limit the number of results returned. |
| Giới Hạn | Maximum number of price rules to return when not returning all. |
| Thông Tin Bổ Sung | Additional filters to refine the list of price rules: |
| - Trạng Thái: Filter by status — Đang Hoạt Động (active), Vô Hiệu Hóa (disabled), Hết Hạn (expired) | |
| - Tiêu Đề: Filter by title string. | |
| - Tạo Sau: Filter price rules created after this date/time. | |
| - Tạo Trước: Filter price rules created before this date/time. |
Output
The output JSON contains the retrieved price rules data from the Sapo API. For the "Lấy Danh Sách" operation, it returns an array of price rule objects matching the specified filters and limits.
Each item in the output JSON typically includes details such as:
- Price rule ID
- Title
- Status
- Discount value and type
- Start and end dates
- Customer and target selections
No binary data is output by this node.
Dependencies
- Requires an API key credential for authenticating with the Sapo platform.
- Uses the Sapo API base class internally to perform REST API calls.
- The node expects proper configuration of the Sapo API credentials within n8n.
Troubleshooting
Common issues:
- Invalid or missing API credentials will cause authentication failures.
- Providing invalid filter values (e.g., incorrect date formats) may result in API errors.
- Requesting too many results without enabling "Trả Về Tất Cả" might lead to incomplete data.
Error messages:
- Errors from the Sapo API are caught and either thrown or returned as error JSON depending on the "Continue On Fail" setting.
- Typical errors include "Unauthorized" (check API key), "Not Found" (invalid price rule ID), or validation errors on input parameters.
Resolution:
- Verify API credentials and permissions.
- Ensure input parameters match expected types and formats.
- Use "Trả Về Tất Cả" carefully to avoid performance issues.