Actions72
- Bài Viết Actions
- Blog Actions
- Bộ Sưu Tập Actions
- Khách Hàng Actions
- Đơn Hàng Actions
- Trang Actions
- Sản Phẩm Actions
- Biến Thể Sản Phẩm Actions
Đơn Hàng → Đếm
AI-generatedOverview
This node manages custom metafields on various resources within the Sapo platform, specifically supporting operations such as creating, retrieving, updating, deleting, counting, and validating metafields. For the resource "Đơn Hàng" (Orders), the node can count the number of metafields associated with a specific order ID, optionally filtered by additional criteria.
Common scenarios include:
- Counting how many custom metafields are attached to a particular order.
- Filtering metafields by namespace, key, or creation date range before counting.
- Integrating with workflows that need to verify the presence or quantity of metadata on orders for reporting or automation purposes.
Example use case:
- A user wants to know how many custom tags (metafields) have been added to an order to decide if further processing is needed.
Properties
| Name | Meaning |
|---|---|
| ID Tài Nguyên | The numeric ID of the resource (order) to operate on. |
| Thông Tin Bổ Sung | Additional optional filters applied when counting metafields: |
| - Namespace: Filter metafields by their namespace string. | |
| - Key: Filter metafields by their key string. | |
| - Tạo Sau (Created After): Only count metafields created after this datetime. | |
| - Tạo Trước (Created Before): Only count metafields created before this datetime. |
Output
The output JSON contains a single field:
count: A number representing how many metafields matched the given filters for the specified order resource.
Example output:
{
"count": 5
}
No binary data is produced by this operation.
Dependencies
- Requires an active connection to the Sapo API via an API authentication credential.
- The node depends on the internal
SapoApiBaseclass to interact with the metafields endpoints. - Proper configuration of the API credentials in n8n is necessary for successful execution.
Troubleshooting
Common issues:
- Invalid or missing resource ID will cause errors since the node requires a valid order ID.
- Incorrect API credentials or network issues may result in authentication or connectivity errors.
- Providing invalid filter values (e.g., malformed dates) could lead to request failures.
Error messages:
- Errors from the API are caught and returned as error messages in the output if "Continue On Fail" is enabled.
- Otherwise, the node throws an error with details including the message and stack trace.
Resolution tips:
- Verify the resource ID is correct and corresponds to an existing order.
- Check API credentials and network connectivity.
- Ensure date filters are in proper ISO 8601 format.
- Use "Continue On Fail" cautiously to handle partial failures gracefully.
Links and References
- Sapo API Documentation (general reference for metafield management)
- n8n documentation on creating custom nodes