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

Bộ Sưu Tập → Xác Thực

AI-generated

Overview

This node manages custom metafields on various resource types within the Sapo platform. It allows users to create, retrieve, update, delete, count, and validate metafields associated with resources such as collections, products, orders, blogs, and more.

A common use case is enriching resource data by adding custom fields (metafields) that store additional metadata not covered by default properties. For example, a user might add a "warehouse_location" metafield to a product to track inventory storage details.

The Validate operation specifically checks if a given value for a metafield meets certain criteria without modifying any data, useful for pre-validation before updates or creations.

Properties

Name Meaning
Thao Tác (operation) The action to perform on the metafield. Options: Create, Get, Get Many, Update, Delete, Bulk Delete, Count, 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, delete operations)
Trả Về Tất Cả (returnAll) Boolean indicating whether to return all results when listing metafields (getMany operation)
Giới Hạn (limit) Maximum number of metafields to return when not returning all (getMany operation)
Thông Tin Bổ Sung (additionalFields) Additional filters or parameters such as namespace, key, creation date range for list, bulk delete, and count operations
Dữ Liệu Trường Tùy Chỉnh (data) JSON object defining metafield properties like namespace, key, value, value_type, description (required for create and update)
Tùy Chọn Xác Thực (validationData) JSON object specifying the value and type to validate (required for validate operation)

Output

The node outputs an array with one item containing a json property:

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

No binary data is produced by this node.

Dependencies

  • Requires an API credential for authenticating with the Sapo platform.
  • Depends on the internal SapoApiBase class to interact with the Sapo metafields API.
  • The node expects proper configuration of credentials in n8n to access the Sapo API.

Troubleshooting

  • Common issues:
    • Invalid or missing resource IDs or metafield IDs will cause API errors.
    • Incorrectly formatted JSON in data or validationData properties may lead to validation failures or request rejections.
    • Insufficient permissions or invalid API credentials can result in authentication errors.
  • Error messages:
    • Errors returned from the Sapo API are surfaced with their message and stack trace.
    • If continueOnFail is enabled, errors are returned as part of the output JSON under an error field.
  • Resolution tips:
    • Verify that all required IDs and JSON inputs are correctly provided.
    • Ensure API credentials are valid and have necessary permissions.
    • Use the Validate operation to pre-check values before attempting create or update.

Links and References

Discussion