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
Bộ Sưu Tập → Đếm
AI-generatedOverview
This node manages custom metafields on various resource types within the Sapo platform. Metafields are additional metadata fields that can be attached to resources such as collections, products, orders, customers, and more. The node supports operations like counting, creating, updating, deleting, retrieving single or multiple metafields, bulk deletion, and validation of metafield values.
A common use case is to extend the default data model of Sapo resources by adding custom attributes (metafields) for enhanced filtering, reporting, or integration purposes. For example, you might count how many metafields exist on a specific collection filtered by namespace or key, or create a new metafield to store warehouse location information on a product.
Properties
| Name | Meaning |
|---|---|
| ID Tài Nguyên | Numeric ID of the resource (e.g., collection) on which the metafield operation will be performed. |
| Thông Tin Bổ Sung | Additional optional filters or parameters depending on the operation: |
| - Namespace: Filter metafields by their namespace string. | |
| - Key: Filter metafields by their key string. | |
| - Tạo Sau (Created After): Filter metafields created after this date/time. | |
| - Tạo Trước (Created Before): Filter metafields created before this date/time. |
Note on Operation "Đếm" (Count)
- Requires
ID Tài Nguyênto specify the resource. - Supports optional filters in
Thông Tin Bổ Sungto narrow down which metafields to count.
Output
The output JSON structure depends on the operation but for the "Đếm" (Count) operation specifically, the output JSON contains:
{
"count": <number>
}
Where <number> is the total count of metafields matching the specified resource and any applied filters.
For other operations, the output JSON varies:
- For retrieval operations, it returns metafield objects or lists.
- For creation or update, it returns the created/updated metafield object.
- For delete operations, it returns a success flag.
- For validation, it returns
{ "valid": true }.
If an error occurs and the node is configured to continue on failure, the output JSON will contain an error field with the error message.
Dependencies
- Requires an API credential for authenticating with the Sapo platform.
- Uses an internal Sapo API base class to perform REST API calls to manage metafields.
- No additional external dependencies beyond the Sapo API access.
Troubleshooting
Common issues:
- Invalid or missing resource ID (
ID Tài Nguyên) will cause API errors. - Incorrect filter values in
Thông Tin Bổ Sungmay result in empty results or errors. - Insufficient permissions or invalid API credentials will cause authentication failures.
- Providing malformed JSON in data fields (for create/update) or validation data will cause parsing or validation errors.
- Invalid or missing resource ID (
Error messages:
- Errors from the Sapo API are surfaced with their message; ensure the resource exists and the IDs are correct.
- Validation errors indicate incorrect value types or formats for metafields.
- Network or authentication errors suggest checking API credentials and connectivity.
To handle errors gracefully, enable "Continue On Fail" in the node settings to capture errors in the output instead of stopping execution.
Links and References
- Sapo Platform API Documentation (general reference for metafield management)
- n8n documentation on Custom Nodes and Credentials
- Concepts of metafields in e-commerce platforms for extending resource data models.