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 → Tạo Mới

AI-generated

Overview

This node manages custom metafields on various resource types within the Sapo platform. Metafields are additional data fields that can be attached to resources such as pages, products, orders, customers, and more, allowing users to extend the default data model with custom information.

The "Create" operation for the "Trang" (Page) resource allows users to add a new custom metafield to a specific page by specifying its ID and the metafield data. This is useful when you want to store extra metadata about a page, such as custom attributes or configuration details not supported natively by Sapo.

Practical examples:

  • Adding a warehouse location identifier to a page representing a physical store.
  • Storing SEO-related custom tags or flags on a page.
  • Attaching custom JSON data for integration with external systems.

Properties

Name Meaning
ID Tài Nguyên The numeric ID of the page resource to which the metafield will be added.
Dữ Liệu Trường Tùy Chỉnh A JSON object defining the metafield's namespace, key, value, value type, and description. Example structure:
json { "namespace": "inventory", "key": "warehouse_location", "value": "A-12", "value_type": "string", "description": "Storage location in warehouse" }

Output

The node outputs an array with one item containing a json field. For the "create" operation, this json contains the newly created metafield object returned from the Sapo API. This object includes all details of the metafield such as its ID, namespace, key, value, value type, description, and associated resource identifiers.

No binary data output is produced by this node.

Dependencies

  • Requires an active connection to the Sapo API via an API credential configured in n8n.
  • The node depends on the internal SapoApiBase class to handle API requests related to metafields.
  • Proper permissions on the Sapo account to create metafields on the specified resource are necessary.

Troubleshooting

  • Common issues:

    • Invalid or missing resource ID: Ensure the page ID provided exists and is correct.
    • Malformed JSON in the metafield data property: Validate the JSON structure before execution.
    • Insufficient API permissions: Verify that the API credentials have rights to modify metafields.
    • API rate limits or connectivity issues may cause request failures.
  • Error messages:

    • Errors returned from the Sapo API will be surfaced with their message. For example, "Resource not found" indicates an invalid page ID.
    • JSON parsing errors if the metafield data is not valid JSON.
    • Authentication errors if the API key is invalid or expired.

To resolve these, double-check input values, ensure valid JSON formatting, and confirm API credentials and permissions.

Links and References

Discussion