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

Xác Thực

AI-generated

Overview

This node manages custom metafields on various resource types within the Sapo platform. Metafields are additional fields that extend the default data model of resources such as products, orders, customers, blogs, and more. The node supports operations like creating, retrieving, updating, deleting, counting, bulk deleting, listing, and validating metafields.

Typical use cases include:

  • Adding custom metadata to products or orders for enhanced filtering or reporting.
  • Validating metafield values before applying them.
  • Bulk deleting metafields based on filters.
  • Counting metafields matching certain criteria.

For example, a user might create a metafield to store warehouse location information on a product or validate a metafield value before saving it.

Properties

Name Meaning
Thao Tác (operation) The action to perform on the metafield. Options: "Xóa Hàng Loạt" (bulkDelete), "Đếm" (count), "Tạo Mới" (create), "Xóa" (delete), "Lấy Chi Tiết" (get), "Lấy Danh Sách" (getMany), "Cập Nhật" (update), "Xác Thực" (validate).
Tài Nguyên (resource) The type of resource the metafield belongs to. Options: Bài Viết (articles), Blog (blogs), Bộ Sưu Tập (collections), Khách Hàng (customers), Đơn Hàng (orders), Trang (pages), Sản Phẩm (products), Biến Thể Sản Phẩm (variants).
ID Tài Nguyên (resourceId) Numeric ID of the specific resource instance to operate on. Required.
ID Trường Tùy Chỉnh (metafieldId) Numeric ID of the metafield. Required for get, update, and delete operations.
Trả Về Tất Cả (returnAll) Boolean indicating whether to return all results when listing metafields. Only for getMany operation.
Giới Hạn (limit) Maximum number of results to return when not returning all. Only for getMany operation.
Thông Tin Bổ Sung (additionalFields) Additional filters or parameters such as namespace, key, creation date range for list, count, and bulkDelete operations.
Dữ Liệu Trường Tùy Chỉnh (data) JSON object containing metafield details like namespace, key, value, value_type, description. Required for create and update operations.
Tùy Chọn Xác Thực (validationData) JSON object specifying the type and value to validate. Required for validate operation.

Output

The node outputs an array with one element containing a json property. The structure of this JSON depends on the operation:

  • For create, get, update, getMany, count, and bulkDelete operations, the output contains the response from the Sapo API related to metafields, such as created metafield details, retrieved metafield(s), update confirmation, count number, or success status.
  • For delete, the output is { success: true } upon successful deletion.
  • For validate, the output is { valid: true } if the validation passes.
  • In case of errors (if not continuing on fail), the node throws an error; otherwise, it outputs { error: <error message> }.

The node does not output binary data.

Dependencies

  • Requires an active connection to the Sapo API via an API credential configured in n8n.
  • Uses an internal helper class to interact with the Sapo metafields API endpoints.
  • No other external dependencies detected.

Troubleshooting

  • Common issues:

    • Invalid or missing resource ID or metafield ID can cause API errors.
    • Incorrectly formatted JSON in data or validationData properties may lead to validation failures.
    • Insufficient permissions or invalid API credentials will result in authentication errors.
    • Using unsupported resource-operation combinations may cause unexpected errors.
  • Error messages:

    • Errors returned by the Sapo API are propagated with their message and stack trace.
    • If continueOnFail is enabled, errors are returned in the output JSON under the error key instead of stopping execution.
  • Resolutions:

    • Verify all required IDs and JSON inputs are correctly set.
    • Ensure API credentials have proper access rights.
    • Use the correct operation and resource combinations as per the node's options.

Links and References

Discussion