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

Trang → Lấy Chi Tiết

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, validate, and bulk delete metafields associated with resources such as pages, products, orders, blogs, and more.

A common use case is enriching standard resources with additional metadata that is not natively supported by Sapo. For example, adding a warehouse location to a product or attaching custom notes to an order.

Practical examples:

  • Retrieve detailed information about a specific metafield attached to a page.
  • Create a new metafield for a product to store inventory location data.
  • Update an existing metafield on a blog post.
  • Count how many metafields exist for a given customer.
  • Validate if a value conforms to expected metafield formats before saving.

Properties

Name Meaning
Thao Tác (operation) The action to perform on metafields: create, get, getMany, update, delete, bulkDelete, count, validate
Tài Nguyên (resource) The type of resource the metafield belongs to: articles, blogs, collections, customers, orders, pages, products, variants
ID Tài Nguyên (resourceId) Numeric identifier of the resource instance to which the metafield is attached
ID Trường Tùy Chỉnh (metafieldId) Numeric identifier of the specific metafield (required for get, update, delete operations)
Trả Về Tất Cả (returnAll) Boolean flag 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) Optional filters and parameters such as namespace, key, creation date range for list, count, and bulk delete operations
Dữ Liệu Trường Tùy Chỉnh (data) JSON object containing metafield details like namespace, key, value, value_type, description (for create and update)
Tùy Chọn Xác Thực (validationData) JSON object specifying the type and value to validate against metafield rules (validate operation)

Output

The node outputs a single JSON object per execution containing the result of the requested operation:

  • For get and getMany, it returns the metafield(s) data including fields like namespace, key, value, value_type, description, owner_type, and owner_id.
  • For create and update, it returns the newly created or updated metafield object.
  • For delete and bulkDelete, it returns a success confirmation { success: true }.
  • For count, it returns an object with the count of metafields matching the criteria, e.g., { count: 5 }.
  • For validate, it returns { valid: true } if the validation passes.
  • In case of errors (if continueOnFail is enabled), it returns an error object with the message.

The node does not output binary data.

Dependencies

  • Requires an active connection to the Sapo API via an API authentication credential configured in n8n.
  • Uses the internal SapoApiBase helper class to interact with metafield endpoints.
  • No other external services are required.

Troubleshooting

  • Common issues:

    • Invalid or missing resource IDs or metafield IDs will cause API errors.
    • Providing malformed JSON in the data or validationData properties can lead to validation failures.
    • Insufficient permissions or invalid API credentials will result in authentication errors.
    • Using unsupported resource types or operations may cause unexpected errors.
  • Error messages:

    • "Resource not found": Check that the resource ID exists and is correct.
    • "Metafield not found": Verify the metafield ID corresponds to the specified resource.
    • "Invalid JSON format": Ensure JSON input fields are properly formatted.
    • "Authentication failed": Confirm API credentials are correctly set up and valid.

To resolve errors, verify input parameters, ensure proper API credentials, and consult Sapo API documentation for resource and metafield constraints.

Links and References

Discussion