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 → Lấy Chi Tiết

AI-generated

Overview

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

A common use case is when you want to extend the data model of your Sapo resources by adding custom fields (metafields) that store additional metadata not available by default. For example, you might add a "warehouse_location" metafield to a product or a "reading_time" metafield to a blog article.

Specifically for the Blog resource and the Lấy Chi Tiết (Get Detail) operation, the node fetches detailed information about a particular metafield identified by its ID on a specified blog.

Practical examples:

  • Retrieve details of a custom metafield on a blog post to display or process its value.
  • Update a metafield's value to reflect new metadata.
  • Validate a metafield value before saving it.
  • Count how many metafields exist for a given blog.

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 include 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 (e.g., a particular blog post) to which the metafield is attached. Required.
ID Trường Tùy Chỉnh (metafieldId) Numeric ID of the metafield. Required for operations: get, update, delete.
Trả Về Tất Cả (returnAll) Boolean indicating whether to return all results or limit them (used in getMany operation).
Giới Hạn (limit) Maximum number of results to return when returnAll is false (used in getMany operation).
Thông Tin Bổ Sung (additionalFields) Additional filters or parameters such as Namespace, Key, Created After, Created Before to refine queries for list, bulkDelete, or count operations.
Dữ Liệu Trường Tùy Chỉnh (data) JSON object containing metafield data for create or update operations. Example structure includes namespace, key, value, value_type, description.
Tùy Chọn Xác Thực (validationData) JSON object used to validate a metafield value without saving it.

Output

The node outputs an array with one item per execution, each containing a json property with the result of the operation:

  • For Lấy Chi Tiết (get) operation on Blog metafield, the output JSON contains the detailed metafield object retrieved from Sapo, including properties like namespace, key, value, value_type, description, owner_type, and owner_id.
  • For create, update, and other operations, the output JSON reflects the created/updated metafield or success status.
  • For delete, the output JSON contains { success: true } upon successful deletion.
  • For count, the output JSON contains { count: <number> }.
  • For validate, the output JSON contains { valid: true } if validation passes.
  • If an error occurs and "Continue On Fail" is enabled, the output JSON contains an error field with the error message.

The node does not output binary data.

Dependencies

  • Requires an API credential for authenticating with the Sapo platform.
  • Depends on the internal SapoApiBase class to interact with Sapo's metafield API endpoints.
  • No external services beyond Sapo API are required.
  • The node expects proper configuration of the API credentials in n8n to function correctly.

Troubleshooting

  • Common issues:

    • Invalid or missing resource ID or metafield ID will cause errors.
    • Incorrect API credentials or expired tokens will lead to authentication failures.
    • Providing malformed JSON in the data or validationData fields can cause parsing errors.
    • Using unsupported operations or mismatched resource-operation combinations may result in unexpected errors.
  • Error messages:

    • Errors returned from the Sapo API are surfaced with their message and stack trace.
    • If "Continue On Fail" is disabled, the node execution stops on the first error.
    • To resolve errors, verify input parameters, ensure API credentials are valid, and check the JSON structure of input data.

Links and References


If you need details on other operations or resources, please provide their names.

Discussion