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

AI-generated

Overview

This node manages custom metafields on various resource types within the Sapo platform, such as articles, blogs, collections, customers, orders, pages, products, and product variants. It allows users to perform operations like creating, retrieving details, updating, deleting, counting, validating, and bulk deleting metafields associated with a specific resource.

A common use case is enriching resources (e.g., an article or product) with additional metadata that is not part of the standard fields, enabling more flexible data management and integration scenarios. For example, you might add a custom "warehouse_location" metafield to a product to track inventory storage locations or attach extra descriptive information to blog posts.

Specifically for the "Bài Viết" (Articles) resource and the "Lấy Chi Tiết" (Get Detail) operation, this node fetches detailed information about a single custom metafield identified by its ID for a given article.

Properties

Name Meaning
Thao Tác (operation) The action to perform on the metafield. Options include: Create, Get Detail, Get Many, Update, Delete, Bulk Delete, Count, Validate.
Tài Nguyên (resource) The type of resource the metafield belongs to. Options include Articles, Blogs, Collections, Customers, Orders, Pages, Products, Variants.
ID Tài Nguyên (resourceId) The unique identifier of the resource (e.g., article ID) to which the metafield is attached. Required for all operations.
ID Trường Tùy Chỉnh (metafieldId) The unique identifier of the metafield. Required for Get Detail, Update, and Delete operations.
Trả Về Tất Cả (returnAll) Whether to return all metafields when listing multiple entries or limit the number of results. Only applicable for Get Many operation.
Giới Hạn (limit) Maximum number of metafields to return when not returning all. Only applicable for Get Many operation.
Thông Tin Bổ Sung (additionalFields) Additional filters or parameters such as namespace, key, creation date range to refine list, count, or bulk delete operations.
Dữ Liệu Trường Tùy Chỉnh (data) JSON object containing metafield data for create or update operations, including namespace, key, value, value type, and 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 a JSON object representing the result of the requested operation:

  • For Get Detail (Lấy Chi Tiết), the output JSON contains the detailed metafield data retrieved from the Sapo API for the specified resource and metafield ID.
  • For Create, Update, and other operations, the output reflects the created or updated metafield or the success status.
  • For Get Many, the output is a list of metafields matching the criteria.
  • For Delete operations, the output confirms success.
  • For Count, the output provides the count of metafields matching the filters.
  • For Validate, the output indicates whether the provided metafield value is valid.

If the node encounters errors and is configured to continue on failure, the output JSON will contain an error field with the error message.

The node does not output binary data.

Dependencies

  • Requires an active connection to the Sapo platform via an API key credential configured in n8n.
  • Uses the Sapo API base class internally to interact with metafields endpoints.
  • No additional external dependencies beyond the Sapo API and n8n environment.

Troubleshooting

  • Common Issues:

    • Invalid or missing resource ID or metafield ID can cause failures in fetching or modifying metafields.
    • Incorrect JSON format in the data or validationData properties may lead to validation errors.
    • Insufficient permissions or invalid API credentials will result in authentication errors.
    • Using unsupported operations or mismatched resource-operation combinations may cause unexpected errors.
  • Error Messages:

    • Errors returned from the Sapo API are surfaced with their messages. For example, "Resource not found" if the specified article or metafield ID does not exist.
    • Validation errors indicate issues with the metafield data structure or values.
    • Network or authentication errors suggest checking API credentials and connectivity.
  • Resolution Tips:

    • Verify that the resource ID and metafield ID are correct and exist in the Sapo system.
    • Ensure JSON inputs are well-formed and comply with expected metafield schema.
    • Confirm API credentials are valid and have necessary permissions.
    • Use the "Get Many" operation with filters to confirm available metafields before attempting updates or deletes.

Links and References

Discussion