Sapo Trường Tùy Chỉnh icon

Sapo Trường Tùy Chỉnh

Quản lý trường tùy chỉnh trên Sapo

Blog → Đếm

AI-generated

Overview

This node manages custom metafields on various resources within the Sapo platform, such as blogs, articles, products, and more. Specifically for the Blog resource with the Count operation, it counts the number of metafields associated with a given blog post ID, optionally filtered by additional criteria like namespace, key, or creation date range.

Common scenarios include:

  • Quickly retrieving the count of custom fields attached to a specific blog post.
  • Filtering metafields by namespace or key to understand how many custom attributes exist under certain categories.
  • Using the count to decide whether to create new metafields or clean up existing ones.

Example use case:

  • A user wants to know how many metafields are assigned to a particular blog post to monitor metadata usage or enforce limits.

Properties

Name Meaning
ID Tài Nguyên The numeric ID of the blog post resource to count metafields for.
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 date/time.
- Tạo Trước (Created Before): Only count metafields created before this date/time.

Output

The output JSON contains a single field:

{
  "count": <number>
}
  • count: The total number of metafields matching the specified filters for the given blog post.

No binary data is output by this node.

Dependencies

  • Requires an active connection to the Sapo API via an API authentication credential configured in n8n.
  • The node depends on the internal Sapo API base class to perform metafield operations.
  • No other external services or environment variables are required beyond the API credential.

Troubleshooting

  • Common issues:

    • Invalid or missing blog post ID (resourceId) will cause errors or zero counts.
    • Incorrect namespace or key filters may result in unexpected counts (usually zero).
    • API authentication failures if the API key credential is not set or expired.
  • Error messages:

    • Errors from the Sapo API (e.g., "Resource not found" or "Unauthorized") will be thrown as node errors.
    • If "Continue On Fail" is enabled, errors will appear in the output JSON under an error field with the message.
  • Resolutions:

    • Verify the blog post ID exists and is correct.
    • Check that the API credential is valid and has sufficient permissions.
    • Adjust filter fields carefully to match existing metafield namespaces and keys.

Links and References

Discussion