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
Sản Phẩm → Đếm
AI-generatedOverview
This node manages custom metafields on Sapo resources, specifically supporting operations such as creating, retrieving, updating, deleting, counting, and validating metafields. For the "Sản Phẩm" (Products) resource with the "Đếm" (Count) operation, it counts the number of metafields associated with a specific product ID, optionally filtered by additional criteria like namespace, key, or creation date range.
Common scenarios:
- Quickly determining how many custom metafields are attached to a particular product.
- Filtering metafields by namespace or key to count only relevant metadata entries.
- Using counts for reporting or conditional logic in workflows based on the presence or absence of certain metafields.
Practical example:
You want to know how many inventory-related metafields exist for a product with ID 12345 to decide if you need to add more detailed stock location data.
Properties
| Name | Meaning |
|---|---|
| ID Tài Nguyên | The numeric ID of the product resource to target for counting metafields. |
| Thông Tin Bổ Sung | Additional optional filters to refine the count query: |
| - 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": <number>
}
count: The total number of metafields matching the specified filters for the given product resource ID.
No binary data is produced by this operation.
Dependencies
- Requires an active connection to the Sapo API via an API authentication credential configured in n8n.
- The node depends on the internal
SapoApiBaseclass to interact with the metafields endpoint of the Sapo API. - Proper permissions on the Sapo account to read metafields for products.
Troubleshooting
Common issues:
- Invalid or missing product ID (
ID Tài Nguyên) will cause errors or zero counts. - Incorrect namespace or key filters may result in unexpected zero counts.
- API authentication failures due to invalid or expired credentials.
- Date filter formats must be valid ISO datetime strings; otherwise, the API may reject the request.
- Invalid or missing product ID (
Error messages:
- Errors from the Sapo API will be surfaced with their message. For example, "Resource not found" if the product ID does not exist.
- Authentication errors indicating invalid API keys or insufficient permissions.
- Validation errors if date filters are malformed.
Resolutions:
- Verify the product ID exists in your Sapo store.
- Double-check namespace and key spelling and casing.
- Ensure API credentials are correctly set up and have required scopes.
- Use proper ISO 8601 format for date/time fields.
Links and References
- Sapo API Documentation (general reference for metafield endpoints)
- n8n documentation on creating custom nodes